[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/components/com_contact/tmpl/category/ -> default_items.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  com_contact
   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  use Joomla\Component\Contact\Administrator\Helper\ContactHelper;
  20  use Joomla\Component\Contact\Site\Helper\RouteHelper;
  21  
  22  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  23  $wa = $this->document->getWebAssetManager();
  24  $wa->useScript('com_contact.contacts-list')
  25      ->useScript('core');
  26  
  27  $canDo   = ContactHelper::getActions('com_contact', 'category', $this->category->id);
  28  $canEdit = $canDo->get('core.edit');
  29  $userId  = Factory::getUser()->id;
  30  
  31  $listOrder  = $this->escape($this->state->get('list.ordering'));
  32  $listDirn   = $this->escape($this->state->get('list.direction'));
  33  ?>
  34  <div class="com-contact-category__items">
  35      <form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm">
  36          <?php if ($this->params->get('filter_field')) : ?>
  37              <div class="com-contact-category__filter btn-group">
  38                  <label class="filter-search-lbl visually-hidden" for="filter-search">
  39                      <?php echo Text::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>
  40                  </label>
  41                  <input
  42                      type="text"
  43                      name="filter-search"
  44                      id="filter-search"
  45                      value="<?php echo $this->escape($this->state->get('list.filter')); ?>"
  46                      class="inputbox" onchange="document.adminForm.submit();"
  47                      placeholder="<?php echo Text::_('COM_CONTACT_FILTER_SEARCH_DESC'); ?>"
  48                  >
  49                  <button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('JGLOBAL_FILTER_BUTTON'); ?></button>
  50                  <button type="reset" name="filter-clear-button" class="btn btn-secondary"><?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?></button>
  51              </div>
  52          <?php endif; ?>
  53  
  54          <?php if ($this->params->get('show_pagination_limit')) : ?>
  55              <div class="com-contact-category__pagination btn-group float-end">
  56                  <label for="limit" class="visually-hidden">
  57                      <?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?>
  58                  </label>
  59                  <?php echo $this->pagination->getLimitBox(); ?>
  60              </div>
  61          <?php endif; ?>
  62  
  63          <?php if (empty($this->items)) : ?>
  64              <?php if ($this->params->get('show_no_contacts', 1)) : ?>
  65                  <div class="alert alert-info">
  66                      <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
  67                      <?php echo Text::_('COM_CONTACT_NO_CONTACTS'); ?>
  68                  </div>
  69              <?php endif; ?>
  70  
  71          <?php else : ?>
  72              <table class="com-content-category__table category table table-striped table-bordered table-hover" id="contactList">
  73                  <caption class="visually-hidden">
  74                      <?php echo Text::_('COM_CONTACT_TABLE_CAPTION'); ?>,
  75                  </caption>
  76                  <?php if ($this->params->get('show_headings')) : ?>
  77                      <thead>
  78                          <tr>
  79                              <th scope="col" id="categorylist_header_title">
  80                                  <?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_TITLE', 'a.name', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?>
  81                              </th>
  82                              <th scope="col">
  83                                  <?php echo Text::_('COM_CONTACT_CONTACT_DETAILS'); ?>
  84                              </th>
  85                              <?php if ($canEdit || ($canDo->get('core.edit.own') && $item->created_by === $userId)) : ?>
  86                                  <th scope="col">
  87                                      <?php echo Text::_('COM_CONTACT_EDIT_CONTACT'); ?>
  88                                  </th>
  89                              <?php endif; ?>
  90                          </tr>
  91                      </thead>
  92                  <?php endif; ?>
  93                  <tbody>
  94                      <?php foreach ($this->items as $i => $item) : ?>
  95                          <?php if ($this->items[$i]->published == 0) : ?>
  96                              <tr class="system-unpublished cat-list-row<?php echo $i % 2; ?>">
  97                          <?php else : ?>
  98                              <tr class="cat-list-row<?php echo $i % 2; ?>" >
  99                          <?php endif; ?>
 100                          <th scope="row" class="list-title">
 101                              <a href="<?php echo Route::_(RouteHelper::getContactRoute($item->slug, $item->catid, $item->language)); ?>">
 102                                  <?php if ($this->params->get('show_image_heading')) : ?>
 103                                      <?php if ($item->image) : ?>
 104                                          <?php echo LayoutHelper::render(
 105                                              'joomla.html.image',
 106                                              [
 107                                                  'src'   => $item->image,
 108                                                  'alt'   => '',
 109                                                  'class' => 'contact-thumbnail img-thumbnail',
 110                                              ]
 111                                          ); ?>
 112                                      <?php endif; ?>
 113                                  <?php endif; ?>
 114                                  <?php echo $this->escape($item->name); ?>
 115                              </a>
 116                              <?php if ($item->published == 0) : ?>
 117                                  <div>
 118                                      <span class="list-published badge bg-warning text-light">
 119                                          <?php echo Text::_('JUNPUBLISHED'); ?>
 120                                      </span>
 121                                  </div>
 122                              <?php endif; ?>
 123                              <?php if ($item->publish_up && strtotime($item->publish_up) > strtotime(Factory::getDate())) : ?>
 124                                  <div>
 125                                      <span class="list-published badge bg-warning text-light">
 126                                          <?php echo Text::_('JNOTPUBLISHEDYET'); ?>
 127                                      </span>
 128                                  </div>
 129                              <?php endif; ?>
 130                              <?php if (!is_null($item->publish_down) && strtotime($item->publish_down) < strtotime(Factory::getDate())) : ?>
 131                                  <div>
 132                                      <span class="list-published badge bg-warning text-light">
 133                                          <?php echo Text::_('JEXPIRED'); ?>
 134                                      </span>
 135                                  </div>
 136                              <?php endif; ?>
 137                              <?php if ($item->published == -2) : ?>
 138                                  <div>
 139                                      <span class="badge bg-warning text-light">
 140                                          <?php echo Text::_('JTRASHED'); ?>
 141                                      </span>
 142                                  </div>
 143                              <?php endif; ?>
 144  
 145                              <?php echo $item->event->afterDisplayTitle; ?>
 146                          </th>
 147                          <td>
 148                              <?php echo $item->event->beforeDisplayContent; ?>
 149  
 150                              <?php if ($this->params->get('show_telephone_headings') && !empty($item->telephone)) : ?>
 151                                  <?php echo Text::sprintf('COM_CONTACT_TELEPHONE_NUMBER', $item->telephone); ?><br>
 152                              <?php endif; ?>
 153  
 154                              <?php if ($this->params->get('show_mobile_headings') && !empty($item->mobile)) : ?>
 155                                  <?php echo Text::sprintf('COM_CONTACT_MOBILE_NUMBER', $item->mobile); ?><br>
 156                              <?php endif; ?>
 157  
 158                              <?php if ($this->params->get('show_fax_headings') && !empty($item->fax)) : ?>
 159                                  <?php echo Text::sprintf('COM_CONTACT_FAX_NUMBER', $item->fax); ?><br>
 160                              <?php endif; ?>
 161  
 162                              <?php if ($this->params->get('show_position_headings') && !empty($item->con_position)) : ?>
 163                                  <?php echo $item->con_position; ?><br>
 164                              <?php endif; ?>
 165  
 166                              <?php if ($this->params->get('show_email_headings') && !empty($item->email_to)) : ?>
 167                                  <?php echo $item->email_to; ?><br>
 168                              <?php endif; ?>
 169  
 170                              <?php $location = array(); ?>
 171                              <?php if ($this->params->get('show_suburb_headings') && !empty($item->suburb)) : ?>
 172                                  <?php $location[] = $item->suburb; ?>
 173                              <?php endif; ?>
 174  
 175                              <?php if ($this->params->get('show_state_headings') && !empty($item->state)) : ?>
 176                                  <?php $location[] = $item->state; ?>
 177                              <?php endif; ?>
 178  
 179                              <?php if ($this->params->get('show_country_headings') && !empty($item->country)) : ?>
 180                                  <?php $location[] = $item->country; ?>
 181                              <?php endif; ?>
 182                              <?php echo implode(', ', $location); ?>
 183  
 184                              <?php echo $item->event->afterDisplayContent; ?>
 185                          </td>
 186                          <?php if ($canEdit || ($canDo->get('core.edit.own') && $item->created_by === $userId)) : ?>
 187                              <td>
 188                                  <?php echo HTMLHelper::_('contacticon.edit', $item, $this->params); ?>
 189                              </td>
 190                          <?php endif; ?>
 191                      <?php endforeach; ?>
 192                  </tbody>
 193              </table>
 194          <?php endif; ?>
 195  
 196          <?php if ($canDo->get('core.create')) : ?>
 197              <?php echo HTMLHelper::_('contacticon.create', $this->category, $this->category->params); ?>
 198          <?php endif; ?>
 199  
 200          <?php if ($this->params->get('show_pagination', 2)) : ?>
 201              <div class="com-contact-category__pagination w-100">
 202                  <?php if ($this->params->def('show_pagination_results', 1)) : ?>
 203                      <p class="com-contact-category__counter counter float-end pt-3 pe-2">
 204                          <?php echo $this->pagination->getPagesCounter(); ?>
 205                      </p>
 206                  <?php endif; ?>
 207  
 208                  <?php echo $this->pagination->getPagesLinks(); ?>
 209              </div>
 210          <?php endif; ?>
 211          <div>
 212              <input type="hidden" name="filter_order" value="<?php echo $this->escape($this->state->get('list.ordering')); ?>">
 213              <input type="hidden" name="filter_order_Dir" value="<?php echo $this->escape($this->state->get('list.direction')); ?>">
 214          </div>
 215      </form>
 216  </div>


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