[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 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\Component\ComponentHelper; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\HTML\HTMLHelper; 16 use Joomla\CMS\Language\Associations; 17 use Joomla\CMS\Language\Multilanguage; 18 use Joomla\CMS\Language\Text; 19 use Joomla\CMS\Router\Route; 20 use Joomla\CMS\Uri\Uri; 21 use Joomla\Component\Content\Administrator\Extension\ContentComponent; 22 use Joomla\Component\Content\Site\Helper\AssociationHelper; 23 use Joomla\Component\Content\Site\Helper\RouteHelper; 24 25 /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */ 26 $wa = $this->document->getWebAssetManager(); 27 $wa->useScript('com_content.articles-list'); 28 29 // Create some shortcuts. 30 $n = count($this->items); 31 $listOrder = $this->escape($this->state->get('list.ordering')); 32 $listDirn = $this->escape($this->state->get('list.direction')); 33 $langFilter = false; 34 35 // Tags filtering based on language filter 36 if (($this->params->get('filter_field') === 'tag') && (Multilanguage::isEnabled())) { 37 $tagfilter = ComponentHelper::getParams('com_tags')->get('tag_list_language_filter'); 38 39 switch ($tagfilter) { 40 case 'current_language': 41 $langFilter = Factory::getApplication()->getLanguage()->getTag(); 42 break; 43 44 case 'all': 45 $langFilter = false; 46 break; 47 48 default: 49 $langFilter = $tagfilter; 50 } 51 } 52 53 // Check for at least one editable article 54 $isEditable = false; 55 56 if (!empty($this->items)) { 57 foreach ($this->items as $article) { 58 if ($article->params->get('access-edit')) { 59 $isEditable = true; 60 break; 61 } 62 } 63 } 64 65 $currentDate = Factory::getDate()->format('Y-m-d H:i:s'); 66 ?> 67 68 <form action="<?php echo htmlspecialchars(Uri::getInstance()->toString()); ?>" method="post" name="adminForm" id="adminForm" class="com-content-category__articles"> 69 <?php if ($this->params->get('filter_field') !== 'hide') : ?> 70 <div class="com-content__filter btn-group"> 71 <?php if ($this->params->get('filter_field') === 'tag') : ?> 72 <span class="visually-hidden"> 73 <label class="filter-search-lbl" for="filter-search"> 74 <?php echo Text::_('JOPTION_SELECT_TAG'); ?> 75 </label> 76 </span> 77 <select name="filter_tag" id="filter-search" class="form-select" onchange="document.adminForm.submit();" > 78 <option value=""><?php echo Text::_('JOPTION_SELECT_TAG'); ?></option> 79 <?php echo HTMLHelper::_('select.options', HTMLHelper::_('tag.options', array('filter.published' => array(1), 'filter.language' => $langFilter), true), 'value', 'text', $this->state->get('filter.tag')); ?> 80 </select> 81 <?php elseif ($this->params->get('filter_field') === 'month') : ?> 82 <span class="visually-hidden"> 83 <label class="filter-search-lbl" for="filter-search"> 84 <?php echo Text::_('JOPTION_SELECT_MONTH'); ?> 85 </label> 86 </span> 87 <select name="filter-search" id="filter-search" class="form-select" onchange="document.adminForm.submit();"> 88 <option value=""><?php echo Text::_('JOPTION_SELECT_MONTH'); ?></option> 89 <?php echo HTMLHelper::_('select.options', HTMLHelper::_('content.months', $this->state), 'value', 'text', $this->state->get('list.filter')); ?> 90 </select> 91 <?php else : ?> 92 <label class="filter-search-lbl visually-hidden" for="filter-search"> 93 <?php echo Text::_('COM_CONTENT_' . $this->params->get('filter_field') . '_FILTER_LABEL'); ?> 94 </label> 95 <input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" placeholder="<?php echo Text::_('COM_CONTENT_' . $this->params->get('filter_field') . '_FILTER_LABEL'); ?>"> 96 <?php endif; ?> 97 98 <?php if ($this->params->get('filter_field') !== 'tag' && $this->params->get('filter_field') !== 'month') : ?> 99 <button type="submit" name="filter_submit" class="btn btn-primary"><?php echo Text::_('JGLOBAL_FILTER_BUTTON'); ?></button> 100 <?php endif; ?> 101 <button type="reset" name="filter-clear-button" class="btn btn-secondary"><?php echo Text::_('JSEARCH_FILTER_CLEAR'); ?></button> 102 </div> 103 <?php endif; ?> 104 105 <?php if ($this->params->get('show_pagination_limit')) : ?> 106 <div class="com-content-category__pagination btn-group float-end"> 107 <label for="limit" class="visually-hidden"> 108 <?php echo Text::_('JGLOBAL_DISPLAY_NUM'); ?> 109 </label> 110 <?php echo $this->pagination->getLimitBox(); ?> 111 </div> 112 <?php endif; ?> 113 114 <?php if (empty($this->items)) : ?> 115 <?php if ($this->params->get('show_no_articles', 1)) : ?> 116 <div class="alert alert-info"> 117 <span class="icon-info-circle" aria-hidden="true"></span><span class="visually-hidden"><?php echo Text::_('INFO'); ?></span> 118 <?php echo Text::_('COM_CONTENT_NO_ARTICLES'); ?> 119 </div> 120 <?php endif; ?> 121 <?php else : ?> 122 <table class="com-content-category__table category table table-striped table-bordered table-hover"> 123 <caption class="visually-hidden"> 124 <?php echo Text::_('COM_CONTENT_ARTICLES_TABLE_CAPTION'); ?> 125 </caption> 126 <?php if ($this->params->get('show_headings')) : ?> 127 <thead> 128 <tr> 129 <th scope="col" id="categorylist_header_title"> 130 <?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder, null, 'asc', '', 'adminForm'); ?> 131 </th> 132 <?php if ($date = $this->params->get('list_show_date')) : ?> 133 <th scope="col" id="categorylist_header_date"> 134 <?php if ($date === 'created') : ?> 135 <?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.created', $listDirn, $listOrder); ?> 136 <?php elseif ($date === 'modified') : ?> 137 <?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.modified', $listDirn, $listOrder); ?> 138 <?php elseif ($date === 'published') : ?> 139 <?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_' . $date . '_DATE', 'a.publish_up', $listDirn, $listOrder); ?> 140 <?php endif; ?> 141 </th> 142 <?php endif; ?> 143 <?php if ($this->params->get('list_show_author')) : ?> 144 <th scope="col" id="categorylist_header_author"> 145 <?php echo HTMLHelper::_('grid.sort', 'JAUTHOR', 'author', $listDirn, $listOrder); ?> 146 </th> 147 <?php endif; ?> 148 <?php if ($this->params->get('list_show_hits')) : ?> 149 <th scope="col" id="categorylist_header_hits"> 150 <?php echo HTMLHelper::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?> 151 </th> 152 <?php endif; ?> 153 <?php if ($this->params->get('list_show_votes', 0) && $this->vote) : ?> 154 <th scope="col" id="categorylist_header_votes"> 155 <?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_VOTES', 'rating_count', $listDirn, $listOrder); ?> 156 </th> 157 <?php endif; ?> 158 <?php if ($this->params->get('list_show_ratings', 0) && $this->vote) : ?> 159 <th scope="col" id="categorylist_header_ratings"> 160 <?php echo HTMLHelper::_('grid.sort', 'COM_CONTENT_RATINGS', 'rating', $listDirn, $listOrder); ?> 161 </th> 162 <?php endif; ?> 163 <?php if ($isEditable) : ?> 164 <th scope="col" id="categorylist_header_edit"><?php echo Text::_('COM_CONTENT_EDIT_ITEM'); ?></th> 165 <?php endif; ?> 166 </tr> 167 </thead> 168 <?php endif; ?> 169 <tbody> 170 <?php foreach ($this->items as $i => $article) : ?> 171 <?php if ($this->items[$i]->state == ContentComponent::CONDITION_UNPUBLISHED) : ?> 172 <tr class="system-unpublished cat-list-row<?php echo $i % 2; ?>"> 173 <?php else : ?> 174 <tr class="cat-list-row<?php echo $i % 2; ?>" > 175 <?php endif; ?> 176 <th class="list-title" scope="row"> 177 <?php if (in_array($article->access, $this->user->getAuthorisedViewLevels())) : ?> 178 <a href="<?php echo Route::_(RouteHelper::getArticleRoute($article->slug, $article->catid, $article->language)); ?>"> 179 <?php echo $this->escape($article->title); ?> 180 </a> 181 <?php if (Associations::isEnabled() && $this->params->get('show_associations')) : ?> 182 <div class="cat-list-association"> 183 <?php $associations = AssociationHelper::displayAssociations($article->id); ?> 184 <?php foreach ($associations as $association) : ?> 185 <?php if ($this->params->get('flags', 1) && $association['language']->image) : ?> 186 <?php $flag = HTMLHelper::_('image', 'mod_languages/' . $association['language']->image . '.gif', $association['language']->title_native, array('title' => $association['language']->title_native), true); ?> 187 <a href="<?php echo Route::_($association['item']); ?>"><?php echo $flag; ?></a> 188 <?php else : ?> 189 <?php $class = 'btn btn-secondary btn-sm btn-' . strtolower($association['language']->lang_code); ?> 190 <a class="<?php echo $class; ?>" title="<?php echo $association['language']->title_native; ?>" href="<?php echo Route::_($association['item']); ?>"><?php echo $association['language']->lang_code; ?> 191 <span class="visually-hidden"><?php echo $association['language']->title_native; ?></span> 192 </a> 193 <?php endif; ?> 194 <?php endforeach; ?> 195 </div> 196 <?php endif; ?> 197 <?php else : ?> 198 <?php 199 echo $this->escape($article->title) . ' : '; 200 $itemId = Factory::getApplication()->getMenu()->getActive()->id; 201 $link = new Uri(Route::_('index.php?option=com_users&view=login&Itemid=' . $itemId, false)); 202 $link->setVar('return', base64_encode(RouteHelper::getArticleRoute($article->slug, $article->catid, $article->language))); 203 ?> 204 <a href="<?php echo $link; ?>" class="register"> 205 <?php echo Text::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?> 206 </a> 207 <?php if (Associations::isEnabled() && $this->params->get('show_associations')) : ?> 208 <div class="cat-list-association"> 209 <?php $associations = AssociationHelper::displayAssociations($article->id); ?> 210 <?php foreach ($associations as $association) : ?> 211 <?php if ($this->params->get('flags', 1)) : ?> 212 <?php $flag = HTMLHelper::_('image', 'mod_languages/' . $association['language']->image . '.gif', $association['language']->title_native, array('title' => $association['language']->title_native), true); ?> 213 <a href="<?php echo Route::_($association['item']); ?>"><?php echo $flag; ?></a> 214 <?php else : ?> 215 <?php $class = 'btn btn-secondary btn-sm btn-' . strtolower($association['language']->lang_code); ?> 216 <a class="<?php echo $class; ?>" title="<?php echo $association['language']->title_native; ?>" href="<?php echo Route::_($association['item']); ?>"><?php echo $association['language']->lang_code; ?> 217 <span class="visually-hidden"><?php echo $association['language']->title_native; ?></span> 218 </a> 219 <?php endif; ?> 220 <?php endforeach; ?> 221 </div> 222 <?php endif; ?> 223 <?php endif; ?> 224 <?php if ($article->state == ContentComponent::CONDITION_UNPUBLISHED) : ?> 225 <div> 226 <span class="list-published badge bg-warning text-light"> 227 <?php echo Text::_('JUNPUBLISHED'); ?> 228 </span> 229 </div> 230 <?php endif; ?> 231 <?php if ($article->publish_up > $currentDate) : ?> 232 <div> 233 <span class="list-published badge bg-warning text-light"> 234 <?php echo Text::_('JNOTPUBLISHEDYET'); ?> 235 </span> 236 </div> 237 <?php endif; ?> 238 <?php if (!is_null($article->publish_down) && $article->publish_down < $currentDate) : ?> 239 <div> 240 <span class="list-published badge bg-warning text-light"> 241 <?php echo Text::_('JEXPIRED'); ?> 242 </span> 243 </div> 244 <?php endif; ?> 245 </th> 246 <?php if ($this->params->get('list_show_date')) : ?> 247 <td class="list-date small"> 248 <?php 249 echo HTMLHelper::_( 250 'date', 251 $article->displayDate, 252 $this->escape($this->params->get('date_format', Text::_('DATE_FORMAT_LC3'))) 253 ); ?> 254 </td> 255 <?php endif; ?> 256 <?php if ($this->params->get('list_show_author', 1)) : ?> 257 <td class="list-author"> 258 <?php if (!empty($article->author) || !empty($article->created_by_alias)) : ?> 259 <?php $author = $article->author ?> 260 <?php $author = $article->created_by_alias ?: $author; ?> 261 <?php if (!empty($article->contact_link) && $this->params->get('link_author') == true) : ?> 262 <?php if ($this->params->get('show_headings')) : ?> 263 <?php echo HTMLHelper::_('link', $article->contact_link, $author); ?> 264 <?php else : ?> 265 <?php echo Text::sprintf('COM_CONTENT_WRITTEN_BY', HTMLHelper::_('link', $article->contact_link, $author)); ?> 266 <?php endif; ?> 267 <?php else : ?> 268 <?php if ($this->params->get('show_headings')) : ?> 269 <?php echo $author; ?> 270 <?php else : ?> 271 <?php echo Text::sprintf('COM_CONTENT_WRITTEN_BY', $author); ?> 272 <?php endif; ?> 273 <?php endif; ?> 274 <?php endif; ?> 275 </td> 276 <?php endif; ?> 277 <?php if ($this->params->get('list_show_hits', 1)) : ?> 278 <td class="list-hits"> 279 <span class="badge bg-info"> 280 <?php if ($this->params->get('show_headings')) : ?> 281 <?php echo $article->hits; ?> 282 <?php else : ?> 283 <?php echo Text::sprintf('JGLOBAL_HITS_COUNT', $article->hits); ?> 284 <?php endif; ?> 285 </span> 286 </td> 287 <?php endif; ?> 288 <?php if ($this->params->get('list_show_votes', 0) && $this->vote) : ?> 289 <td class="list-votes"> 290 <span class="badge bg-success"> 291 <?php if ($this->params->get('show_headings')) : ?> 292 <?php echo $article->rating_count; ?> 293 <?php else : ?> 294 <?php echo Text::sprintf('COM_CONTENT_VOTES_COUNT', $article->rating_count); ?> 295 <?php endif; ?> 296 </span> 297 </td> 298 <?php endif; ?> 299 <?php if ($this->params->get('list_show_ratings', 0) && $this->vote) : ?> 300 <td class="list-ratings"> 301 <span class="badge bg-warning text-light"> 302 <?php if ($this->params->get('show_headings')) : ?> 303 <?php echo $article->rating; ?> 304 <?php else : ?> 305 <?php echo Text::sprintf('COM_CONTENT_RATINGS_COUNT', $article->rating); ?> 306 <?php endif; ?> 307 </span> 308 </td> 309 <?php endif; ?> 310 <?php if ($isEditable) : ?> 311 <td class="list-edit"> 312 <?php if ($article->params->get('access-edit')) : ?> 313 <?php echo HTMLHelper::_('contenticon.edit', $article, $article->params); ?> 314 <?php endif; ?> 315 </td> 316 <?php endif; ?> 317 </tr> 318 <?php endforeach; ?> 319 </tbody> 320 </table> 321 <?php endif; ?> 322 323 <?php // Code to add a link to submit an article. ?> 324 <?php if ($this->category->getParams()->get('access-create')) : ?> 325 <?php echo HTMLHelper::_('contenticon.create', $this->category, $this->category->params); ?> 326 <?php endif; ?> 327 328 <?php // Add pagination links ?> 329 <?php if (!empty($this->items)) : ?> 330 <?php if (($this->params->def('show_pagination', 2) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) : ?> 331 <div class="com-content-category__navigation w-100"> 332 <?php if ($this->params->def('show_pagination_results', 1)) : ?> 333 <p class="com-content-category__counter counter float-end pt-3 pe-2"> 334 <?php echo $this->pagination->getPagesCounter(); ?> 335 </p> 336 <?php endif; ?> 337 <div class="com-content-category__pagination"> 338 <?php echo $this->pagination->getPagesLinks(); ?> 339 </div> 340 </div> 341 <?php endif; ?> 342 <?php endif; ?> 343 <div> 344 <input type="hidden" name="filter_order" value=""> 345 <input type="hidden" name="filter_order_Dir" value=""> 346 <input type="hidden" name="limitstart" value=""> 347 <input type="hidden" name="task" value=""> 348 </div> 349 </form>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |