[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/modules/mod_latestactions/src/Helper/ -> LatestActionsHelper.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Administrator
   5   * @subpackage  mod_latestactions
   6   *
   7   * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Module\LatestActions\Administrator\Helper;
  12  
  13  use Joomla\CMS\Factory;
  14  use Joomla\CMS\Language\Text;
  15  use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
  16  use Joomla\Registry\Registry;
  17  
  18  // phpcs:disable PSR1.Files.SideEffects
  19  \defined('_JEXEC') or die;
  20  // phpcs:enable PSR1.Files.SideEffects
  21  
  22  /**
  23   * Helper for mod_latestactions
  24   *
  25   * @since  3.9.0
  26   */
  27  abstract class LatestActionsHelper
  28  {
  29      /**
  30       * Get a list of articles.
  31       *
  32       * @param   Registry  &$params  The module parameters.
  33       *
  34       * @return  mixed  An array of action logs, or false on error.
  35       *
  36       * @since   3.9.1
  37       *
  38       * @throws  \Exception
  39       */
  40      public static function getList(&$params)
  41      {
  42          /** @var \Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel $model */
  43          $model = Factory::getApplication()->bootComponent('com_actionlogs')->getMVCFactory()
  44              ->createModel('Actionlogs', 'Administrator', ['ignore_request' => true]);
  45  
  46          // Set the Start and Limit
  47          $model->setState('list.start', 0);
  48          $model->setState('list.limit', $params->get('count', 5));
  49          $model->setState('list.ordering', 'a.id');
  50          $model->setState('list.direction', 'DESC');
  51  
  52          $rows = $model->getItems();
  53  
  54          // Load all actionlog plugins language files
  55          ActionlogsHelper::loadActionLogPluginsLanguage();
  56  
  57          foreach ($rows as $row) {
  58              $row->message = ActionlogsHelper::getHumanReadableLogMessage($row);
  59          }
  60  
  61          return $rows;
  62      }
  63  
  64      /**
  65       * Get the alternate title for the module
  66       *
  67       * @param   Registry  $params  The module parameters.
  68       *
  69       * @return  string    The alternate title for the module.
  70       *
  71       * @since   3.9.1
  72       */
  73      public static function getTitle($params)
  74      {
  75          return Text::plural('MOD_LATESTACTIONS_TITLE', $params->get('count', 5));
  76      }
  77  }


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