[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/modules/mod_articles_category/ -> mod_articles_category.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_articles_category
   6   *
   7   * @copyright   (C) 2010 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\Helper\ModuleHelper;
  14  use Joomla\Module\ArticlesCategory\Site\Helper\ArticlesCategoryHelper;
  15  
  16  $input = $app->input;
  17  
  18  // Prep for Normal or Dynamic Modes
  19  $mode   = $params->get('mode', 'normal');
  20  $idbase = null;
  21  
  22  switch ($mode) {
  23      case 'dynamic':
  24          $option = $input->get('option');
  25          $view   = $input->get('view');
  26  
  27          if ($option === 'com_content') {
  28              switch ($view) {
  29                  case 'category':
  30                  case 'categories':
  31                      $idbase = $input->getInt('id');
  32                      break;
  33                  case 'article':
  34                      if ($params->get('show_on_article_page', 1)) {
  35                          $idbase = $input->getInt('catid');
  36                      }
  37                      break;
  38              }
  39          }
  40          break;
  41      default:
  42          $idbase = $params->get('catid');
  43          break;
  44  }
  45  
  46  $cacheid = md5(serialize(array ($idbase, $module->module, $module->id)));
  47  
  48  $cacheparams               = new \stdClass();
  49  $cacheparams->cachemode    = 'id';
  50  $cacheparams->class        = ArticlesCategoryHelper::class;
  51  $cacheparams->method       = 'getList';
  52  $cacheparams->methodparams = $params;
  53  $cacheparams->modeparams   = $cacheid;
  54  
  55  $list                       = ModuleHelper::moduleCache($module, $params, $cacheparams);
  56  $article_grouping           = $params->get('article_grouping', 'none');
  57  $article_grouping_direction = $params->get('article_grouping_direction', 'ksort');
  58  $grouped                    = $article_grouping !== 'none';
  59  
  60  if ($list && $grouped) {
  61      switch ($article_grouping) {
  62          case 'year':
  63          case 'month_year':
  64              $list = ArticlesCategoryHelper::groupByDate(
  65                  $list,
  66                  $article_grouping_direction,
  67                  $article_grouping,
  68                  $params->get('month_year_format', 'F Y'),
  69                  $params->get('date_grouping_field', 'created')
  70              );
  71              break;
  72          case 'author':
  73          case 'category_title':
  74              $list = ArticlesCategoryHelper::groupBy($list, $article_grouping, $article_grouping_direction);
  75              break;
  76          case 'tags':
  77              $list = ArticlesCategoryHelper::groupByTags($list, $article_grouping_direction);
  78              break;
  79      }
  80  }
  81  
  82  require ModuleHelper::getLayoutPath('mod_articles_category', $params->get('layout', 'default'));


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