[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_tags/tmpl/tags/ -> default.php (source)

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


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