[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_fields/tmpl/fields/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_fields
   6   *
   7   * @copyright   (C) 2016 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\Categories\Categories;
  14  use Joomla\CMS\Factory;
  15  use Joomla\CMS\HTML\HTMLHelper;
  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  use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
  22  
  23  /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
  24  $wa = $this->document->getWebAssetManager();
  25  $wa->useScript('table.columns')
  26      ->useScript('multiselect');
  27  
  28  $app       = Factory::getApplication();
  29  $user      = Factory::getUser();
  30  $userId    = $user->get('id');
  31  $context   = $this->escape($this->state->get('filter.context'));
  32  $component = $this->state->get('filter.component');
  33  $section   = $this->state->get('filter.section');
  34  $listOrder = $this->escape($this->state->get('list.ordering'));
  35  $listDirn  = $this->escape($this->state->get('list.direction'));
  36  $ordering  = ($listOrder == 'a.ordering');
  37  $saveOrder = ($listOrder == 'a.ordering' && strtolower($listDirn) == 'asc');
  38  
  39  // The category object of the component
  40  $category = Categories::getInstance(str_replace('com_', '', $component) . '.' . $section);
  41  
  42  // If there is no category for the component and section, then check the component only
  43  if (!$category) {
  44      $category = Categories::getInstance(str_replace('com_', '', $component));
  45  }
  46  
  47  if ($saveOrder && !empty($this->items)) {
  48      $saveOrderingUrl = 'index.php?option=com_fields&task=fields.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
  49      HTMLHelper::_('draggablelist.draggable');
  50  }
  51  
  52  $searchToolsOptions = [];
  53  
  54  // Only show field contexts filter if there are more than one option
  55  if (count($this->filterForm->getField('context')->options) > 1) {
  56      $searchToolsOptions['selectorFieldName'] = 'context';
  57  }
  58  ?>
  59  
  60  <form action="<?php echo Route::_('index.php?option=com_fields&view=fields&context=' . $this->state->get('filter.context')); ?>" method="post" name="adminForm" id="adminForm">
  61      <div class="row">
  62          <div class="col-md-12">
  63              <div id="j-main-container" class="j-main-container">
  64                  <?php echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this, 'options' => $searchToolsOptions)); ?>
  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="fieldList">
  72                          <caption class="visually-hidden">
  73                              <?php echo Text::_('COM_FIELDS_FIELDS_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 text-center d-none d-md-table-cell">
  83                                      <?php echo HTMLHelper::_('searchtools.sort', '', 'a.ordering', $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.state', $listDirn, $listOrder); ?>
  87                                  </th>
  88                                  <th scope="col">
  89                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
  90                                  </th>
  91                                  <th scope="col">
  92                                      <?php echo HTMLHelper::_('searchtools.sort', 'COM_FIELDS_FIELD_TYPE_LABEL', 'a.type', $listDirn, $listOrder); ?>
  93                                  </th>
  94                                  <th scope="col">
  95                                      <?php echo HTMLHelper::_('searchtools.sort', 'COM_FIELDS_FIELD_GROUP_LABEL', 'g.title', $listDirn, $listOrder); ?>
  96                                  </th>
  97                                  <th scope="col" class="w-10 d-none d-md-table-cell">
  98                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
  99                                  </th>
 100                                  <?php if (Multilanguage::isEnabled()) : ?>
 101                                      <th scope="col" class="w-10 d-none d-md-table-cell">
 102                                          <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
 103                                      </th>
 104                                  <?php endif; ?>
 105                                  <th scope="col" class="w-5 d-none d-md-table-cell">
 106                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
 107                                  </th>
 108                              </tr>
 109                          </thead>
 110                          <tbody <?php if ($saveOrder) :
 111                              ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true"<?php
 112                                 endif; ?>>
 113                              <?php foreach ($this->items as $i => $item) : ?>
 114                                  <?php $ordering   = ($listOrder == 'a.ordering'); ?>
 115                                  <?php $canEdit    = $user->authorise('core.edit', $component . '.field.' . $item->id); ?>
 116                                  <?php $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out); ?>
 117                                  <?php $canEditOwn = $user->authorise('core.edit.own', $component . '.field.' . $item->id) && $item->created_user_id == $userId; ?>
 118                                  <?php $canChange  = $user->authorise('core.edit.state', $component . '.field.' . $item->id) && $canCheckin; ?>
 119                                  <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->group_id; ?>" item-id="<?php echo $item->id; ?>">
 120                                      <td class="text-center">
 121                                          <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
 122                                      </td>
 123                                      <td class="text-center d-none d-md-table-cell">
 124                                          <?php $iconClass = ''; ?>
 125                                          <?php if (!$canChange) : ?>
 126                                              <?php $iconClass = ' inactive'; ?>
 127                                          <?php elseif (!$saveOrder) : ?>
 128                                              <?php $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED'); ?>
 129                                          <?php endif; ?>
 130                                          <span class="sortable-handler<?php echo $iconClass; ?>">
 131                                              <span class="icon-ellipsis-v" aria-hidden="true"></span>
 132                                          </span>
 133                                          <?php if ($canChange && $saveOrder) : ?>
 134                                              <input type="text" class="hidden" name="order[]" size="5" value="<?php echo $item->ordering; ?>">
 135                                          <?php endif; ?>
 136                                      </td>
 137                                      <td class="text-center">
 138                                          <?php echo HTMLHelper::_('jgrid.published', $item->state, $i, 'fields.', $canChange, 'cb'); ?>
 139                                      </td>
 140                                      <th scope="row">
 141                                          <div class="break-word">
 142                                              <?php if ($item->checked_out) : ?>
 143                                                  <?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'fields.', $canCheckin); ?>
 144                                              <?php endif; ?>
 145                                              <?php if ($canEdit || $canEditOwn) : ?>
 146                                                  <a href="<?php echo Route::_('index.php?option=com_fields&task=field.edit&id=' . $item->id . '&context=' . $context); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
 147                                                      <?php echo $this->escape($item->title); ?></a>
 148                                              <?php else : ?>
 149                                                  <?php echo $this->escape($item->title); ?>
 150                                              <?php endif; ?>
 151                                              <div class="small break-word">
 152                                                  <?php if (empty($item->note)) : ?>
 153                                                      <?php echo Text::sprintf('JGLOBAL_LIST_NAME', $this->escape($item->name)); ?>
 154                                                  <?php else : ?>
 155                                                      <?php echo Text::sprintf('JGLOBAL_LIST_NAME_NOTE', $this->escape($item->name), $this->escape($item->note)); ?>
 156                                                  <?php endif; ?>
 157                                              </div>
 158                                              <?php if ($item->only_use_in_subform) : ?>
 159                                                  <div class="small badge bg-secondary">
 160                                                      <?php echo Text::_('COM_FIELDS_FIELD_ONLY_USE_IN_SUBFORM_BADGE'); ?>
 161                                                  </div>
 162                                              <?php elseif ($category) : ?>
 163                                                  <div class="small">
 164                                                      <?php echo Text::_('JCATEGORY') . ': '; ?>
 165                                                      <?php $categories = FieldsHelper::getAssignedCategoriesTitles($item->id); ?>
 166                                                      <?php if ($categories) : ?>
 167                                                          <?php echo implode(', ', $categories); ?>
 168                                                      <?php else : ?>
 169                                                          <?php $category_ids = FieldsHelper::getAssignedCategoriesIds($item->id); ?>
 170                                                          <?php echo (in_array('-1', $category_ids)) ? Text::_('JNONE') : Text::_('JALL'); ?>
 171                                                      <?php endif; ?>
 172                                                  </div>
 173                                              <?php endif; ?>
 174                                          </div>
 175                                      </th>
 176                                      <td class="small">
 177                                          <?php echo $this->escape($item->type); ?>
 178                                      </td>
 179                                      <td>
 180                                          <?php echo $this->escape($item->group_title); ?>
 181                                      </td>
 182                                      <td class="small d-none d-md-table-cell">
 183                                          <?php echo $this->escape($item->access_level); ?>
 184                                      </td>
 185                                      <?php if (Multilanguage::isEnabled()) : ?>
 186                                          <td class="small d-none d-md-table-cell">
 187                                              <?php echo LayoutHelper::render('joomla.content.language', $item); ?>
 188                                          </td>
 189                                      <?php endif; ?>
 190                                      <td class="d-none d-md-table-cell">
 191                                          <span><?php echo (int) $item->id; ?></span>
 192                                      </td>
 193                                  </tr>
 194                              <?php endforeach; ?>
 195                          </tbody>
 196                      </table>
 197  
 198                      <?php // load the pagination. ?>
 199                      <?php echo $this->pagination->getListFooter(); ?>
 200  
 201                      <?php //Load the batch processing form. ?>
 202                      <?php if (
 203                      $user->authorise('core.create', $component)
 204                          && $user->authorise('core.edit', $component)
 205                          && $user->authorise('core.edit.state', $component)
 206  ) : ?>
 207                          <?php echo HTMLHelper::_(
 208                              'bootstrap.renderModal',
 209                              'collapseModal',
 210                              array(
 211                                      'title' => Text::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'),
 212                                      'footer' => $this->loadTemplate('batch_footer')
 213                                  ),
 214                              $this->loadTemplate('batch_body')
 215                          ); ?>
 216                      <?php endif; ?>
 217                  <?php endif; ?>
 218                  <input type="hidden" name="task" value="">
 219                  <input type="hidden" name="boxchecked" value="0">
 220                  <?php echo HTMLHelper::_('form.token'); ?>
 221              </div>
 222          </div>
 223      </div>
 224  </form>


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