PageRenderTime 27ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/src/administrator/templates/hathor/html/com_menus/menus/default.php

https://bitbucket.org/ke2083/transfans.co.uk-website
PHP | 206 lines | 187 code | 11 blank | 8 comment | 11 complexity | c1e3e4c3511763a5435d638db99f7cd0 MD5 | raw file
  1. <?php
  2. /**
  3. * @package Joomla.Administrator
  4. * @subpackage Template.hathor
  5. *
  6. * @copyright Copyright (C) 2005 - 2018 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.multiselect');
  13. $uri = JUri::getInstance();
  14. $return = base64_encode($uri);
  15. $user = JFactory::getUser();
  16. $userId = $user->get('id');
  17. $listOrder = $this->escape($this->state->get('list.ordering'));
  18. $listDirn = $this->escape($this->state->get('list.direction'));
  19. $modMenuId = (int) $this->get('ModMenuId');
  20. $script = array();
  21. $script[] = 'jQuery(document).ready(function() {';
  22. foreach ($this->items as $item) :
  23. if ($user->authorise('core.edit', 'com_menus')) :
  24. $script[] = ' function jSelectPosition_' . $item->id . '(name) {';
  25. $script[] = ' document.getElementById("' . $item->id . '").value = name;';
  26. $script[] = ' jQuery(".modal").modal("hide");';
  27. $script[] = ' };';
  28. endif;
  29. endforeach;
  30. $script[] = ' jQuery(".modal").on("hidden", function () {';
  31. $script[] = ' setTimeout(function(){';
  32. $script[] = ' window.parent.location.reload();';
  33. $script[] = ' },1000);';
  34. $script[] = ' });';
  35. $script[] = '});';
  36. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
  37. ?>
  38. <form action="<?php echo JRoute::_('index.php?option=com_menus&view=menus');?>" method="post" name="adminForm" id="adminForm">
  39. <?php if (!empty( $this->sidebar)) : ?>
  40. <div id="j-sidebar-container" class="span2">
  41. <?php echo $this->sidebar; ?>
  42. </div>
  43. <div id="j-main-container" class="span10">
  44. <?php else : ?>
  45. <div id="j-main-container">
  46. <?php endif;?>
  47. <fieldset id="filter-bar">
  48. <legend class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></legend>
  49. <div class="filter-search">
  50. <label class="filter-search-lbl" for="filter_search"><?php echo JText::_('COM_MENUS_MENU_SEARCH_FILTER'); ?></label>
  51. <input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="<?php echo JText::_('COM_MENUS_ITEMS_SEARCH_FILTER'); ?>" />
  52. <button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
  53. <button type="button" onclick="document.getElementById('filter_search').value='';this.form.submit();"><?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?></button>
  54. </div>
  55. </fieldset>
  56. <div class="clearfix"> </div>
  57. <table class="adminlist">
  58. <thead>
  59. <tr>
  60. <th class="checkmark-col" rowspan="2">
  61. <input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
  62. </th>
  63. <th rowspan="2">
  64. <?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  65. </th>
  66. <th class="width-30" colspan="3">
  67. <?php echo JText::_('COM_MENUS_HEADING_NUMBER_MENU_ITEMS'); ?>
  68. </th>
  69. <th class="width-20" rowspan="2">
  70. <?php echo JText::_('COM_MENUS_HEADING_LINKED_MODULES'); ?>
  71. </th>
  72. <th class="nowrap id-col" rowspan="2">
  73. <?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  74. </th>
  75. </tr>
  76. <tr>
  77. <th class="width-10">
  78. <?php echo JText::_('COM_MENUS_HEADING_PUBLISHED_ITEMS'); ?>
  79. </th>
  80. <th class="width-10">
  81. <?php echo JText::_('COM_MENUS_HEADING_UNPUBLISHED_ITEMS'); ?>
  82. </th>
  83. <th class="width-10">
  84. <?php echo JText::_('COM_MENUS_HEADING_TRASHED_ITEMS'); ?>
  85. </th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <?php foreach ($this->items as $i => $item) :
  90. $canCreate = $user->authorise('core.create', 'com_menus');
  91. $canEdit = $user->authorise('core.edit', 'com_menus');
  92. $canChange = $user->authorise('core.edit.state', 'com_menus');
  93. $canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id);
  94. ?>
  95. <tr class="row<?php echo $i % 2; ?>">
  96. <td class="center">
  97. <?php echo JHtml::_('grid.id', $i, $item->id); ?>
  98. </td>
  99. <td>
  100. <?php if ($canManageItems) : ?>
  101. <a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype); ?>">
  102. <?php echo $this->escape($item->title); ?></a>
  103. <?php else : ?>
  104. <?php echo $this->escape($item->title); ?>
  105. <?php endif; ?>
  106. <p class="smallsub">(<span><?php echo JText::_('COM_MENUS_MENU_MENUTYPE_LABEL') ?></span>
  107. <?php if ($canEdit) : ?>
  108. <?php echo '<a href="'.JRoute::_('index.php?option=com_menus&task=menu.edit&id='.$item->id).' title='.$this->escape($item->description).'">'.
  109. $this->escape($item->menutype).'</a>'; ?>)
  110. <?php else : ?>
  111. <?php echo $this->escape($item->menutype)?>)
  112. <?php endif; ?>
  113. </p>
  114. </td>
  115. <td class="center btns">
  116. <a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=1');?>">
  117. <?php echo $item->count_published; ?></a>
  118. </td>
  119. <td class="center btns">
  120. <a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=0');?>">
  121. <?php echo $item->count_unpublished; ?></a>
  122. </td>
  123. <td class="center btns">
  124. <a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype.'&filter_published=-2');?>">
  125. <?php echo $item->count_trashed; ?></a>
  126. </td>
  127. <td class="left">
  128. <ul class="menu-module-list">
  129. <?php
  130. if (isset($this->modules[$item->menutype])) :
  131. foreach ($this->modules[$item->menutype] as &$module) :
  132. ?>
  133. <li>
  134. <?php if ($canEdit) : ?>
  135. <?php $link = JRoute::_('index.php?option=com_modules&task=module.edit&id='.$module->id.'&return='.$return.'&tmpl=component&layout=modal'); ?>
  136. <a href="#module<?php echo $module->id; ?>Modal" role="button" class="button" data-toggle="modal" title="<?php echo JText::_('COM_MENUS_EDIT_MODULE_SETTINGS');?>">
  137. <?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></a>
  138. <?php else : ?>
  139. <?php echo JText::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?>
  140. <?php endif; ?>
  141. </li>
  142. <?php endforeach; ?>
  143. </ul>
  144. <?php foreach ($this->modules[$item->menutype] as &$module) : ?>
  145. <?php if ($canEdit) : ?>
  146. <?php $link = JRoute::_('index.php?option=com_modules&task=module.edit&id='.$module->id.'&return='.$return.'&tmpl=component&layout=modal'); ?>
  147. <?php echo JHtml::_(
  148. 'bootstrap.renderModal',
  149. 'module' . $module->id . 'Modal',
  150. array(
  151. 'url' => $link,
  152. 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
  153. 'height' => '300px',
  154. 'width' => '800px',
  155. 'footer' => '<a class="btn" type="button" data-dismiss="modal" aria-hidden="true">'
  156. . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>'
  157. . '<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" onclick="jQuery(\'#module'
  158. . $module->id . 'Modal iframe\').contents().find(\'#saveBtn\').click();">'
  159. . JText::_('JSAVE') . '</button>',
  160. )
  161. ); ?>
  162. <?php endif; ?>
  163. <?php endforeach; ?>
  164. <?php elseif ($modMenuId) : ?>
  165. <?php $link = JRoute::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '&params[menutype]=' . $item->menutype); ?>
  166. <a href="<?php echo $link; ?>"><?php echo JText::_('COM_MENUS_ADD_MENU_MODULE'); ?></a>
  167. <?php echo JHtml::_(
  168. 'bootstrap.renderModal',
  169. 'moduleModal',
  170. array(
  171. 'url' => $link,
  172. 'title' => JText::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
  173. 'height' => '500px',
  174. 'width' => '800px',
  175. 'footer' => '<a class="btn" type="button" data-dismiss="modal" aria-hidden="true">'
  176. . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>',
  177. )
  178. ); ?>
  179. <?php endif; ?>
  180. </td>
  181. <td class="center">
  182. <?php echo $item->id; ?>
  183. </td>
  184. </tr>
  185. <?php endforeach; ?>
  186. </tbody>
  187. </table>
  188. <?php echo $this->pagination->getListFooter(); ?>
  189. <input type="hidden" name="task" value="" />
  190. <input type="hidden" name="boxchecked" value="0" />
  191. <input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
  192. <input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
  193. <?php echo JHtml::_('form.token'); ?>
  194. </div>
  195. </form>