[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_menus/tmpl/menus/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_menus
   6   *
   7   * @copyright   (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  defined('_JEXEC') or die;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\HTML\HTMLHelper;
  15  use Joomla\CMS\Language\Text;
  16  use Joomla\CMS\Layout\LayoutHelper;
  17  use Joomla\CMS\Router\Route;
  18  use Joomla\CMS\Uri\Uri;
  19  
  20  /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
  21  $wa = $this->document->getWebAssetManager();
  22  $wa->useScript('table.columns')
  23      ->useScript('multiselect')
  24      ->useScript('com_menus.admin-menus');
  25  
  26  $uri       = Uri::getInstance();
  27  $return    = base64_encode($uri);
  28  $user      = Factory::getUser();
  29  $listOrder = $this->escape($this->state->get('list.ordering'));
  30  $listDirn  = $this->escape($this->state->get('list.direction'));
  31  $modMenuId = (int) $this->get('ModMenuId');
  32  $itemIds   = [];
  33  
  34  foreach ($this->items as $item) {
  35      if ($user->authorise('core.edit', 'com_menus')) {
  36          $itemIds[] = $item->id;
  37      }
  38  }
  39  
  40  $this->document->addScriptOptions('menus-default', ['items' => $itemIds]);
  41  ?>
  42  <form action="<?php echo Route::_('index.php?option=com_menus&view=menus'); ?>" method="post" name="adminForm" id="adminForm">
  43      <div class="row">
  44          <div class="col-md-12">
  45              <div id="j-main-container" class="j-main-container">
  46                  <?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('filterButton' => false))); ?>
  47                  <?php if (empty($this->items)) : ?>
  48                      <div class="alert alert-info">
  49                          <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
  50                          <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
  51                      </div>
  52                  <?php else : ?>
  53                      <table class="table" id="menuList">
  54                          <caption class="visually-hidden">
  55                              <?php echo Text::_('COM_MENUS_MENUS_TABLE_CAPTION'); ?>,
  56                              <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
  57                              <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
  58                          </caption>
  59                          <thead>
  60                              <tr>
  61                                  <td class="w-1 text-center">
  62                                      <?php echo HTMLHelper::_('grid.checkall'); ?>
  63                                  </td>
  64                                  <th scope="col">
  65                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  66                                  </th>
  67                                  <th scope="col" class="w-5 text-center">
  68                                      <?php echo Text::_('COM_MENUS_MENUS'); ?>
  69                                  </th>
  70                                  <th scope="col" class="w-10 text-center  d-none d-md-table-cell">
  71                                      <span class="icon-check" aria-hidden="true"></span>
  72                                      <span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_PUBLISHED_ITEMS'); ?></span>
  73                                  </th>
  74                                  <th scope="col" class="w-10 text-center d-none d-md-table-cell">
  75                                      <span class="icon-times" aria-hidden="true"></span>
  76                                      <span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_UNPUBLISHED_ITEMS'); ?></span>
  77                                  </th>
  78                                  <th scope="col" class="w-10 text-center d-none d-md-table-cell">
  79                                      <span class="icon-trash" aria-hidden="true"></span>
  80                                      <span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_TRASHED_ITEMS'); ?></span>
  81                                  </th>
  82                                  <th scope="col" class="w-10 text-center d-none d-lg-table-cell">
  83                                      <span class="icon-cube" aria-hidden="true"></span>
  84                                      <span class="d-none d-md-inline"><?php echo Text::_('COM_MENUS_HEADING_LINKED_MODULES'); ?></span>
  85                                  </th>
  86                                  <th scope="col" class="w-5 d-none d-lg-table-cell text-center">
  87                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  88                                  </th>
  89                              </tr>
  90                          </thead>
  91                          <tbody>
  92                          <?php foreach ($this->items as $i => $item) :
  93                              $canEdit        = $user->authorise('core.edit', 'com_menus.menu.' . (int) $item->id);
  94                              $canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id);
  95                              ?>
  96                              <tr class="row<?php echo $i % 2; ?>">
  97                                  <td class="text-center">
  98                                      <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
  99                                  </td>
 100                                  <th scope="row">
 101                                      <div class="name break-word">
 102                                          <?php if ($canEdit) : ?>
 103                                              <a href="<?php echo Route::_('index.php?option=com_menus&task=menu.edit&id=' . $item->id); ?>">
 104                                                  <span class="visually-hidden"><?php echo Text::_('COM_MENUS_EDIT_MENU'); ?></span><?php echo $this->escape($item->title); ?>
 105                                              </a>
 106                                          <?php else : ?>
 107                                              <?php echo $this->escape($item->title); ?>
 108                                          <?php endif; ?>
 109                                          <?php if (!empty($item->description)) : ?>
 110                                              <div class="small">
 111                                                  (<?php echo $this->escape($item->description); ?>)
 112                                              </div>
 113                                          <?php endif; ?>
 114                                      </div>
 115                                  </th>
 116                                  <td class="text-center btns">
 117                                      <?php if ($canManageItems) : ?>
 118                                          <a href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype); ?>">
 119                                              <span class="icon-list" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('COM_MENUS_MENUS'); ?></span>
 120                                          </a>
 121                                      <?php endif; ?>
 122                                  </td>
 123                                  <td class="text-center btns d-none d-md-table-cell itemnumber">
 124                                      <?php if ($canManageItems) : ?>
 125                                          <a class="btn<?php echo ($item->count_published > 0) ? ' btn-success' : ' btn-secondary'; ?>"
 126                                              href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype . '&filter[published]=1'); ?>"
 127                                              aria-describedby="tip-publish<?php echo $i; ?>">
 128                                              <?php echo $item->count_published; ?>
 129                                          </a>
 130                                      <?php else : ?>
 131                                          <span class="btn<?php echo ($item->count_published > 0) ? ' btn-success' : ' btn-secondary'; ?>" tabindex="0"
 132                                              aria-describedby="tip-publish<?php echo $i; ?>">
 133                                              <?php echo $item->count_published; ?>
 134                                          </span>
 135                                      <?php endif; ?>
 136                                      <div role="tooltip" id="tip-publish<?php echo $i; ?>">
 137                                          <?php echo Text::_('COM_MENUS_COUNT_PUBLISHED_ITEMS'); ?>
 138                                      </div>
 139                                  </td>
 140                                  <td class="text-center btns d-none d-md-table-cell itemnumber">
 141                                      <?php if ($canManageItems) : ?>
 142                                          <a class="btn<?php echo ($item->count_unpublished > 0) ? ' btn-danger' : ' btn-secondary'; ?>"
 143                                              href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype . '&filter[published]=0'); ?>"
 144                                              aria-describedby="tip-unpublish<?php echo $i; ?>">
 145                                              <?php echo $item->count_unpublished; ?>
 146                                          </a>
 147                                      <?php else : ?>
 148                                          <span class="btn<?php echo ($item->count_unpublished > 0) ? ' btn-danger' : ' btn-secondary'; ?>" tabindex="0"
 149                                              aria-describedby="tip-unpublish<?php echo $i; ?>">
 150                                              <?php echo $item->count_unpublished; ?>
 151                                          </span>
 152                                      <?php endif; ?>
 153                                      <div role="tooltip" id="tip-unpublish<?php echo $i; ?>">
 154                                          <?php echo Text::_('COM_MENUS_COUNT_UNPUBLISHED_ITEMS'); ?>
 155                                      </div>
 156                                  </td>
 157                                  <td class="text-center btns d-none d-md-table-cell itemnumber">
 158                                      <?php if ($canManageItems) : ?>
 159                                          <a class="btn<?php echo ($item->count_trashed > 0) ? ' btn-danger' : ' btn-secondary'; ?>"
 160                                              href="<?php echo Route::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype . '&filter[published]=-2'); ?>"
 161                                              aria-describedby="tip-trash<?php echo $i; ?>">
 162                                              <?php echo $item->count_trashed; ?>
 163                                          </a>
 164                                      <?php else : ?>
 165                                          <span class="btn<?php echo ($item->count_trashed > 0) ? ' btn-danger' : ' btn-secondary'; ?>" tabindex="0"
 166                                              aria-describedby="tip-trash<?php echo $i; ?>">
 167                                              <?php echo $item->count_trashed; ?>
 168                                          </span>
 169                                      <?php endif; ?>
 170                                      <div role="tooltip" id="tip-trash<?php echo $i; ?>">
 171                                          <?php echo Text::_('COM_MENUS_COUNT_TRASHED_ITEMS'); ?>
 172                                      </div>
 173                                  </td>
 174                                  <td class="text-center d-none d-lg-table-cell itemnumber">
 175                                      <?php if (isset($this->modules[$item->menutype])) : ?>
 176                                          <div class="dropdown">
 177                                              <button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-bs-toggle="dropdown">
 178                                                  <?php echo Text::_('COM_MENUS_MODULES'); ?>
 179                                                  <span class="caret"></span>
 180                                              </button>
 181                                              <div class="dropdown-menu dropdown-menu-end">
 182                                                  <?php foreach ($this->modules[$item->menutype] as &$module) : ?>
 183                                                      <?php if ($user->authorise('core.edit', 'com_modules.module.' . (int) $module->id)) : ?>
 184                                                          <?php $link = Route::_('index.php?option=com_modules&task=module.edit&id=' . $module->id . '&return=' . $return . '&tmpl=component&layout=modal'); ?>
 185                                                          <button type="button" class="dropdown-item" data-bs-target="#moduleEdit<?php echo $module->id; ?>Modal" data-bs-toggle="modal" title="<?php echo Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'); ?>">
 186                                                              <?php echo Text::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></button>
 187                                                      <?php else : ?>
 188                                                          <span class="dropdown-item"><?php echo Text::sprintf('COM_MENUS_MODULE_ACCESS_POSITION', $this->escape($module->title), $this->escape($module->access_title), $this->escape($module->position)); ?></span>
 189                                                      <?php endif; ?>
 190                                                  <?php endforeach; ?>
 191                                              </div>
 192                                           </div>
 193                                          <?php foreach ($this->modules[$item->menutype] as &$module) : ?>
 194                                              <?php if ($user->authorise('core.edit', 'com_modules.module.' . (int) $module->id)) : ?>
 195                                                  <?php $link = Route::_('index.php?option=com_modules&task=module.edit&id=' . $module->id . '&return=' . $return . '&tmpl=component&layout=modal'); ?>
 196                                                  <?php echo HTMLHelper::_(
 197                                                      'bootstrap.renderModal',
 198                                                      'moduleEdit' . $module->id . 'Modal',
 199                                                      array(
 200                                                              'title'       => Text::_('COM_MENUS_EDIT_MODULE_SETTINGS'),
 201                                                              'backdrop'    => 'static',
 202                                                              'keyboard'    => false,
 203                                                              'closeButton' => false,
 204                                                              'url'         => $link,
 205                                                              'height'      => '400px',
 206                                                              'width'       => '800px',
 207                                                              'bodyHeight'  => 70,
 208                                                              'modalWidth'  => 80,
 209                                                              'footer'      => '<button type="button" class="btn btn-danger" data-bs-dismiss="modal"'
 210                                                                      . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleEdit' . $module->id . 'Modal\', buttonSelector: \'#closeBtn\'})">'
 211                                                                      . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
 212                                                                      . '<button type="button" class="btn btn-success"'
 213                                                                      . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleEdit' . $module->id . 'Modal\', buttonSelector: \'#saveBtn\'})">'
 214                                                                      . Text::_('JSAVE') . '</button>'
 215                                                                      . '<button type="button" class="btn btn-success"'
 216                                                                      . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleEdit' . $module->id . 'Modal\', buttonSelector: \'#applyBtn\'})">'
 217                                                                      . Text::_('JAPPLY') . '</button>',
 218                                                          )
 219                                                  ); ?>
 220                                              <?php endif; ?>
 221                                          <?php endforeach; ?>
 222                                      <?php elseif ($modMenuId) : ?>
 223                                          <?php $link = Route::_('index.php?option=com_modules&task=module.add&eid=' . $modMenuId . '&params[menutype]=' . $item->menutype . '&tmpl=component&layout=modal'); ?>
 224                                          <button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#moduleAddModal"><?php echo Text::_('COM_MENUS_ADD_MENU_MODULE'); ?></button>
 225                                          <?php echo HTMLHelper::_(
 226                                              'bootstrap.renderModal',
 227                                              'moduleAddModal',
 228                                              array(
 229                                                      'title'       => Text::_('COM_MENUS_ADD_MENU_MODULE'),
 230                                                      'backdrop'    => 'static',
 231                                                      'keyboard'    => false,
 232                                                      'closeButton' => false,
 233                                                      'url'         => $link,
 234                                                      'height'      => '400px',
 235                                                      'width'       => '800px',
 236                                                      'bodyHeight'  => 70,
 237                                                      'modalWidth'  => 80,
 238                                                      'footer'      => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"'
 239                                                              . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleAddModal\', buttonSelector: \'#closeBtn\'})">'
 240                                                              . Text::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
 241                                                              . '<button type="button" class="btn btn-primary"'
 242                                                              . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleAddModal\', buttonSelector: \'#saveBtn\'})">'
 243                                                              . Text::_('JSAVE') . '</button>'
 244                                                              . '<button type="button" class="btn btn-success"'
 245                                                              . ' onclick="Joomla.iframeButtonClick({iframeSelector: \'#moduleAddModal\', buttonSelector: \'#applyBtn\'})">'
 246                                                              . Text::_('JAPPLY') . '</button>',
 247                                                  )
 248                                          ); ?>
 249                                      <?php endif; ?>
 250                                  </td>
 251                                  <td class="d-none d-lg-table-cell">
 252                                      <?php echo $item->id; ?>
 253                                  </td>
 254                              </tr>
 255                          <?php endforeach; ?>
 256                          </tbody>
 257                      </table>
 258  
 259                      <?php // load the pagination. ?>
 260                      <?php echo $this->pagination->getListFooter(); ?>
 261  
 262                  <?php endif; ?>
 263  
 264                  <input type="hidden" name="task" value="">
 265                  <input type="hidden" name="boxchecked" value="0">
 266                  <?php echo HTMLHelper::_('form.token'); ?>
 267              </div>
 268          </div>
 269      </div>
 270  </form>


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer