/administrator/components/com_newsfeeds/views/newsfeeds/tmpl/default.php

https://bitbucket.org/eternaware/joomus · PHP · 233 lines · 212 code · 11 blank · 10 comment · 32 complexity · 99b8adb78af7a87d1eaacc90cbca3661 MD5 · raw file

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