PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/joomla/administrator/components/com_menus/views/items/tmpl/default.php

https://gitlab.com/ricardosanchez/prueba
PHP | 249 lines | 226 code | 13 blank | 10 comment | 47 complexity | ed1a4e354497660455be366d20a01ea0 MD5 | raw file
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_menus
  5. *
  6. * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. defined('_JEXEC') or die;
  10. // Include the component HTML helpers.
  11. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
  12. JHtml::_('bootstrap.tooltip');
  13. JHtml::_('behavior.multiselect');
  14. JHtml::_('formbehavior.chosen', 'select');
  15. $user = JFactory::getUser();
  16. $app = JFactory::getApplication();
  17. $userId = $user->get('id');
  18. $listOrder = $this->escape($this->state->get('list.ordering'));
  19. $listDirn = $this->escape($this->state->get('list.direction'));
  20. $ordering = ($listOrder == 'a.lft');
  21. $canOrder = $user->authorise('core.edit.state', 'com_menus');
  22. $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
  23. if ($saveOrder)
  24. {
  25. $saveOrderingUrl = 'index.php?option=com_menus&task=items.saveOrderAjax&tmpl=component';
  26. JHtml::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
  27. }
  28. $assoc = JLanguageAssociations::isEnabled();
  29. ?>
  30. <?php // Set up the filter bar. ?>
  31. <form action="<?php echo JRoute::_('index.php?option=com_menus&view=items');?>" method="post" name="adminForm" id="adminForm">
  32. <?php if (!empty( $this->sidebar)) : ?>
  33. <div id="j-sidebar-container" class="span2">
  34. <?php echo $this->sidebar; ?>
  35. </div>
  36. <div id="j-main-container" class="span10">
  37. <?php else : ?>
  38. <div id="j-main-container">
  39. <?php endif;?>
  40. <?php
  41. // Search tools bar
  42. echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this), null, array('debug' => false));
  43. ?>
  44. <?php if (empty($this->items)) : ?>
  45. <div class="alert alert-no-items">
  46. <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
  47. </div>
  48. <?php else : ?>
  49. <table class="table table-striped" id="itemList">
  50. <thead>
  51. <tr>
  52. <th width="1%" class="hidden-phone">
  53. <?php echo JHtml::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
  54. </th>
  55. <th width="1%" class="center">
  56. <?php echo JHtml::_('grid.checkall'); ?>
  57. </th>
  58. <th width="1%" class="nowrap center">
  59. <?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
  60. </th>
  61. <th class="title">
  62. <?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  63. </th>
  64. <th width="5%" class="center nowrap hidden-phone">
  65. <?php echo JHtml::_('searchtools.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
  66. </th>
  67. <th width="10%" class="nowrap hidden-phone">
  68. <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
  69. </th>
  70. <?php if ($assoc) : ?>
  71. <th width="5%" class="nowrap hidden-phone">
  72. <?php echo JHtml::_('searchtools.sort', 'COM_MENUS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
  73. </th>
  74. <?php endif;?>
  75. <th width="5%" class="nowrap hidden-phone">
  76. <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
  77. </th>
  78. <th width="1%" class="nowrap hidden-phone">
  79. <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  80. </th>
  81. </tr>
  82. </thead>
  83. <tfoot>
  84. <tr>
  85. <td colspan="15">
  86. <?php echo $this->pagination->getListFooter(); ?>
  87. </td>
  88. </tr>
  89. </tfoot>
  90. <tbody>
  91. <?php
  92. foreach ($this->items as $i => $item) :
  93. $orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
  94. $canCreate = $user->authorise('core.create', 'com_menus');
  95. $canEdit = $user->authorise('core.edit', 'com_menus');
  96. $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0;
  97. $canChange = $user->authorise('core.edit.state', 'com_menus') && $canCheckin;
  98. // Get the parents of item for sorting
  99. if ($item->level > 1)
  100. {
  101. $parentsStr = "";
  102. $_currentParentId = $item->parent_id;
  103. $parentsStr = " " . $_currentParentId;
  104. for ($j = 0; $j < $item->level; $j++)
  105. {
  106. foreach ($this->ordering as $k => $v)
  107. {
  108. $v = implode("-", $v);
  109. $v = "-" . $v . "-";
  110. if (strpos($v, "-" . $_currentParentId . "-") !== false)
  111. {
  112. $parentsStr .= " " . $k;
  113. $_currentParentId = $k;
  114. break;
  115. }
  116. }
  117. }
  118. }
  119. else
  120. {
  121. $parentsStr = "";
  122. }
  123. ?>
  124. <tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->parent_id;?>" item-id="<?php echo $item->id?>" parents="<?php echo $parentsStr?>" level="<?php echo $item->level?>">
  125. <td class="order nowrap center hidden-phone">
  126. <?php
  127. $iconClass = '';
  128. if (!$canChange)
  129. {
  130. $iconClass = ' inactive';
  131. }
  132. elseif (!$saveOrder)
  133. {
  134. $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
  135. }
  136. ?>
  137. <span class="sortable-handler<?php echo $iconClass ?>">
  138. <span class="icon-menu"></span>
  139. </span>
  140. <?php if ($canChange && $saveOrder) : ?>
  141. <input type="text" style="display:none" name="order[]" size="5" value="<?php echo $orderkey + 1;?>" />
  142. <?php endif; ?>
  143. </td>
  144. <td class="center">
  145. <?php echo JHtml::_('grid.id', $i, $item->id); ?>
  146. </td>
  147. <td class="center">
  148. <?php echo JHtml::_('MenusHtml.Menus.state', $item->published, $i, $canChange, 'cb'); ?>
  149. </td>
  150. <td>
  151. <?php echo str_repeat('<span class="gi">|&mdash;</span>', $item->level - 1) ?>
  152. <?php if ($item->checked_out) : ?>
  153. <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'items.', $canCheckin); ?>
  154. <?php endif; ?>
  155. <?php if ($canEdit) : ?>
  156. <a href="<?php echo JRoute::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id);?>">
  157. <?php echo $this->escape($item->title); ?></a>
  158. <?php else : ?>
  159. <?php echo $this->escape($item->title); ?>
  160. <?php endif; ?>
  161. <span class="small">
  162. <?php if ($item->type != 'url') : ?>
  163. <?php if (empty($item->note)) : ?>
  164. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
  165. <?php else : ?>
  166. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note));?>
  167. <?php endif; ?>
  168. <?php elseif ($item->type == 'url' && $item->note) : ?>
  169. <?php echo JText::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note));?>
  170. <?php endif; ?>
  171. </span>
  172. <div class="small" title="<?php echo $this->escape($item->path);?>">
  173. <?php echo str_repeat('<span class="gtr">&mdash;</span>', $item->level - 1) ?>
  174. <span title="<?php echo isset($item->item_type_desc) ? htmlspecialchars($this->escape($item->item_type_desc), ENT_COMPAT, 'UTF-8') : ''; ?>">
  175. <?php echo $this->escape($item->item_type); ?></span>
  176. </div>
  177. </td>
  178. <td class="center hidden-phone">
  179. <?php if ($item->type == 'component') : ?>
  180. <?php if ($item->language == '*' || $item->home == '0') : ?>
  181. <?php echo JHtml::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange); ?>
  182. <?php elseif ($canChange) : ?>
  183. <a href="<?php echo JRoute::_('index.php?option=com_menus&task=items.unsetDefault&cid[]=' . $item->id . '&' . JSession::getFormToken() . '=1'); ?>">
  184. <?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => JText::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title)), true); ?>
  185. </a>
  186. <?php else : ?>
  187. <?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true); ?>
  188. <?php endif; ?>
  189. <?php endif; ?>
  190. </td>
  191. <td class="small hidden-phone">
  192. <?php echo $this->escape($item->access_level); ?>
  193. </td>
  194. <?php if ($assoc) : ?>
  195. <td class="small hidden-phone">
  196. <?php if ($item->association) : ?>
  197. <?php echo JHtml::_('MenusHtml.Menus.association', $item->id); ?>
  198. <?php endif; ?>
  199. </td>
  200. <?php endif; ?>
  201. <td class="small hidden-phone">
  202. <?php if ($item->language == ''):?>
  203. <?php echo JText::_('JDEFAULT'); ?>
  204. <?php elseif ($item->language == '*') : ?>
  205. <?php echo JText::alt('JALL', 'language'); ?>
  206. <?php else : ?>
  207. <?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
  208. <?php endif; ?>
  209. </td>
  210. <td class="hidden-phone">
  211. <span title="<?php echo sprintf('%d-%d', $item->lft, $item->rgt); ?>">
  212. <?php echo (int) $item->id; ?>
  213. </span>
  214. </td>
  215. </tr>
  216. <?php endforeach; ?>
  217. </tbody>
  218. </table>
  219. <?php // Load the batch processing form if user is allowed ?>
  220. <?php if ($user->authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?>
  221. <?php echo JHtml::_(
  222. 'bootstrap.renderModal',
  223. 'collapseModal',
  224. array(
  225. 'title' => JText::_('COM_MENUS_BATCH_OPTIONS'),
  226. 'footer' => $this->loadTemplate('batch_footer')
  227. ),
  228. $this->loadTemplate('batch_body')
  229. ); ?>
  230. <?php endif; ?>
  231. <?php endif; ?>
  232. <input type="hidden" name="task" value="" />
  233. <input type="hidden" name="boxchecked" value="0" />
  234. <?php echo JHtml::_('form.token'); ?>
  235. </div>
  236. </form>