CoreFiles by mySites.guru
helper.php72 lines, 1,743 bytes, from Joomla_4.0.0-alpha12-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha11
md5
613113982e48ea117aaf32dfb7ab3270
sha1
95c9b97330861e3bb7272ddd6f29a6711284b5ae
sha256
dfe036faae3e0646d00967ed692866f3b55e489b892dfb1ea1b596ad25b384eb
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  mod_latestactions
 *
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text;
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
use Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel;
use Joomla\Registry\Registry;

/**
 * Helper for mod_latestactions
 *
 * @since  3.9.0
 */
abstract class ModLatestActionsHelper
{
	/**
	 * Get a list of articles.
	 *
	 * @param   Registry  &$params  The module parameters.
	 *
	 * @return  mixed  An array of action logs, or false on error.
	 *
	 * @since   3.9.1
	 *
	 * @throws  Exception
	 */
	public static function getList(&$params)
	{
		/** @var ActionlogsModel $model */
		$model = new ActionlogsModel(['ignore_request' => true]);

		// Set the Start and Limit
		$model->setState('list.start', 0);
		$model->setState('list.limit', $params->get('count', 5));
		$model->setState('list.ordering', 'a.id');
		$model->setState('list.direction', 'DESC');

		$rows = $model->getItems();

		// Load all actionlog plugins language files
		ActionlogsHelper::loadActionLogPluginsLanguage();

		foreach ($rows as $row)
		{
			$row->message = ActionlogsHelper::getHumanReadableLogMessage($row);
		}

		return $rows;
	}

	/**
	 * Get the alternate title for the module
	 *
	 * @param   Registry  $params  The module parameters.
	 *
	 * @return  string    The alternate title for the module.
	 *
	 * @since   3.9.1
	 */
	public static function getTitle($params)
	{
		return Text::plural('MOD_LATESTACTIONS_TITLE', $params->get('count', 5));
	}
}

The same content is in 2 releases, Joomla 4.0.0-alpha11 to 4.0.0-alpha12. See them all, or every version of this file.