[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   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\Text;
  16  use Joomla\CMS\Router\Route;
  17  use Joomla\CMS\Uri\Uri;
  18  use Joomla\Component\Tags\Site\Helper\RouteHelper;
  19  
  20  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  21  $wa = $this->document->getWebAssetManager();
  22  $wa->useScript('com_tags.tags-default');
  23  
  24  // Get the user object.
  25  $user = Factory::getUser();
  26  
  27  // Check if user is allowed to add/edit based on tags permissions.
  28  $canEdit      = $user->authorise('core.edit', 'com_tags');
  29  $canCreate    = $user->authorise('core.create', 'com_tags');
  30  $canEditState = $user->authorise('core.edit.state', 'com_tags');
  31  
  32  $columns = $this->params->get('tag_columns', 1);
  33  
  34  // Avoid division by 0 and negative columns.
  35  if ($columns < 1) {
  36      $columns = 1;
  37  }
  38  
  39  $bsspans = floor(12 / $columns);
  40  
  41  if ($bsspans < 1) {
  42      $bsspans = 1;
  43  }
  44  
  45  $bscolumns = min($columns, floor(12 / $bsspans));
  46  $n         = count($this->items);
  47  ?>
  48  
  49  <div class="com-tags__items">
  50      <form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
  51          <?php if ($this->params->get('filter_field') || $this->params->get('show_pagination_limit')) : ?>
  52              <?php if ($this->params->get('filter_field')) : ?>
  53                  <div class="com-tags-tags__filter btn-group">
  54                      <label class="filter-search-lbl visually-hidden" for="filter-search">
  55                          <?php echo Text::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>
  56                      </label>
  57                      <input
  58                          type="text"
  59                          name="filter-search"
  60                          id="filter-search"
  61                          value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
  62                          class="inputbox" onchange="document.adminForm.submit();"
  63                          placeholder="<?php echo Text::_('COM_TAGS_TITLE_FILTER_LABEL'); ?>"
  64                      >
  65                      <button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('JGLOBAL_FILTER_BUTTON'); ?></button>
  66                      <button type="reset" name="filter-clear-button" class="btn btn-secondary"><?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?></button>
  67                  </div>
  68              <?php endif; ?>
  69              <?php if ($this->params->get('show_pagination_limit')) : ?>
  70                  <div class="btn-group float-end">
  71                      <label for="limit" class="visually-hidden">
  72                          <?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?>
  73                      </label>
  74                      <?php echo $this->pagination->getLimitBox(); ?>
  75                  </div>
  76              <?php endif; ?>
  77  
  78              <input type="hidden" name="limitstart" value="">
  79              <input type="hidden" name="task" value="">
  80          <?php endif; ?>
  81      </form>
  82  
  83      <?php if ($this->items == false || $n === 0) : ?>
  84          <div class="alert alert-info">
  85              <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
  86              <?php echo Text::_('COM_TAGS_NO_TAGS'); ?>
  87          </div>
  88      <?php else : ?>
  89          <?php foreach ($this->items as $i => $item) : ?>
  90              <?php if ($n === 1 || $i === 0 || $bscolumns === 1 || $i % $bscolumns === 0) : ?>
  91                  <ul class="com-tags__category category list-group">
  92              <?php endif; ?>
  93  
  94              <li class="list-group-item list-group-item-action">
  95                  <?php if ((!empty($item->access)) && in_array($item->access, $this->user->getAuthorisedViewLevels())) : ?>
  96                      <h3 class="mb-0">
  97                          <a href="<?php echo Route::_(RouteHelper::getComponentTagRoute($item->id . ':' . $item->alias, $item->language)); ?>">
  98                              <?php echo $this->escape($item->title); ?>
  99                          </a>
 100                      </h3>
 101                  <?php endif; ?>
 102  
 103                  <?php if ($this->params->get('all_tags_show_tag_image') && !empty($item->images)) : ?>
 104                      <?php $images = json_decode($item->images); ?>
 105                      <span class="tag-body">
 106                          <?php if (!empty($images->image_intro)) : ?>
 107                              <?php $imgfloat = empty($images->float_intro) ? $this->params->get('float_intro') : $images->float_intro; ?>
 108                              <div class="float-<?php echo htmlspecialchars($imgfloat, ENT_QUOTES, 'UTF-8'); ?> item-image">
 109                                  <?php $imageOptions = []; ?>
 110                                  <?php if ($images->image_intro_caption) : ?>
 111                                          <?php $imageOptions['title'] = $images->image_intro_caption; ?>
 112                                          <?php $imageOptions['class'] = 'caption'; ?>
 113                                  <?php endif; ?>
 114                                  <?php echo HTMLHelper::_('image', $images->image_intro, $images->image_intro_alt, $imageOptions); ?>
 115                              </div>
 116                          <?php endif; ?>
 117                      </span>
 118                  <?php endif; ?>
 119  
 120                  <?php if (($this->params->get('all_tags_show_tag_description', 1) && !empty($item->description)) || $this->params->get('all_tags_show_tag_hits')) : ?>
 121                      <div class="caption">
 122                          <?php if ($this->params->get('all_tags_show_tag_description', 1) && !empty($item->description)) : ?>
 123                              <span class="tag-body">
 124                                  <?php echo HTMLHelper::_('string.truncate', $item->description, $this->params->get('all_tags_tag_maximum_characters')); ?>
 125                              </span>
 126                          <?php endif; ?>
 127                          <?php if ($this->params->get('all_tags_show_tag_hits')) : ?>
 128                              <span class="list-hits badge bg-info">
 129                                  <?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $item->hits); ?>
 130                              </span>
 131                          <?php endif; ?>
 132                      </div>
 133                  <?php endif; ?>
 134              </li>
 135  
 136              <?php if (($i === 0 && $n === 1) || $i === $n - 1 || $bscolumns === 1 || (($i + 1) % $bscolumns === 0)) : ?>
 137                  </ul>
 138              <?php endif; ?>
 139  
 140          <?php endforeach; ?>
 141      <?php endif; ?>
 142  
 143      <?php // Add pagination links ?>
 144      <?php if (!empty($this->items)) : ?>
 145          <?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?>
 146              <div class="com-tags__pagination w-100">
 147                  <?php if ($this->params->def('show_pagination_results', 1)) : ?>
 148                      <p class="counter float-end pt-3 pe-2">
 149                          <?php echo $this->pagination->getPagesCounter(); ?>
 150                      </p>
 151                  <?php endif; ?>
 152                  <?php echo $this->pagination->getPagesLinks(); ?>
 153              </div>
 154          <?php endif; ?>
 155      <?php endif; ?>
 156  </div>


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