PageRenderTime 61ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/administrator/components/com_categories/views/categories/tmpl/default.php

https://gitlab.com/lankerd/paGO---Testing-Site
PHP | 282 lines | 258 code | 14 blank | 10 comment | 56 complexity | d8601cf9cff8280a8190bdb8c77b38f8 MD5 | raw file
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_categories
  5. *
  6. * @copyright Copyright (C) 2005 - 2016 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. use Joomla\String\Inflector;
  11. // Include the component HTML helpers.
  12. JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');
  13. JHtml::_('bootstrap.tooltip');
  14. JHtml::_('behavior.multiselect');
  15. JHtml::_('formbehavior.chosen', 'select');
  16. $app = JFactory::getApplication();
  17. $user = JFactory::getUser();
  18. $userId = $user->get('id');
  19. $extension = $this->escape($this->state->get('filter.extension'));
  20. $listOrder = $this->escape($this->state->get('list.ordering'));
  21. $listDirn = $this->escape($this->state->get('list.direction'));
  22. $ordering = ($listOrder == 'a.lft');
  23. $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
  24. $parts = explode('.', $extension);
  25. $component = $parts[0];
  26. $section = null;
  27. if (count($parts) > 1)
  28. {
  29. $section = $parts[1];
  30. $inflector = Inflector::getInstance();
  31. if (!$inflector->isPlural($section))
  32. {
  33. $section = $inflector->toPlural($section);
  34. }
  35. }
  36. $columns = 7;
  37. if ($saveOrder)
  38. {
  39. $saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component';
  40. JHtml::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
  41. }
  42. ?>
  43. <form action="<?php echo JRoute::_('index.php?option=com_categories&view=categories'); ?>" method="post" name="adminForm" id="adminForm">
  44. <div id="j-sidebar-container" class="span2">
  45. <?php echo $this->sidebar; ?>
  46. </div>
  47. <div id="j-main-container" class="span10">
  48. <?php
  49. // Search tools bar
  50. echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this));
  51. ?>
  52. <?php if (empty($this->items)) : ?>
  53. <div class="alert alert-no-items">
  54. <?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
  55. </div>
  56. <?php else : ?>
  57. <table class="table table-striped" id="categoryList">
  58. <thead>
  59. <tr>
  60. <th width="1%" class="nowrap center hidden-phone">
  61. <?php echo JHtml::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
  62. </th>
  63. <th width="1%" class="center">
  64. <?php echo JHtml::_('grid.checkall'); ?>
  65. </th>
  66. <th width="1%" class="nowrap center">
  67. <?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
  68. </th>
  69. <th>
  70. <?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  71. </th>
  72. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) :
  73. $columns++; ?>
  74. <th width="1%" class="nowrap center hidden-phone">
  75. <i class="icon-publish hasTooltip" title="<?php echo JText::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>"></i>
  76. </th>
  77. <?php endif;?>
  78. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) :
  79. $columns++; ?>
  80. <th width="1%" class="nowrap center hidden-phone">
  81. <i class="icon-unpublish hasTooltip" title="<?php echo JText::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>"></i>
  82. </th>
  83. <?php endif;?>
  84. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) :
  85. $columns++; ?>
  86. <th width="1%" class="nowrap center hidden-phone">
  87. <i class="icon-archive hasTooltip" title="<?php echo JText::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>"></i>
  88. </th>
  89. <?php endif;?>
  90. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) :
  91. $columns++; ?>
  92. <th width="1%" class="nowrap center hidden-phone">
  93. <i class="icon-trash hasTooltip" title="<?php echo JText::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>"></i>
  94. </th>
  95. <?php endif;?>
  96. <th width="10%" class="nowrap hidden-phone">
  97. <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
  98. </th>
  99. <?php if ($this->assoc) :
  100. $columns++; ?>
  101. <th width="5%" class="hidden-phone">
  102. <?php echo JHtml::_('searchtools.sort', 'COM_CATEGORY_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
  103. </th>
  104. <?php endif; ?>
  105. <th width="10%" class="nowrap hidden-phone">
  106. <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
  107. </th>
  108. <th width="1%" class="nowrap hidden-phone">
  109. <?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  110. </th>
  111. </tr>
  112. </thead>
  113. <tfoot>
  114. <tr>
  115. <td colspan="<?php echo $columns; ?>">
  116. <?php echo $this->pagination->getListFooter(); ?>
  117. </td>
  118. </tr>
  119. </tfoot>
  120. <tbody>
  121. <?php foreach ($this->items as $i => $item) : ?>
  122. <?php
  123. $orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
  124. $canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id);
  125. $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
  126. $canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId;
  127. $canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin;
  128. // Get the parents of item for sorting
  129. if ($item->level > 1)
  130. {
  131. $parentsStr = "";
  132. $_currentParentId = $item->parent_id;
  133. $parentsStr = " " . $_currentParentId;
  134. for ($i2 = 0; $i2 < $item->level; $i2++)
  135. {
  136. foreach ($this->ordering as $k => $v)
  137. {
  138. $v = implode("-", $v);
  139. $v = "-" . $v . "-";
  140. if (strpos($v, "-" . $_currentParentId . "-") !== false)
  141. {
  142. $parentsStr .= " " . $k;
  143. $_currentParentId = $k;
  144. break;
  145. }
  146. }
  147. }
  148. }
  149. else
  150. {
  151. $parentsStr = "";
  152. }
  153. ?>
  154. <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 ?>">
  155. <td class="order nowrap center hidden-phone">
  156. <?php
  157. $iconClass = '';
  158. if (!$canChange)
  159. {
  160. $iconClass = ' inactive';
  161. }
  162. elseif (!$saveOrder)
  163. {
  164. $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
  165. }
  166. ?>
  167. <span class="sortable-handler<?php echo $iconClass ?>">
  168. <span class="icon-menu"></span>
  169. </span>
  170. <?php if ($canChange && $saveOrder) : ?>
  171. <input type="text" style="display:none" name="order[]" size="5" value="<?php echo $orderkey + 1; ?>" />
  172. <?php endif; ?>
  173. </td>
  174. <td class="center">
  175. <?php echo JHtml::_('grid.id', $i, $item->id); ?>
  176. </td>
  177. <td class="center">
  178. <?php echo JHtml::_('jgrid.published', $item->published, $i, 'categories.', $canChange); ?>
  179. </td>
  180. <td>
  181. <?php echo str_repeat('<span class="gi">&mdash;</span>', $item->level - 1) ?>
  182. <?php if ($item->checked_out) : ?>
  183. <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'categories.', $canCheckin); ?>
  184. <?php endif; ?>
  185. <?php if ($canEdit || $canEditOwn) : ?>
  186. <a class="hasTooltip" href="<?php echo JRoute::_('index.php?option=com_categories&task=category.edit&id=' . $item->id . '&extension=' . $extension); ?>" title="<?php echo JText::_('JACTION_EDIT'); ?>">
  187. <?php echo $this->escape($item->title); ?></a>
  188. <?php else : ?>
  189. <?php echo $this->escape($item->title); ?>
  190. <?php endif; ?>
  191. <span class="small" title="<?php echo $this->escape($item->path); ?>">
  192. <?php if (empty($item->note)) : ?>
  193. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
  194. <?php else : ?>
  195. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
  196. <?php endif; ?>
  197. </span>
  198. </td>
  199. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
  200. <td class="center btns hidden-phone">
  201. <a class="badge <?php if ($item->count_published > 0) echo "badge-success"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=1' . '&filter[level]=' . (int) $item->level);?>">
  202. <?php echo $item->count_published; ?></a>
  203. </td>
  204. <?php endif;?>
  205. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
  206. <td class="center btns hidden-phone">
  207. <a class="badge <?php if ($item->count_unpublished > 0) echo "badge-important"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=0' . '&filter[level]=' . (int) $item->level);?>">
  208. <?php echo $item->count_unpublished; ?></a>
  209. </td>
  210. <?php endif;?>
  211. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
  212. <td class="center btns hidden-phone">
  213. <a class="badge <?php if ($item->count_archived > 0) echo "badge-info"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=2' . '&filter[level]=' . (int) $item->level);?>">
  214. <?php echo $item->count_archived; ?></a>
  215. </td>
  216. <?php endif;?>
  217. <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
  218. <td class="center btns hidden-phone">
  219. <a class="badge <?php if ($item->count_trashed > 0) echo "badge-inverse"; ?>" title="<?php echo JText::_('COM_CATEGORY_COUNT_TRASHED_ITEMS');?>" href="<?php echo JRoute::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=-2' . '&filter[level]=' . (int) $item->level);?>">
  220. <?php echo $item->count_trashed; ?></a>
  221. </td>
  222. <?php endif;?>
  223. <td class="small hidden-phone">
  224. <?php echo $this->escape($item->access_level); ?>
  225. </td>
  226. <?php if ($this->assoc) : ?>
  227. <td class="hidden-phone">
  228. <?php if ($item->association): ?>
  229. <?php echo JHtml::_('CategoriesAdministrator.association', $item->id, $extension); ?>
  230. <?php endif; ?>
  231. </td>
  232. <?php endif; ?>
  233. <td class="small nowrap hidden-phone">
  234. <?php if ($item->language == '*') : ?>
  235. <?php echo JText::alt('JALL', 'language'); ?>
  236. <?php else: ?>
  237. <?php echo $item->language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . '&nbsp;' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
  238. <?php endif; ?>
  239. </td>
  240. <td class="hidden-phone">
  241. <span title="<?php echo sprintf('%d-%d', $item->lft, $item->rgt); ?>">
  242. <?php echo (int) $item->id; ?></span>
  243. </td>
  244. </tr>
  245. <?php endforeach; ?>
  246. </tbody>
  247. </table>
  248. <?php // Load the batch processing form. ?>
  249. <?php if ($user->authorise('core.create', $extension)
  250. && $user->authorise('core.edit', $extension)
  251. && $user->authorise('core.edit.state', $extension)) : ?>
  252. <?php echo JHtml::_(
  253. 'bootstrap.renderModal',
  254. 'collapseModal',
  255. array(
  256. 'title' => JText::_('COM_CATEGORIES_BATCH_OPTIONS'),
  257. 'footer' => $this->loadTemplate('batch_footer')
  258. ),
  259. $this->loadTemplate('batch_body')
  260. ); ?>
  261. <?php endif; ?>
  262. <?php endif; ?>
  263. <input type="hidden" name="extension" value="<?php echo $extension; ?>" />
  264. <input type="hidden" name="task" value="" />
  265. <input type="hidden" name="boxchecked" value="0" />
  266. <?php echo JHtml::_('form.token'); ?>
  267. </div>
  268. </form>