[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_categories/tmpl/categories/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_categories
   6   *
   7   * @copyright   (C) 2008 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\Multilanguage;
  16  use Joomla\CMS\Language\Text;
  17  use Joomla\CMS\Layout\LayoutHelper;
  18  use Joomla\CMS\Router\Route;
  19  use Joomla\CMS\Session\Session;
  20  use Joomla\String\Inflector;
  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  $userId    = $user->get('id');
  29  $extension = $this->escape($this->state->get('filter.extension'));
  30  $listOrder = $this->escape($this->state->get('list.ordering'));
  31  $listDirn  = $this->escape($this->state->get('list.direction'));
  32  $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc');
  33  $parts     = explode('.', $extension, 2);
  34  $component = $parts[0];
  35  $section   = null;
  36  
  37  if (count($parts) > 1) {
  38      $section = $parts[1];
  39  
  40      $inflector = Inflector::getInstance();
  41  
  42      if (!$inflector->isPlural($section)) {
  43          $section = $inflector->toPlural($section);
  44      }
  45  }
  46  
  47  if ($saveOrder && !empty($this->items)) {
  48      $saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
  49      HTMLHelper::_('draggablelist.draggable');
  50  }
  51  ?>
  52  <form action="<?php echo Route::_('index.php?option=com_categories&view=categories&extension=' . $this->state->get('filter.extension')); ?>" method="post" name="adminForm" id="adminForm">
  53      <div class="row">
  54          <div class="col-md-12">
  55              <div id="j-main-container" class="j-main-container">
  56                  <?php
  57                  // Search tools bar
  58                  echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this));
  59                  ?>
  60                  <?php if (empty($this->items)) : ?>
  61                      <div class="alert alert-info">
  62                          <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
  63                          <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
  64                      </div>
  65                  <?php else : ?>
  66                      <table class="table" id="categoryList">
  67                          <caption class="visually-hidden">
  68                              <?php echo Text::_('COM_CATEGORIES_TABLE_CAPTION'); ?>,
  69                              <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
  70                              <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
  71                          </caption>
  72                          <thead>
  73                              <tr>
  74                                  <td class="w-1 text-center">
  75                                      <?php echo HTMLHelper::_('grid.checkall'); ?>
  76                                  </td>
  77                                  <th scope="col" class="w-1 text-center d-none d-md-table-cell">
  78                                      <?php echo HTMLHelper::_('searchtools.sort', '', 'a.lft', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
  79                                  </th>
  80                                  <th scope="col" class="w-1 text-center">
  81                                      <?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
  82                                  </th>
  83                                  <th scope="col">
  84                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  85                                  </th>
  86                                  <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
  87                                      <th scope="col" class="w-3 text-center d-none d-md-table-cell">
  88                                          <span class="icon-check" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>"></span>
  89                                          <span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?></span>
  90                                      </th>
  91                                  <?php endif; ?>
  92                                  <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
  93                                      <th scope="col" class="w-3 text-center d-none d-md-table-cell">
  94                                          <span class="icon-times" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>"></span>
  95                                          <span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?></span>
  96                                      </th>
  97                                  <?php endif; ?>
  98                                  <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
  99                                      <th scope="col" class="w-3 text-center d-none d-md-table-cell">
 100                                          <span class="icon-folder icon-fw" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>"></span>
 101                                          <span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?></span>
 102                                      </th>
 103                                  <?php endif; ?>
 104                                  <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
 105                                      <th scope="col" class="w-3 text-center d-none d-md-table-cell">
 106                                          <span class="icon-trash" aria-hidden="true" title="<?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>"></span>
 107                                          <span class="visually-hidden"><?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?></span>
 108                                      </th>
 109                                  <?php endif; ?>
 110                                  <th scope="col" class="w-10 d-none d-md-table-cell">
 111                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'access_level', $listDirn, $listOrder); ?>
 112                                  </th>
 113                                  <?php if ($this->assoc) : ?>
 114                                      <th scope="col" class="w-10 d-none d-md-table-cell">
 115                                          <?php echo HTMLHelper::_('searchtools.sort', 'COM_CATEGORY_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
 116                                      </th>
 117                                  <?php endif; ?>
 118                                  <?php if (Multilanguage::isEnabled()) : ?>
 119                                      <th scope="col" class="w-10 d-none d-md-table-cell">
 120                                          <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language_title', $listDirn, $listOrder); ?>
 121                                      </th>
 122                                  <?php endif; ?>
 123                                  <th scope="col" class="w-5 d-none d-md-table-cell">
 124                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
 125                                  </th>
 126                              </tr>
 127                          </thead>
 128                          <tbody <?php if ($saveOrder) :
 129                              ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="false"<?php
 130                                 endif; ?>>
 131                              <?php foreach ($this->items as $i => $item) : ?>
 132                                  <?php
 133                                  $canEdit    = $user->authorise('core.edit', $extension . '.category.' . $item->id);
 134                                  $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
 135                                  $canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId;
 136                                  $canChange  = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin;
 137  
 138                                  // Get the parents of item for sorting
 139                                  if ($item->level > 1) {
 140                                      $parentsStr = '';
 141                                      $_currentParentId = $item->parent_id;
 142                                      $parentsStr = ' ' . $_currentParentId;
 143                                      for ($i2 = 0; $i2 < $item->level; $i2++) {
 144                                          foreach ($this->ordering as $k => $v) {
 145                                              $v = implode('-', $v);
 146                                              $v = '-' . $v . '-';
 147                                              if (strpos($v, '-' . $_currentParentId . '-') !== false) {
 148                                                  $parentsStr .= ' ' . $k;
 149                                                  $_currentParentId = $k;
 150                                                  break;
 151                                              }
 152                                          }
 153                                      }
 154                                  } else {
 155                                      $parentsStr = '';
 156                                  }
 157                                  ?>
 158                                  <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->parent_id; ?>"
 159                                      data-item-id="<?php echo $item->id ?>" data-parents="<?php echo $parentsStr ?>"
 160                                      data-level="<?php echo $item->level ?>">
 161                                      <td class="text-center">
 162                                          <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
 163                                      </td>
 164                                      <td class="text-center d-none d-md-table-cell">
 165                                          <?php
 166                                          $iconClass = '';
 167                                          if (!$canChange) {
 168                                              $iconClass = ' inactive';
 169                                          } elseif (!$saveOrder) {
 170                                              $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
 171                                          }
 172                                          ?>
 173                                          <span class="sortable-handler<?php echo $iconClass ?>">
 174                                              <span class="icon-ellipsis-v"></span>
 175                                          </span>
 176                                          <?php if ($canChange && $saveOrder) : ?>
 177                                              <input type="text" class="hidden" name="order[]" size="5" value="<?php echo $item->lft; ?>">
 178                                          <?php endif; ?>
 179                                      </td>
 180                                      <td class="text-center">
 181                                          <?php echo HTMLHelper::_('jgrid.published', $item->published, $i, 'categories.', $canChange); ?>
 182                                      </td>
 183                                      <th scope="row">
 184                                          <?php $prefix = LayoutHelper::render('joomla.html.treeprefix', array('level' => $item->level)); ?>
 185                                          <?php echo $prefix; ?>
 186                                          <?php if ($item->checked_out) : ?>
 187                                              <?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'categories.', $canCheckin); ?>
 188                                          <?php endif; ?>
 189                                          <?php if ($canEdit || $canEditOwn) : ?>
 190                                              <a href="<?php echo Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->id . '&extension=' . $extension); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
 191                                                  <?php echo $this->escape($item->title); ?></a>
 192                                          <?php else : ?>
 193                                              <?php echo $this->escape($item->title); ?>
 194                                          <?php endif; ?>
 195                                          <div>
 196                                          <?php echo $prefix; ?>
 197                                              <span class="small">
 198                                                  <?php if (empty($item->note)) : ?>
 199                                                      <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
 200                                                  <?php else : ?>
 201                                                      <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
 202                                                  <?php endif; ?>
 203                                              </span>
 204                                          </div>
 205                                      </th>
 206                                      <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_published')) : ?>
 207                                          <td class="text-center btns d-none d-md-table-cell itemnumber">
 208                                              <a class="btn <?php echo ($item->count_published > 0) ? 'btn-success' : 'btn-secondary'; ?>"
 209                                                  href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=1&filter[level]=1'); ?>"
 210                                                  aria-describedby="tip-publish<?php echo $i; ?>">
 211                                                  <?php echo $item->count_published; ?>
 212                                              </a>
 213                                              <div role="tooltip" id="tip-publish<?php echo $i; ?>">
 214                                                  <?php echo Text::_('COM_CATEGORY_COUNT_PUBLISHED_ITEMS'); ?>
 215                                              </div>
 216                                          </td>
 217                                      <?php endif; ?>
 218                                      <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_unpublished')) : ?>
 219                                          <td class="text-center btns d-none d-md-table-cell itemnumber">
 220                                              <a class="btn <?php echo ($item->count_unpublished > 0) ? 'btn-danger' : 'btn-secondary'; ?>"
 221                                                  href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=0&filter[level]=1'); ?>"
 222                                                  aria-describedby="tip-unpublish<?php echo $i; ?>">
 223                                                  <?php echo $item->count_unpublished; ?>
 224                                              </a>
 225                                              <div role="tooltip" id="tip-unpublish<?php echo $i; ?>">
 226                                                  <?php echo Text::_('COM_CATEGORY_COUNT_UNPUBLISHED_ITEMS'); ?>
 227                                              </div>
 228                                          </td>
 229                                      <?php endif; ?>
 230                                      <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_archived')) : ?>
 231                                          <td class="text-center btns d-none d-md-table-cell itemnumber">
 232                                              <a class="btn <?php echo ($item->count_archived > 0) ? 'btn-info' : 'btn-secondary'; ?>"
 233                                                  href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=2&filter[level]=1'); ?>"
 234                                                  aria-describedby="tip-archive<?php echo $i; ?>">
 235                                                  <?php echo $item->count_archived; ?>
 236                                              </a>
 237                                              <div role="tooltip" id="tip-archive<?php echo $i; ?>">
 238                                                  <?php echo Text::_('COM_CATEGORY_COUNT_ARCHIVED_ITEMS'); ?>
 239                                              </div>
 240                                          </td>
 241                                      <?php endif; ?>
 242                                      <?php if (isset($this->items[0]) && property_exists($this->items[0], 'count_trashed')) : ?>
 243                                          <td class="text-center btns d-none d-md-table-cell itemnumber">
 244                                              <a class="btn <?php echo ($item->count_trashed > 0) ? 'btn-dark' : 'btn-secondary'; ?>"
 245                                                  href="<?php echo Route::_('index.php?option=' . $component . ($section ? '&view=' . $section : '') . '&filter[category_id]=' . (int) $item->id . '&filter[published]=-2&filter[level]=1'); ?>"
 246                                                  aria-describedby="tip-trash<?php echo $i; ?>">
 247                                                  <?php echo $item->count_trashed; ?>
 248                                              </a>
 249                                              <div role="tooltip" id="tip-trash<?php echo $i; ?>">
 250                                                  <?php echo Text::_('COM_CATEGORY_COUNT_TRASHED_ITEMS'); ?>
 251                                              </div>
 252                                          </td>
 253                                      <?php endif; ?>
 254  
 255                                      <td class="small d-none d-md-table-cell">
 256                                          <?php echo $this->escape($item->access_level); ?>
 257                                      </td>
 258                                      <?php if ($this->assoc) : ?>
 259                                          <td class="d-none d-md-table-cell">
 260                                              <?php if ($item->association) : ?>
 261                                                  <?php echo HTMLHelper::_('categoriesadministrator.association', $item->id, $extension); ?>
 262                                              <?php endif; ?>
 263                                          </td>
 264                                      <?php endif; ?>
 265                                      <?php if (Multilanguage::isEnabled()) : ?>
 266                                          <td class="small d-none d-md-table-cell">
 267                                              <?php echo LayoutHelper::render('joomla.content.language', $item); ?>
 268                                          </td>
 269                                      <?php endif; ?>
 270                                      <td class="d-none d-md-table-cell">
 271                                          <?php echo (int) $item->id; ?>
 272                                      </td>
 273                                  </tr>
 274                              <?php endforeach; ?>
 275                          </tbody>
 276                      </table>
 277  
 278                      <?php // load the pagination. ?>
 279                      <?php echo $this->pagination->getListFooter(); ?>
 280  
 281                      <?php // Load the batch processing form. ?>
 282                      <?php if (
 283                      $user->authorise('core.create', $extension)
 284                          && $user->authorise('core.edit', $extension)
 285                          && $user->authorise('core.edit.state', $extension)
 286  ) : ?>
 287                          <?php echo HTMLHelper::_(
 288                              'bootstrap.renderModal',
 289                              'collapseModal',
 290                              array(
 291                                  'title'  => Text::_('COM_CATEGORIES_BATCH_OPTIONS'),
 292                                  'footer' => $this->loadTemplate('batch_footer'),
 293                              ),
 294                              $this->loadTemplate('batch_body')
 295                          ); ?>
 296                      <?php endif; ?>
 297                  <?php endif; ?>
 298  
 299                  <input type="hidden" name="extension" value="<?php echo $extension; ?>">
 300                  <input type="hidden" name="task" value="">
 301                  <input type="hidden" name="boxchecked" value="0">
 302                  <?php echo HTMLHelper::_('form.token'); ?>
 303              </div>
 304          </div>
 305      </div>
 306  </form>


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