first commit
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latestactions
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Module\LatestActions\Administrator\Helper\LatestActionsHelper;
|
||||
|
||||
// Only super user can view this data
|
||||
if (!$app->getIdentity()->authorise('core.admin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$list = LatestActionsHelper::getList($params);
|
||||
|
||||
if ($params->get('automatic_title', 0)) {
|
||||
$module->title = LatestActionsHelper::getTitle($params);
|
||||
}
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_latestactions', $params->get('layout', 'default'));
|
||||
@ -0,0 +1,97 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_latestactions</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2018-05</creationDate>
|
||||
<copyright>(C) 2018 Open Source Matters, Inc.</copyright>
|
||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||
<authorEmail>admin@joomla.org</authorEmail>
|
||||
<authorUrl>www.joomla.org</authorUrl>
|
||||
<version>3.9.0</version>
|
||||
<description>MOD_LATESTACTIONS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\LatestActions</namespace>
|
||||
<files>
|
||||
<filename module="mod_latestactions">mod_latestactions.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_latestactions.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_latestactions.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Action_Logs_-_Latest" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_LATESTACTIONS_FIELD_COUNT_LABEL"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
validate="moduleLayout"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="automatic_title"
|
||||
type="radio"
|
||||
label="COM_MODULES_FIELD_AUTOMATIC_TITLE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache"
|
||||
type="list"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
default="1"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="1">JGLOBAL_USE_GLOBAL</option>
|
||||
<option value="0">COM_MODULES_FIELD_VALUE_NOCACHING</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="cache_time"
|
||||
type="number"
|
||||
label="COM_MODULES_FIELD_CACHE_TIME_LABEL"
|
||||
default="900"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="static"
|
||||
>
|
||||
<option value="static"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latestactions
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\LatestActions\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\Component\Actionlogs\Administrator\Helper\ActionlogsHelper;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_latestactions
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
abstract class LatestActionsHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of logged actions.
|
||||
*
|
||||
* @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 \Joomla\Component\Actionlogs\Administrator\Model\ActionlogsModel $model */
|
||||
$model = Factory::getApplication()->bootComponent('com_actionlogs')->getMVCFactory()
|
||||
->createModel('Actionlogs', 'Administrator', ['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));
|
||||
}
|
||||
}
|
||||
45
administrator/modules/mod_latestactions/tmpl/default.php
Normal file
45
administrator/modules/mod_latestactions/tmpl/default.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latestactions
|
||||
*
|
||||
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
?>
|
||||
<table class="table" id="<?php echo str_replace(' ', '', $module->title) . $module->id; ?>">
|
||||
<caption class="visually-hidden"><?php echo $module->title; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-70"><?php echo Text::_('MOD_LATESTACTIONS_ACTION'); ?></th>
|
||||
<th scope="col" class="w-30"><?php echo Text::_('JDATE'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($list)) : ?>
|
||||
<?php foreach ($list as $i => $item) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $item->message; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo HTMLHelper::_('date.relative', $item->log_date); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<?php echo Text::_('MOD_LATESTACTIONS_NO_MATCHING_RESULTS'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user