[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

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

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


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