PageRenderTime 39ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/pastor399/newcastleunifc
PHP | 245 lines | 229 code | 7 blank | 9 comment | 37 complexity | f29684783b7036258bbf05ff2a483769 MD5 | raw file
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_categories
  5. *
  6. * @copyright Copyright (C) 2005 - 2013 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. $app = JFactory::getApplication();
  16. $user = JFactory::getUser();
  17. $userId = $user->get('id');
  18. $extension = $this->escape($this->state->get('filter.extension'));
  19. $listOrder = $this->escape($this->state->get('list.ordering'));
  20. $listDirn = $this->escape($this->state->get('list.direction'));
  21. $ordering = ($listOrder == 'a.lft');
  22. $saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc');
  23. if ($saveOrder)
  24. {
  25. $saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component';
  26. JHtml::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
  27. }
  28. $sortFields = $this->getSortFields();
  29. ?>
  30. <script type="text/javascript">
  31. Joomla.orderTable = function()
  32. {
  33. table = document.getElementById("sortTable");
  34. direction = document.getElementById("directionTable");
  35. order = table.options[table.selectedIndex].value;
  36. if (order != '<?php echo $listOrder; ?>')
  37. {
  38. dirn = 'asc';
  39. }
  40. else
  41. {
  42. dirn = direction.options[direction.selectedIndex].value;
  43. }
  44. Joomla.tableOrdering(order, dirn, '');
  45. }
  46. </script>
  47. <form action="<?php echo JRoute::_('index.php?option=com_categories&view=categories');?>" method="post" name="adminForm" id="adminForm">
  48. <?php if (!empty( $this->sidebar)) : ?>
  49. <div id="j-sidebar-container" class="span2">
  50. <?php echo $this->sidebar; ?>
  51. </div>
  52. <div id="j-main-container" class="span10">
  53. <?php else : ?>
  54. <div id="j-main-container">
  55. <?php endif;?>
  56. <div id="filter-bar" class="btn-toolbar">
  57. <div class="filter-search btn-group pull-left">
  58. <label for="filter_search" class="element-invisible"><?php echo JText::_('COM_CATEGORIES_ITEMS_SEARCH_FILTER');?></label>
  59. <input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('COM_CATEGORIES_ITEMS_SEARCH_FILTER'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_CATEGORIES_ITEMS_SEARCH_FILTER'); ?>" />
  60. </div>
  61. <div class="btn-group hidden-phone">
  62. <button class="btn tip" type="submit" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
  63. <button class="btn tip" type="button" onclick="document.id('filter_search').value='';this.form.submit();" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>"><i class="icon-remove"></i></button>
  64. </div>
  65. <div class="btn-group pull-right hidden-phone">
  66. <label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
  67. <?php echo $this->pagination->getLimitBox(); ?>
  68. </div>
  69. <div class="btn-group pull-right hidden-phone">
  70. <label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
  71. <select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
  72. <option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
  73. <option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
  74. <option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
  75. </select>
  76. </div>
  77. <div class="btn-group pull-right">
  78. <label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
  79. <select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
  80. <option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
  81. <?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
  82. </select>
  83. </div>
  84. <div class="clearfix"></div>
  85. </div>
  86. <table class="table table-striped" id="categoryList">
  87. <thead>
  88. <tr>
  89. <th width="1%" class="nowrap center hidden-phone">
  90. <?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
  91. </th>
  92. <th width="1%" class="hidden-phone">
  93. <input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
  94. </th>
  95. <th width="1%" class="nowrap center">
  96. <?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
  97. </th>
  98. <th>
  99. <?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  100. </th>
  101. <th width="10%" class="nowrap hidden-phone">
  102. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
  103. </th>
  104. <?php if ($this->assoc) : ?>
  105. <th width="5%" class="hidden-phone">
  106. <?php echo JHtml::_('grid.sort', 'COM_CATEGORY_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
  107. </th>
  108. <?php endif; ?>
  109. <th width="5%" class="nowrap hidden-phone">
  110. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'language', $this->state->get('list.direction'), $this->state->get('list.ordering')); ?>
  111. </th>
  112. <th width="1%" class="nowrap hidden-phone">
  113. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  114. </th>
  115. </tr>
  116. </thead>
  117. <tfoot>
  118. <tr>
  119. <td colspan="15">
  120. <?php echo $this->pagination->getListFooter(); ?>
  121. </td>
  122. </tr>
  123. </tfoot>
  124. <tbody>
  125. <?php
  126. $originalOrders = array();
  127. foreach ($this->items as $i => $item) :
  128. $orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
  129. $canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id);
  130. $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
  131. $canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId;
  132. $canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin;
  133. // Get the parents of item for sorting
  134. if ($item->level > 1)
  135. {
  136. $parentsStr = "";
  137. $_currentParentId = $item->parent_id;
  138. $parentsStr = " " . $_currentParentId;
  139. for ($i2 = 0; $i2 < $item->level; $i2++)
  140. {
  141. foreach ($this->ordering as $k => $v)
  142. {
  143. $v = implode("-", $v);
  144. $v = "-".$v."-";
  145. if (strpos($v, "-" . $_currentParentId . "-") !== false)
  146. {
  147. $parentsStr .= " " . $k;
  148. $_currentParentId = $k;
  149. break;
  150. }
  151. }
  152. }
  153. }
  154. else
  155. {
  156. $parentsStr = "";
  157. }
  158. ?>
  159. <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?>">
  160. <td class="order nowrap center hidden-phone">
  161. <?php if ($canChange) :
  162. $disableClassName = '';
  163. $disabledLabel = '';
  164. if (!$saveOrder) :
  165. $disabledLabel = JText::_('JORDERINGDISABLED');
  166. $disableClassName = 'inactive tip-top';
  167. endif; ?>
  168. <span class="sortable-handler hasTooltip <?php echo $disableClassName?>" title="<?php echo $disabledLabel?>">
  169. <i class="icon-menu"></i>
  170. </span>
  171. <?php else : ?>
  172. <span class="sortable-handler inactive">
  173. <i class="icon-menu"></i>
  174. </span>
  175. <?php endif; ?>
  176. <input type="text" style="display:none" name="order[]" size="5" value="<?php echo $orderkey + 1;?>" />
  177. </td>
  178. <td class="center hidden-phone">
  179. <?php echo JHtml::_('grid.id', $i, $item->id); ?>
  180. </td>
  181. <td class="center">
  182. <?php echo JHtml::_('jgrid.published', $item->published, $i, 'categories.', $canChange);?>
  183. </td>
  184. <td>
  185. <?php echo str_repeat('<span class="gi">&mdash;</span>', $item->level - 1) ?>
  186. <?php if ($item->checked_out) : ?>
  187. <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'categories.', $canCheckin); ?>
  188. <?php endif; ?>
  189. <?php if ($canEdit || $canEditOwn) : ?>
  190. <a href="<?php echo JRoute::_('index.php?option=com_categories&task=category.edit&id='.$item->id.'&extension='.$extension);?>">
  191. <?php echo $this->escape($item->title); ?></a>
  192. <?php else : ?>
  193. <?php echo $this->escape($item->title); ?>
  194. <?php endif; ?>
  195. <span class="small" title="<?php echo $this->escape($item->path); ?>">
  196. <?php if (empty($item->note)) : ?>
  197. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
  198. <?php else : ?>
  199. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note));?>
  200. <?php endif; ?>
  201. </span>
  202. </td>
  203. <td class="small hidden-phone">
  204. <?php echo $this->escape($item->access_level); ?>
  205. </td>
  206. <?php if ($this->assoc) : ?>
  207. <td class="center hidden-phone">
  208. <?php if ($item->association):?>
  209. <?php echo JHtml::_('CategoriesAdministrator.association', $item->id, $extension); ?>
  210. <?php endif;?>
  211. </td>
  212. <?php endif;?>
  213. <td class="small nowrap hidden-phone">
  214. <?php if ($item->language == '*') : ?>
  215. <?php echo JText::alt('JALL', 'language'); ?>
  216. <?php else:?>
  217. <?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
  218. <?php endif;?>
  219. </td>
  220. <td class="center hidden-phone">
  221. <span title="<?php echo sprintf('%d-%d', $item->lft, $item->rgt); ?>">
  222. <?php echo (int) $item->id; ?></span>
  223. </td>
  224. </tr>
  225. <?php endforeach; ?>
  226. </tbody>
  227. </table>
  228. <?php //Load the batch processing form. ?>
  229. <?php echo $this->loadTemplate('batch'); ?>
  230. <input type="hidden" name="extension" value="<?php echo $extension; ?>" />
  231. <input type="hidden" name="task" value="" />
  232. <input type="hidden" name="boxchecked" value="0" />
  233. <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
  234. <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
  235. <input type="hidden" name="original_order_values" value="<?php echo implode($originalOrders, ','); ?>" />
  236. <?php echo JHtml::_('form.token'); ?>
  237. </div>
  238. </form>