[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_menus
   6   *
   7   * @copyright   (C) 2009 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\Associations;
  16  use Joomla\CMS\Language\Multilanguage;
  17  use Joomla\CMS\Language\Text;
  18  use Joomla\CMS\Layout\LayoutHelper;
  19  use Joomla\CMS\Router\Route;
  20  use Joomla\CMS\Session\Session;
  21  
  22  /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
  23  $wa = $this->document->getWebAssetManager();
  24  $wa->useScript('table.columns')
  25      ->useScript('multiselect');
  26  
  27  $user      = Factory::getUser();
  28  $app       = Factory::getApplication();
  29  $userId    = $user->get('id');
  30  $listOrder = $this->escape($this->state->get('list.ordering'));
  31  $listDirn  = $this->escape($this->state->get('list.direction'));
  32  $ordering  = ($listOrder == 'a.lft');
  33  $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
  34  $menuType  = (string) $app->getUserState('com_menus.items.menutype', '');
  35  
  36  if ($saveOrder && $menuType && !empty($this->items)) {
  37      $saveOrderingUrl = 'index.php?option=com_menus&task=items.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
  38      HTMLHelper::_('draggablelist.draggable');
  39  }
  40  
  41  $assoc   = Associations::isEnabled() && $this->state->get('filter.client_id') == 0;
  42  
  43  ?>
  44  <?php // Set up the filter bar. ?>
  45  <form action="<?php echo Route::_('index.php?option=com_menus&view=items&menutype='); ?>" method="post" name="adminForm"
  46        id="adminForm">
  47      <div class="row">
  48          <div class="col-md-12">
  49              <div id="j-main-container" class="j-main-container">
  50                  <?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => array('selectorFieldName' => 'menutype'))); ?>
  51                  <?php if (!empty($this->items)) : ?>
  52                      <table class="table" id="menuitemList">
  53                          <caption class="visually-hidden">
  54                              <?php echo Text::_('COM_MENUS_ITEMS_TABLE_CAPTION'); ?>,
  55                              <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
  56                              <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
  57                          </caption>
  58                          <thead>
  59                          <tr>
  60                              <td class="w-1 text-center">
  61                                  <?php echo HTMLHelper::_('grid.checkall'); ?>
  62                              </td>
  63                              <?php if ($menuType) : ?>
  64                                  <th scope="col" class="w-1 text-center d-none d-md-table-cell">
  65                                      <?php echo HTMLHelper::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
  66                                  </th>
  67                              <?php endif; ?>
  68                              <th scope="col" class="w-1 text-center">
  69                                  <?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
  70                              </th>
  71                              <th scope="col" class="title">
  72                                  <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  73                              </th>
  74                              <th scope="col" class="w-10 d-none d-md-table-cell">
  75                                  <?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_MENU', 'menutype_title', $listDirn, $listOrder); ?>
  76                              </th>
  77                              <?php if ($this->state->get('filter.client_id') == 0) : ?>
  78                                  <th scope="col" class="w-10 text-center d-none d-md-table-cell">
  79                                      <?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_HOME', 'a.home', $listDirn, $listOrder); ?>
  80                                  </th>
  81                              <?php endif; ?>
  82                              <?php if ($this->state->get('filter.client_id') == 0) : ?>
  83                                  <th scope="col" class="w-10 d-none d-md-table-cell">
  84                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
  85                                  </th>
  86                              <?php endif; ?>
  87                              <?php if ($assoc) : ?>
  88                                  <th scope="col" class="w-10 d-none d-md-table-cell">
  89                                      <?php echo HTMLHelper::_('searchtools.sort', 'COM_MENUS_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
  90                                  </th>
  91                              <?php endif; ?>
  92                              <?php if (($this->state->get('filter.client_id') == 0) && (Multilanguage::isEnabled())) : ?>
  93                                  <th scope="col" class="w-10 d-none d-md-table-cell">
  94                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
  95                                  </th>
  96                              <?php endif; ?>
  97                              <th scope="col" class="w-5 d-none d-md-table-cell">
  98                                  <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
  99                              </th>
 100                          </tr>
 101                          </thead>
 102                          <tbody <?php if ($saveOrder && $menuType) :
 103                              ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="false"<?php
 104                                 endif; ?>>
 105                          <?php
 106                          foreach ($this->items as $i => $item) :
 107                              $orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
 108                              $canCreate = $user->authorise('core.create', 'com_menus.menu.' . $item->menutype_id);
 109                              $canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $item->menutype_id);
 110                              $canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || is_null($item->checked_out);
 111                              $canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $item->menutype_id) && $canCheckin;
 112  
 113                              // Get the parents of item for sorting
 114                              if ($item->level > 1) {
 115                                  $parentsStr       = '';
 116                                  $_currentParentId = $item->parent_id;
 117                                  $parentsStr       = ' ' . $_currentParentId;
 118  
 119                                  for ($j = 0; $j < $item->level; $j++) {
 120                                      foreach ($this->ordering as $k => $v) {
 121                                          $v = implode('-', $v);
 122                                          $v = '-' . $v . '-';
 123  
 124                                          if (strpos($v, '-' . $_currentParentId . '-') !== false) {
 125                                              $parentsStr .= ' ' . $k;
 126                                              $_currentParentId = $k;
 127                                              break;
 128                                          }
 129                                      }
 130                                  }
 131                              } else {
 132                                  $parentsStr = '';
 133                              }
 134                              ?>
 135                              <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->parent_id; ?>"
 136                                  data-item-id="<?php echo $item->id; ?>" data-parents="<?php echo $parentsStr; ?>"
 137                                  data-level="<?php echo $item->level; ?>">
 138                                  <td class="text-center">
 139                                      <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
 140                                  </td>
 141                                  <?php if ($menuType) : ?>
 142                                      <td class="text-center d-none d-md-table-cell">
 143                                          <?php
 144                                          $iconClass = '';
 145  
 146                                          if (!$canChange) {
 147                                              $iconClass = ' inactive';
 148                                          } elseif (!$saveOrder) {
 149                                              $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
 150                                          }
 151                                          ?>
 152                                          <span class="sortable-handler<?php echo $iconClass ?>">
 153                                              <span class="icon-ellipsis-v" aria-hidden="true"></span>
 154                                          </span>
 155                                          <?php if ($canChange && $saveOrder) : ?>
 156                                              <input type="text" class="hidden" name="order[]" size="5"
 157                                                     value="<?php echo $orderkey + 1; ?>">
 158                                          <?php endif; ?>
 159                                      </td>
 160                                  <?php endif; ?>
 161                                  <td class="text-center">
 162                                      <?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'items.', $canChange, 'cb', $item->publish_up, $item->publish_down); ?>
 163                                  </td>
 164                                  <th scope="row">
 165                                      <?php $prefix = LayoutHelper::render('joomla.html.treeprefix', array('level' => $item->level)); ?>
 166                                      <?php echo $prefix; ?>
 167                                      <?php if ($item->checked_out) : ?>
 168                                          <?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'items.', $canCheckin); ?>
 169                                      <?php endif; ?>
 170                                      <?php if ($canEdit && !$item->protected) : ?>
 171                                          <a href="<?php echo Route::_('index.php?option=com_menus&task=item.edit&id=' . (int) $item->id); ?>"
 172                                             title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
 173                                              <?php echo $this->escape($item->title); ?></a>
 174                                      <?php else : ?>
 175                                          <?php echo $this->escape($item->title); ?>
 176                                      <?php endif; ?>
 177                                      <?php echo HTMLHelper::_('menus.visibility', $item->params); ?>
 178                                      <div>
 179                                          <?php echo $prefix; ?>
 180                                          <span class="small">
 181                                              <?php if ($item->type != 'url') : ?>
 182                                                  <?php if (empty($item->note)) : ?>
 183                                                      <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
 184                                                  <?php else : ?>
 185                                                      <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
 186                                                  <?php endif; ?>
 187                                              <?php elseif ($item->type == 'url' && $item->note) : ?>
 188                                                  <?php echo Text::sprintf('JGLOBAL_LIST_NOTE', $this->escape($item->note)); ?>
 189                                              <?php endif; ?>
 190                                          </span>
 191                                      </div>
 192                                      <div title="<?php echo $this->escape($item->path); ?>">
 193                                          <?php echo $prefix; ?>
 194                                          <span class="small"
 195                                                title="<?php echo isset($item->item_type_desc) ? htmlspecialchars($this->escape($item->item_type_desc), ENT_COMPAT, 'UTF-8') : ''; ?>">
 196                                              <?php echo $this->escape($item->item_type); ?>
 197                                          </span>
 198                                      </div>
 199                                      <?php if ($item->type === 'component' && !$item->enabled) : ?>
 200                                          <div>
 201                                              <span class="badge bg-secondary">
 202                                                  <?php echo Text::_($item->enabled === null ? 'JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND' : 'COM_MENUS_LABEL_DISABLED'); ?>
 203                                              </span>
 204                                          </div>
 205                                      <?php endif; ?>
 206                                  </th>
 207                                  <td class="small d-none d-md-table-cell">
 208                                      <?php echo $this->escape($item->menutype_title ?: ucwords($item->menutype)); ?>
 209                                  </td>
 210                                  <?php if ($this->state->get('filter.client_id') == 0) : ?>
 211                                      <td class="text-center d-none d-md-table-cell">
 212                                          <?php if ($item->type == 'component') : ?>
 213                                              <?php if ($item->language == '*' || $item->home == '0') : ?>
 214                                                  <?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected, 'cb', null, 'icon-home', 'icon-circle'); ?>
 215                                              <?php elseif ($canChange) : ?>
 216                                                  <a href="<?php echo Route::_('index.php?option=com_menus&task=items.unsetDefault&cid[]=' . $item->id . '&' . Session::getFormToken() . '=1'); ?>">
 217                                                      <?php if ($item->language_image) : ?>
 218                                                          <?php echo HTMLHelper::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => Text::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title)), true); ?>
 219                                                      <?php else : ?>
 220                                                          <span class="badge bg-secondary"
 221                                                                title="<?php echo Text::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title); ?>"><?php echo $item->language; ?></span>
 222                                                      <?php endif; ?>
 223                                                  </a>
 224                                              <?php else : ?>
 225                                                  <?php if ($item->language_image) : ?>
 226                                                      <?php echo HTMLHelper::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true); ?>
 227                                                  <?php else : ?>
 228                                                      <span class="badge bg-secondary"
 229                                                            title="<?php echo $item->language_title; ?>"><?php echo $item->language; ?></span>
 230                                                  <?php endif; ?>
 231                                              <?php endif; ?>
 232                                          <?php endif; ?>
 233                                      </td>
 234                                  <?php endif; ?>
 235                                  <?php if ($this->state->get('filter.client_id') == 0) : ?>
 236                                      <td class="small d-none d-md-table-cell">
 237                                          <?php echo $this->escape($item->access_level); ?>
 238                                      </td>
 239                                  <?php endif; ?>
 240                                  <?php if ($assoc) : ?>
 241                                      <td class="small d-none d-md-table-cell">
 242                                          <?php if ($item->association) : ?>
 243                                              <?php echo HTMLHelper::_('menus.association', $item->id); ?>
 244                                          <?php endif; ?>
 245                                      </td>
 246                                  <?php endif; ?>
 247                                  <?php if ($this->state->get('filter.client_id') == 0 && Multilanguage::isEnabled()) : ?>
 248                                      <td class="small d-none d-md-table-cell">
 249                                          <?php echo LayoutHelper::render('joomla.content.language', $item); ?>
 250                                      </td>
 251                                  <?php endif; ?>
 252                                  <td class="d-none d-md-table-cell">
 253                                      <?php echo (int) $item->id; ?>
 254                                  </td>
 255                              </tr>
 256                          <?php endforeach; ?>
 257                          </tbody>
 258                      </table>
 259  
 260                      <?php // load the pagination. ?>
 261                      <?php echo $this->pagination->getListFooter(); ?>
 262  
 263                      <?php // Load the batch processing form if user is allowed ?>
 264                      <?php if ($user->authorise('core.create', 'com_menus') || $user->authorise('core.edit', 'com_menus')) : ?>
 265                          <?php echo HTMLHelper::_(
 266                              'bootstrap.renderModal',
 267                              'collapseModal',
 268                              array(
 269                                  'title'  => Text::_('COM_MENUS_BATCH_OPTIONS'),
 270                                  'footer' => $this->loadTemplate('batch_footer')
 271                              ),
 272                              $this->loadTemplate('batch_body')
 273                          ); ?>
 274                      <?php endif; ?>
 275                  <?php endif; ?>
 276  
 277                  <input type="hidden" name="task" value="">
 278                  <input type="hidden" name="boxchecked" value="0">
 279                  <?php echo HTMLHelper::_('form.token'); ?>
 280              </div>
 281          </div>
 282      </div>
 283  </form>


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