/administrator/components/com_weblinks/views/weblinks/tmpl/default.php

https://bitbucket.org/eternaware/joomus · PHP · 189 lines · 177 code · 5 blank · 7 comment · 23 complexity · 5876fdb881b583828b9466a6e5c2ee02 MD5 · raw file

  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage com_weblinks
  5. *
  6. * @copyright Copyright (C) 2005 - 2012 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. JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
  11. JHtml::_('behavior.tooltip');
  12. JHtml::_('behavior.multiselect');
  13. $user = JFactory::getUser();
  14. $userId = $user->get('id');
  15. $listOrder = $this->escape($this->state->get('list.ordering'));
  16. $listDirn = $this->escape($this->state->get('list.direction'));
  17. $canOrder = $user->authorise('core.edit.state', 'com_weblinks.category');
  18. $saveOrder = $listOrder == 'a.ordering';
  19. if ($saveOrder)
  20. {
  21. $saveOrderingUrl = 'index.php?option=com_weblinks&task=weblinks.saveOrderAjax&tmpl=component';
  22. JHtml::_('sortablelist.sortable', 'weblinkList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
  23. }
  24. $sortFields = $this->getSortFields();
  25. ?>
  26. <script type="text/javascript">
  27. Joomla.orderTable = function() {
  28. table = document.getElementById("sortTable");
  29. direction = document.getElementById("directionTable");
  30. order = table.options[table.selectedIndex].value;
  31. if (order != '<?php echo $listOrder; ?>') {
  32. dirn = 'asc';
  33. } else {
  34. dirn = direction.options[direction.selectedIndex].value;
  35. }
  36. Joomla.tableOrdering(order, dirn, '');
  37. }
  38. </script>
  39. <form action="<?php echo JRoute::_('index.php?option=com_weblinks&view=weblinks'); ?>" method="post" name="adminForm" id="adminForm">
  40. <div id="filter-bar" class="btn-toolbar">
  41. <div class="filter-search btn-group pull-left">
  42. <label for="filter_search" class="element-invisible"><?php echo JText::_('COM_WEBLINKS_SEARCH_IN_TITLE');?></label>
  43. <input type="text" name="filter_search" id="filter_search" placeholder="<?php echo JText::_('COM_WEBLINKS_SEARCH_IN_TITLE'); ?>" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_WEBLINKS_SEARCH_IN_TITLE'); ?>" />
  44. </div>
  45. <div class="btn-group pull-left">
  46. <button class="btn" rel="tooltip" type="submit" title="<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>"><i class="icon-search"></i></button>
  47. <button class="btn" rel="tooltip" type="button" title="<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>" onclick="document.id('filter_search').value='';this.form.submit();"><i class="icon-remove"></i></button>
  48. </div>
  49. <div class="btn-group pull-right hidden-phone">
  50. <label for="limit" class="element-invisible"><?php echo JText::_('JFIELD_PLG_SEARCH_SEARCHLIMIT_DESC');?></label>
  51. <?php echo $this->pagination->getLimitBox(); ?>
  52. </div>
  53. <div class="btn-group pull-right hidden-phone">
  54. <label for="directionTable" class="element-invisible"><?php echo JText::_('JFIELD_ORDERING_DESC');?></label>
  55. <select name="directionTable" id="directionTable" class="input-medium" onchange="Joomla.orderTable()">
  56. <option value=""><?php echo JText::_('JFIELD_ORDERING_DESC');?></option>
  57. <option value="asc" <?php if ($listDirn == 'asc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_ASCENDING');?></option>
  58. <option value="desc" <?php if ($listDirn == 'desc') echo 'selected="selected"'; ?>><?php echo JText::_('JGLOBAL_ORDER_DESCENDING');?></option>
  59. </select>
  60. </div>
  61. <div class="btn-group pull-right">
  62. <label for="sortTable" class="element-invisible"><?php echo JText::_('JGLOBAL_SORT_BY');?></label>
  63. <select name="sortTable" id="sortTable" class="input-medium" onchange="Joomla.orderTable()">
  64. <option value=""><?php echo JText::_('JGLOBAL_SORT_BY');?></option>
  65. <?php echo JHtml::_('select.options', $sortFields, 'value', 'text', $listOrder);?>
  66. </select>
  67. </div>
  68. </div>
  69. <div class="clearfix"> </div>
  70. <table class="table table-striped" id="weblinkList">
  71. <thead>
  72. <tr>
  73. <th width="1%" class="nowrap center hidden-phone">
  74. <?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?>
  75. </th>
  76. <th width="1%" class="hidden-phone">
  77. <input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
  78. </th>
  79. <th width="1%" class="nowrap center">
  80. <?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
  81. </th>
  82. <th class="title">
  83. <?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  84. </th>
  85. <th width="5%" class="nowrap hidden-phone">
  86. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
  87. </th>
  88. <th width="5%" class="nowrap center hidden-phone">
  89. <?php echo JHtml::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
  90. </th>
  91. <th width="5%" class="nowrap hidden-phone">
  92. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
  93. </th>
  94. <th width="1%" class="nowrap center hidden-phone">
  95. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  96. </th>
  97. </tr>
  98. </thead>
  99. <tfoot>
  100. <tr>
  101. <td colspan="10">
  102. <?php echo $this->pagination->getListFooter(); ?>
  103. </td>
  104. </tr>
  105. </tfoot>
  106. <tbody>
  107. <?php foreach ($this->items as $i => $item) :
  108. $ordering = ($listOrder == 'a.ordering');
  109. $item->cat_link = JRoute::_('index.php?option=com_categories&extension=com_weblinks&task=edit&type=other&cid[]='. $item->catid);
  110. $canCreate = $user->authorise('core.create', 'com_weblinks.category.' . $item->catid);
  111. $canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $item->catid);
  112. $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
  113. $canChange = $user->authorise('core.edit.state', 'com_weblinks.category.' . $item->catid) && $canCheckin;
  114. ?>
  115. <tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid?>">
  116. <td class="order nowrap center hidden-phone">
  117. <?php if ($canChange) :
  118. $disableClassName = '';
  119. $disabledLabel = '';
  120. if (!$saveOrder) :
  121. $disabledLabel = JText::_('JORDERINGDISABLED');
  122. $disableClassName = 'inactive tip-top';
  123. endif; ?>
  124. <span class="sortable-handler <?php echo $disableClassName?>" title="<?php echo $disabledLabel?>" rel="tooltip">
  125. <i class="icon-menu"></i>
  126. </span>
  127. <input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering;?>" class="width-20 text-area-order " />
  128. <?php else : ?>
  129. <span class="sortable-handler inactive" >
  130. <i class="icon-menu"></i>
  131. </span>
  132. <?php endif; ?>
  133. </td>
  134. <td class="center hidden-phone">
  135. <?php echo JHtml::_('grid.id', $i, $item->id); ?>
  136. </td>
  137. <td class="center hidden-phone">
  138. <?php echo JHtml::_('jgrid.published', $item->state, $i, 'weblinks.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
  139. </td>
  140. <td class="nowrap">
  141. <?php if ($item->checked_out) : ?>
  142. <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'weblinks.', $canCheckin); ?>
  143. <?php endif; ?>
  144. <?php if ($canEdit) : ?>
  145. <a href="<?php echo JRoute::_('index.php?option=com_weblinks&task=weblink.edit&id='.(int) $item->id); ?>">
  146. <?php echo $this->escape($item->title); ?></a>
  147. <?php else : ?>
  148. <?php echo $this->escape($item->title); ?>
  149. <?php endif; ?>
  150. <span class="small">
  151. <?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias));?>
  152. </span>
  153. <div class="small">
  154. <?php echo $this->escape($item->category_title); ?>
  155. </div>
  156. </td>
  157. <td class="small hidden-phone">
  158. <?php echo $this->escape($item->access_level); ?>
  159. </td>
  160. <td class="center hidden-phone">
  161. <?php echo $item->hits; ?>
  162. </td>
  163. <td class="small nowrap hidden-phone">
  164. <?php if ($item->language == '*'):?>
  165. <?php echo JText::alt('JALL', 'language'); ?>
  166. <?php else:?>
  167. <?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
  168. <?php endif;?>
  169. </td>
  170. <td class="center hidden-phone">
  171. <?php echo (int) $item->id; ?>
  172. </td>
  173. </tr>
  174. <?php endforeach; ?>
  175. </tbody>
  176. </table>
  177. <?php //Load the batch processing form. ?>
  178. <?php echo $this->loadTemplate('batch'); ?>
  179. <input type="hidden" name="task" value="" />
  180. <input type="hidden" name="boxchecked" value="0" />
  181. <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
  182. <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
  183. <?php echo JHtml::_('form.token'); ?>
  184. </form>