[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_content/tmpl/articles/ -> default.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  com_content
   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\Button\FeaturedButton;
  14  use Joomla\CMS\Button\PublishedButton;
  15  use Joomla\CMS\Button\TransitionButton;
  16  use Joomla\CMS\Component\ComponentHelper;
  17  use Joomla\CMS\Factory;
  18  use Joomla\CMS\HTML\HTMLHelper;
  19  use Joomla\CMS\Language\Associations;
  20  use Joomla\CMS\Language\Multilanguage;
  21  use Joomla\CMS\Language\Text;
  22  use Joomla\CMS\Layout\LayoutHelper;
  23  use Joomla\CMS\Router\Route;
  24  use Joomla\CMS\Session\Session;
  25  use Joomla\Component\Content\Administrator\Helper\ContentHelper;
  26  use Joomla\Utilities\ArrayHelper;
  27  
  28  /** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
  29  $wa = $this->document->getWebAssetManager();
  30  $wa->useScript('table.columns')
  31      ->useScript('multiselect');
  32  
  33  $app       = Factory::getApplication();
  34  $user      = Factory::getUser();
  35  $userId    = $user->get('id');
  36  $listOrder = $this->escape($this->state->get('list.ordering'));
  37  $listDirn  = $this->escape($this->state->get('list.direction'));
  38  $saveOrder = $listOrder == 'a.ordering';
  39  
  40  if (strpos($listOrder, 'publish_up') !== false) {
  41      $orderingColumn = 'publish_up';
  42  } elseif (strpos($listOrder, 'publish_down') !== false) {
  43      $orderingColumn = 'publish_down';
  44  } elseif (strpos($listOrder, 'modified') !== false) {
  45      $orderingColumn = 'modified';
  46  } else {
  47      $orderingColumn = 'created';
  48  }
  49  
  50  if ($saveOrder && !empty($this->items)) {
  51      $saveOrderingUrl = 'index.php?option=com_content&task=articles.saveOrderAjax&tmpl=component&' . Session::getFormToken() . '=1';
  52      HTMLHelper::_('draggablelist.draggable');
  53  }
  54  
  55  $workflow_enabled  = ComponentHelper::getParams('com_content')->get('workflow_enabled');
  56  $workflow_state    = false;
  57  $workflow_featured = false;
  58  
  59  if ($workflow_enabled) :
  60      $wa->getRegistry()->addExtensionRegistryFile('com_workflow');
  61      $wa->useScript('com_workflow.admin-items-workflow-buttons')
  62      ->useScript('com_content.articles-status');
  63  
  64      $workflow_state    = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.state', 'com_content.article');
  65      $workflow_featured = Factory::getApplication()->bootComponent('com_content')->isFunctionalityUsed('core.featured', 'com_content.article');
  66  endif;
  67  
  68  $assoc = Associations::isEnabled();
  69  ?>
  70  
  71  <form action="<?php echo Route::_('index.php?option=com_content&view=articles'); ?>" method="post" name="adminForm" id="adminForm">
  72      <div class="row">
  73          <div class="col-md-12">
  74              <div id="j-main-container" class="j-main-container">
  75                  <?php
  76                  // Search tools bar
  77                  echo LayoutHelper::render('joomla.searchtools.default', array('view' => $this));
  78                  ?>
  79                  <?php if (empty($this->items)) : ?>
  80                      <div class="alert alert-info">
  81                          <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
  82                          <?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
  83                      </div>
  84                  <?php else : ?>
  85                      <table class="table itemList" id="articleList">
  86                          <caption class="visually-hidden">
  87                              <?php echo Text::_('COM_CONTENT_ARTICLES_TABLE_CAPTION'); ?>,
  88                              <span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
  89                              <span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
  90                          </caption>
  91                          <thead>
  92                              <tr>
  93                                  <td class="w-1 text-center">
  94                                      <?php echo HTMLHelper::_('grid.checkall'); ?>
  95                                  </td>
  96                                  <th scope="col" class="w-1 text-center d-none d-md-table-cell">
  97                                      <?php echo HTMLHelper::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-sort'); ?>
  98                                  </th>
  99                                  <?php if ($workflow_enabled) : ?>
 100                                  <th scope="col" class="w-1 text-center">
 101                                      <?php echo HTMLHelper::_('searchtools.sort', 'JSTAGE', 'ws.title', $listDirn, $listOrder); ?>
 102                                  </th>
 103                                  <?php endif; ?>
 104                                  <th scope="col" class="w-1 text-center d-none d-md-table-cell">
 105                                      <?php echo HTMLHelper::_('searchtools.sort', 'JFEATURED', 'a.featured', $listDirn, $listOrder); ?>
 106                                  </th>
 107                                  <th scope="col" class="w-1 text-center">
 108                                      <?php echo HTMLHelper::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
 109                                  </th>
 110                                  <th scope="col" style="min-width:100px">
 111                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
 112                                  </th>
 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                                  <th scope="col" class="w-10 d-none d-md-table-cell">
 117                                      <?php echo HTMLHelper::_('searchtools.sort', 'JAUTHOR', 'a.created_by', $listDirn, $listOrder); ?>
 118                                  </th>
 119                                  <?php if ($assoc) : ?>
 120                                      <th scope="col" class="w-5 d-none d-md-table-cell">
 121                                          <?php echo HTMLHelper::_('searchtools.sort', 'COM_CONTENT_HEADING_ASSOCIATION', 'association', $listDirn, $listOrder); ?>
 122                                      </th>
 123                                  <?php endif; ?>
 124                                  <?php if (Multilanguage::isEnabled()) : ?>
 125                                      <th scope="col" class="w-10 d-none d-md-table-cell">
 126                                          <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'language', $listDirn, $listOrder); ?>
 127                                      </th>
 128                                  <?php endif; ?>
 129                                  <th scope="col" class="w-10 d-none d-md-table-cell text-center">
 130                                      <?php echo HTMLHelper::_('searchtools.sort', 'COM_CONTENT_HEADING_DATE_' . strtoupper($orderingColumn), 'a.' . $orderingColumn, $listDirn, $listOrder); ?>
 131                                  </th>
 132                                  <?php if ($this->hits) : ?>
 133                                      <th scope="col" class="w-3 d-none d-lg-table-cell text-center">
 134                                          <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
 135                                      </th>
 136                                  <?php endif; ?>
 137                                  <?php if ($this->vote) : ?>
 138                                      <th scope="col" class="w-3 d-none d-md-table-cell text-center">
 139                                          <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_VOTES', 'rating_count', $listDirn, $listOrder); ?>
 140                                      </th>
 141                                      <th scope="col" class="w-3 d-none d-md-table-cell text-center">
 142                                          <?php echo HTMLHelper::_('searchtools.sort', 'JGLOBAL_RATINGS', 'rating', $listDirn, $listOrder); ?>
 143                                      </th>
 144                                  <?php endif; ?>
 145                                  <th scope="col" class="w-3 d-none d-lg-table-cell">
 146                                      <?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
 147                                  </th>
 148                              </tr>
 149                          </thead>
 150                          <tbody<?php if ($saveOrder) :
 151                              ?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true"<?php
 152                                endif; ?>>
 153                          <?php foreach ($this->items as $i => $item) :
 154                              $item->max_ordering = 0;
 155                              $canEdit          = $user->authorise('core.edit', 'com_content.article.' . $item->id);
 156                              $canCheckin       = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
 157                              $canEditOwn       = $user->authorise('core.edit.own', 'com_content.article.' . $item->id) && $item->created_by == $userId;
 158                              $canChange        = $user->authorise('core.edit.state', 'com_content.article.' . $item->id) && $canCheckin;
 159                              $canEditCat       = $user->authorise('core.edit', 'com_content.category.' . $item->catid);
 160                              $canEditOwnCat    = $user->authorise('core.edit.own', 'com_content.category.' . $item->catid) && $item->category_uid == $userId;
 161                              $canEditParCat    = $user->authorise('core.edit', 'com_content.category.' . $item->parent_category_id);
 162                              $canEditOwnParCat = $user->authorise('core.edit.own', 'com_content.category.' . $item->parent_category_id) && $item->parent_category_uid == $userId;
 163  
 164                              $transitions = ContentHelper::filterTransitions($this->transitions, (int) $item->stage_id, (int) $item->workflow_id);
 165  
 166                              $transition_ids = ArrayHelper::getColumn($transitions, 'value');
 167                              $transition_ids = ArrayHelper::toInteger($transition_ids);
 168  
 169                              ?>
 170                              <tr class="row<?php echo $i % 2; ?>" data-draggable-group="<?php echo $item->catid; ?>"
 171                                  data-transitions="<?php echo implode(',', $transition_ids); ?>"
 172                              >
 173                                  <td class="text-center">
 174                                      <?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->title); ?>
 175                                  </td>
 176                                  <td class="text-center d-none d-md-table-cell">
 177                                      <?php
 178                                      $iconClass = '';
 179                                      if (!$canChange) {
 180                                          $iconClass = ' inactive';
 181                                      } elseif (!$saveOrder) {
 182                                          $iconClass = ' inactive" title="' . Text::_('JORDERINGDISABLED');
 183                                      }
 184                                      ?>
 185                                      <span class="sortable-handler<?php echo $iconClass ?>">
 186                                          <span class="icon-ellipsis-v" aria-hidden="true"></span>
 187                                      </span>
 188                                      <?php if ($canChange && $saveOrder) : ?>
 189                                          <input type="text" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order hidden">
 190                                      <?php endif; ?>
 191                                  </td>
 192                                  <?php if ($workflow_enabled) : ?>
 193                                  <td class="article-stage text-center">
 194                                      <?php
 195                                      $options = [
 196                                      'transitions' => $transitions,
 197                                      'title' => Text::_($item->stage_title),
 198                                      'tip_content' => Text::sprintf('JWORKFLOW', Text::_($item->workflow_title)),
 199                                      'id' => 'workflow-' . $item->id,
 200                                      'task' => 'articles.runTransition'
 201                                      ];
 202  
 203                                      echo (new TransitionButton($options))
 204                                      ->render(0, $i);
 205                                      ?>
 206                                      <div class="small">
 207                                          <?php echo Text::_($item->stage_title); ?>
 208                                      </div>
 209                                  </td>
 210                                  <?php endif; ?>
 211                                  <td class="text-center d-none d-md-table-cell">
 212                                  <?php
 213                                      $options = [
 214                                          'task_prefix' => 'articles.',
 215                                          'disabled' => $workflow_featured || !$canChange,
 216                                          'id' => 'featured-' . $item->id
 217                                      ];
 218  
 219                                      echo (new FeaturedButton())
 220                                          ->render((int) $item->featured, $i, $options, $item->featured_up, $item->featured_down);
 221                                      ?>
 222                                  </td>
 223                                  <td class="article-status text-center">
 224                                  <?php
 225                                      $options = [
 226                                          'task_prefix' => 'articles.',
 227                                          'disabled' => $workflow_state || !$canChange,
 228                                          'id' => 'state-' . $item->id,
 229                                          'category_published' => $item->category_published
 230                                      ];
 231  
 232                                      echo (new PublishedButton())->render((int) $item->state, $i, $options, $item->publish_up, $item->publish_down);
 233                                      ?>
 234                                  </td>
 235                                  <th scope="row" class="has-context">
 236                                      <div class="break-word">
 237                                          <?php if ($item->checked_out) : ?>
 238                                              <?php echo HTMLHelper::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'articles.', $canCheckin); ?>
 239                                          <?php endif; ?>
 240                                          <?php if ($canEdit || $canEditOwn) : ?>
 241                                              <a href="<?php echo Route::_('index.php?option=com_content&task=article.edit&id=' . $item->id); ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo $this->escape($item->title); ?>">
 242                                                  <?php echo $this->escape($item->title); ?></a>
 243                                          <?php else : ?>
 244                                              <span title="<?php echo Text::sprintf('JFIELD_ALIAS_LABEL', $this->escape($item->alias)); ?>"><?php echo $this->escape($item->title); ?></span>
 245                                          <?php endif; ?>
 246                                          <div class="small break-word">
 247                                              <?php if (empty($item->note)) : ?>
 248                                                  <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
 249                                              <?php else : ?>
 250                                                  <?php echo Text::sprintf('JGLOBAL_LIST_ALIAS_NOTE', $this->escape($item->alias), $this->escape($item->note)); ?>
 251                                              <?php endif; ?>
 252                                          </div>
 253                                          <div class="small">
 254                                              <?php
 255                                              $ParentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->parent_category_id . '&extension=com_content');
 256                                              $CurrentCatUrl = Route::_('index.php?option=com_categories&task=category.edit&id=' . $item->catid . '&extension=com_content');
 257                                              $EditCatTxt = Text::_('COM_CONTENT_EDIT_CATEGORY');
 258                                              echo Text::_('JCATEGORY') . ': ';
 259                                              if ($item->category_level != '1') :
 260                                                  if ($item->parent_category_level != '1') :
 261                                                      echo ' &#187; ';
 262                                                  endif;
 263                                              endif;
 264                                              if (Factory::getLanguage()->isRtl()) {
 265                                                  if ($canEditCat || $canEditOwnCat) :
 266                                                      echo '<a href="' . $CurrentCatUrl . '" title="' . $EditCatTxt . '">';
 267                                                  endif;
 268                                                  echo $this->escape($item->category_title);
 269                                                  if ($canEditCat || $canEditOwnCat) :
 270                                                      echo '</a>';
 271                                                  endif;
 272                                                  if ($item->category_level != '1') :
 273                                                      echo ' &#171; ';
 274                                                      if ($canEditParCat || $canEditOwnParCat) :
 275                                                          echo '<a href="' . $ParentCatUrl . '" title="' . $EditCatTxt . '">';
 276                                                      endif;
 277                                                      echo $this->escape($item->parent_category_title);
 278                                                      if ($canEditParCat || $canEditOwnParCat) :
 279                                                          echo '</a>';
 280                                                      endif;
 281                                                  endif;
 282                                              } else {
 283                                                  if ($item->category_level != '1') :
 284                                                      if ($canEditParCat || $canEditOwnParCat) :
 285                                                          echo '<a href="' . $ParentCatUrl . '" title="' . $EditCatTxt . '">';
 286                                                      endif;
 287                                                      echo $this->escape($item->parent_category_title);
 288                                                      if ($canEditParCat || $canEditOwnParCat) :
 289                                                          echo '</a>';
 290                                                      endif;
 291                                                      echo ' &#187; ';
 292                                                  endif;
 293                                                  if ($canEditCat || $canEditOwnCat) :
 294                                                      echo '<a href="' . $CurrentCatUrl . '" title="' . $EditCatTxt . '">';
 295                                                  endif;
 296                                                  echo $this->escape($item->category_title);
 297                                                  if ($canEditCat || $canEditOwnCat) :
 298                                                      echo '</a>';
 299                                                  endif;
 300                                              }
 301                                              if ($item->category_published < '1') :
 302                                                  echo $item->category_published == '0' ? ' (' . Text::_('JUNPUBLISHED') . ')' : ' (' . Text::_('JTRASHED') . ')';
 303                                              endif;
 304                                              ?>
 305                                          </div>
 306                                      </div>
 307                                  </th>
 308                                  <td class="small d-none d-md-table-cell">
 309                                      <?php echo $this->escape($item->access_level); ?>
 310                                  </td>
 311                                  <td class="small d-none d-md-table-cell">
 312                                      <?php if ((int) $item->created_by != 0) : ?>
 313                                          <a href="<?php echo Route::_('index.php?option=com_users&task=user.edit&id=' . (int) $item->created_by); ?>">
 314                                              <?php echo $this->escape($item->author_name); ?>
 315                                          </a>
 316                                      <?php else : ?>
 317                                          <?php echo Text::_('JNONE'); ?>
 318                                      <?php endif; ?>
 319                                      <?php if ($item->created_by_alias) : ?>
 320                                          <div class="smallsub"><?php echo Text::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->created_by_alias)); ?></div>
 321                                      <?php endif; ?>
 322                                  </td>
 323                                  <?php if ($assoc) : ?>
 324                                      <td class="d-none d-md-table-cell">
 325                                          <?php if ($item->association) : ?>
 326                                              <?php echo HTMLHelper::_('contentadministrator.association', $item->id); ?>
 327                                          <?php endif; ?>
 328                                      </td>
 329                                  <?php endif; ?>
 330                                  <?php if (Multilanguage::isEnabled()) : ?>
 331                                      <td class="small d-none d-md-table-cell">
 332                                          <?php echo LayoutHelper::render('joomla.content.language', $item); ?>
 333                                      </td>
 334                                  <?php endif; ?>
 335                                  <td class="small d-none d-md-table-cell text-center">
 336                                      <?php
 337                                      $date = $item->{$orderingColumn};
 338                                      echo $date > 0 ? HTMLHelper::_('date', $date, Text::_('DATE_FORMAT_LC4')) : '-';
 339                                      ?>
 340                                  </td>
 341                                  <?php if ($this->hits) : ?>
 342                                      <td class="d-none d-lg-table-cell text-center">
 343                                          <span class="badge bg-info">
 344                                              <?php echo (int) $item->hits; ?>
 345                                          </span>
 346                                      </td>
 347                                  <?php endif; ?>
 348                                  <?php if ($this->vote) : ?>
 349                                      <td class="d-none d-md-table-cell text-center">
 350                                          <span class="badge bg-success">
 351                                              <?php echo (int) $item->rating_count; ?>
 352                                          </span>
 353                                      </td>
 354                                      <td class="d-none d-md-table-cell text-center">
 355                                          <span class="badge bg-warning text-dark">
 356                                              <?php echo (int) $item->rating; ?>
 357                                          </span>
 358                                      </td>
 359                                  <?php endif; ?>
 360                                  <td class="d-none d-lg-table-cell">
 361                                      <?php echo (int) $item->id; ?>
 362                                  </td>
 363                              </tr>
 364                          <?php endforeach; ?>
 365                          </tbody>
 366                      </table>
 367  
 368                      <?php // load the pagination. ?>
 369                      <?php echo $this->pagination->getListFooter(); ?>
 370  
 371                      <?php // Load the batch processing form. ?>
 372                      <?php if (
 373                      $user->authorise('core.create', 'com_content')
 374                          && $user->authorise('core.edit', 'com_content')
 375                          && $user->authorise('core.edit.state', 'com_content')
 376  ) : ?>
 377                          <?php echo HTMLHelper::_(
 378                              'bootstrap.renderModal',
 379                              'collapseModal',
 380                              array(
 381                                  'title'  => Text::_('COM_CONTENT_BATCH_OPTIONS'),
 382                                  'footer' => $this->loadTemplate('batch_footer'),
 383                              ),
 384                              $this->loadTemplate('batch_body')
 385                          ); ?>
 386                      <?php endif; ?>
 387                  <?php endif; ?>
 388  
 389                  <?php if ($workflow_enabled) : ?>
 390                  <input type="hidden" name="transition_id" value="">
 391                  <?php endif; ?>
 392  
 393                  <input type="hidden" name="task" value="">
 394                  <input type="hidden" name="boxchecked" value="0">
 395                  <?php echo HTMLHelper::_('form.token'); ?>
 396              </div>
 397          </div>
 398      </div>
 399  </form>


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