first commit
This commit is contained in:
25
administrator/modules/mod_custom/mod_custom.php
Normal file
25
administrator/modules/mod_custom/mod_custom.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright (C) 2009 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\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
|
||||
if ($params->def('prepare_content', 1)) {
|
||||
PluginHelper::importPlugin('content');
|
||||
$module->content = HTMLHelper::_('content.prepare', $module->content, '', 'mod_custom.content');
|
||||
}
|
||||
|
||||
// Replace 'images/' to '../images/' when using an image from /images in backend.
|
||||
$module->content = preg_replace('*src\=\"(?!administrator\/)images/*', 'src="../images/', $module->content);
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_custom', $params->get('layout', 'default'));
|
||||
81
administrator/modules/mod_custom/mod_custom.xml
Normal file
81
administrator/modules/mod_custom/mod_custom.xml
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_custom</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-07</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_CUSTOM_XML_DESCRIPTION</description>
|
||||
|
||||
<customContent />
|
||||
|
||||
<files>
|
||||
<filename module="mod_custom">mod_custom.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_custom.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_custom.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Custom" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="options" label="COM_MODULES_BASIC_FIELDSET_LABEL">
|
||||
<field
|
||||
name="prepare_content"
|
||||
type="radio"
|
||||
label="MOD_CUSTOM_FIELD_PREPARE_CONTENT_LABEL"
|
||||
description="MOD_CUSTOM_FIELD_PREPARE_CONTENT_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
<fieldset
|
||||
name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
|
||||
<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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
16
administrator/modules/mod_custom/tmpl/default.php
Normal file
16
administrator/modules/mod_custom/tmpl/default.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_custom
|
||||
*
|
||||
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
|
||||
<div class="mod-custom custom">
|
||||
<?php echo $module->content; ?>
|
||||
</div>
|
||||
17
administrator/modules/mod_feed/mod_feed.php
Normal file
17
administrator/modules/mod_feed/mod_feed.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
$feed = \Joomla\Module\Feed\Administrator\Helper\FeedHelper::getFeed($params);
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
$rssrtl = $params->get('rssrtl', 0);
|
||||
|
||||
require \Joomla\CMS\Helper\ModuleHelper::getLayoutPath('mod_feed', $params->get('layout', 'default'));
|
||||
157
administrator/modules/mod_feed/mod_feed.xml
Normal file
157
administrator/modules/mod_feed/mod_feed.xml
Normal file
@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_feed</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-07</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_FEED_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Feed</namespace>
|
||||
<files>
|
||||
<filename module="mod_feed">mod_feed.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_feed.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_feed.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Feed_Display" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="rssurl"
|
||||
type="url"
|
||||
label="MOD_FEED_FIELD_RSSURL_LABEL"
|
||||
filter="url"
|
||||
required="true"
|
||||
validate="url"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="rssrtl"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_RTL_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssdate"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_DATE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssdesc"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_DESCRIPTION_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssimage"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_IMAGE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssitems"
|
||||
type="number"
|
||||
label="MOD_FEED_FIELD_ITEMS_LABEL"
|
||||
default="3"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="rssitemdesc"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_ITEMDESCRIPTION_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="rssitemdate"
|
||||
type="radio"
|
||||
label="MOD_FEED_FIELD_ITEMDATE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
</fieldset>
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
|
||||
<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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
55
administrator/modules/mod_feed/src/Helper/FeedHelper.php
Normal file
55
administrator/modules/mod_feed/src/Helper/FeedHelper.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Feed\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Feed\FeedFactory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_feed
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class FeedHelper
|
||||
{
|
||||
/**
|
||||
* Method to load a feed.
|
||||
*
|
||||
* @param \Joomla\Registry\Registry $params The parameters object.
|
||||
*
|
||||
* @return \Joomla\CMS\Feed\Feed|string Return a JFeedReader object or a string message if error.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public static function getFeed($params)
|
||||
{
|
||||
// Module params
|
||||
$rssurl = $params->get('rssurl', '');
|
||||
|
||||
// Get RSS parsed object
|
||||
try {
|
||||
$feed = new FeedFactory();
|
||||
$rssDoc = $feed->getFeed($rssurl);
|
||||
} catch (\Exception $e) {
|
||||
return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
if (empty($rssDoc)) {
|
||||
return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
|
||||
}
|
||||
|
||||
return $rssDoc;
|
||||
}
|
||||
}
|
||||
118
administrator/modules/mod_feed/tmpl/default.php
Normal file
118
administrator/modules/mod_feed/tmpl/default.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_feed
|
||||
*
|
||||
* @copyright (C) 2006 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;
|
||||
use Joomla\Filter\OutputFilter;
|
||||
|
||||
// Check if feed URL has been set
|
||||
if (empty($rssurl)) {
|
||||
echo '<div>' . Text::_('MOD_FEED_ERR_NO_URL') . '</div>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!empty($feed) && is_string($feed)) {
|
||||
echo $feed;
|
||||
} else {
|
||||
$lang = $app->getLanguage();
|
||||
$myrtl = $params->get('rssrtl', 0);
|
||||
$direction = ' ';
|
||||
|
||||
if ($lang->isRtl() && $myrtl == 0) {
|
||||
$direction = ' redirect-rtl';
|
||||
} elseif ($lang->isRtl() && $myrtl == 1) {
|
||||
// Feed description
|
||||
$direction = ' redirect-ltr';
|
||||
} elseif ($lang->isRtl() && $myrtl == 2) {
|
||||
$direction = ' redirect-rtl';
|
||||
} elseif ($myrtl == 0) {
|
||||
$direction = ' redirect-ltr';
|
||||
} elseif ($myrtl == 1) {
|
||||
$direction = ' redirect-ltr';
|
||||
} elseif ($myrtl == 2) {
|
||||
$direction = ' redirect-rtl';
|
||||
}
|
||||
|
||||
if ($feed != false) :
|
||||
?>
|
||||
<div style="direction: <?php echo $rssrtl ? 'rtl' : 'ltr'; ?>; text-align: <?php echo $rssrtl ? 'right' : 'left'; ?> !important" class="feed">
|
||||
<?php
|
||||
|
||||
// Feed title
|
||||
if (!is_null($feed->title) && $params->get('rsstitle', 1)) : ?>
|
||||
<h2 class="<?php echo $direction; ?>">
|
||||
<a href="<?php echo str_replace('&', '&', $rssurl); ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?php echo $feed->title; ?></a>
|
||||
</h2>
|
||||
<?php endif;
|
||||
// Feed date
|
||||
if ($params->get('rssdate', 1)) : ?>
|
||||
<h3>
|
||||
<?php echo HTMLHelper::_('date', $feed->publishedDate, Text::_('DATE_FORMAT_LC3')); ?>
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php // Feed description ?>
|
||||
<?php if ($params->get('rssdesc', 1)) : ?>
|
||||
<?php echo $feed->description; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php // Feed image ?>
|
||||
<?php if ($params->get('rssimage', 1) && $feed->image) : ?>
|
||||
<img class="w-100" src="<?php echo $feed->image->uri; ?>" alt="<?php echo $feed->image->title; ?>"/>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php // Show items ?>
|
||||
<?php if (!empty($feed)) : ?>
|
||||
<ul class="newsfeed list-group">
|
||||
<?php for ($i = 0; $i < $params->get('rssitems', 3); $i++) :
|
||||
if (!$feed->offsetExists($i)) :
|
||||
break;
|
||||
endif;
|
||||
$uri = $feed[$i]->uri || !$feed[$i]->isPermaLink ? trim($feed[$i]->uri) : trim($feed[$i]->guid);
|
||||
$uri = !$uri || stripos($uri, 'http') !== 0 ? $rssurl : $uri;
|
||||
$text = $feed[$i]->content !== '' ? trim($feed[$i]->content) : '';
|
||||
?>
|
||||
<li class="list-group-item mb-2">
|
||||
<?php if (!empty($uri)) : ?>
|
||||
<h5 class="feed-link">
|
||||
<a href="<?php echo $uri; ?>" target="_blank">
|
||||
<?php echo trim($feed[$i]->title); ?></a></h5>
|
||||
<?php else : ?>
|
||||
<h5 class="feed-link"><?php echo trim($feed[$i]->title); ?></h5>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('rssitemdate', 0)) : ?>
|
||||
<div class="feed-item-date">
|
||||
<?php echo HTMLHelper::_('date', $feed[$i]->publishedDate, Text::_('DATE_FORMAT_LC3')); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($params->get('rssitemdesc', 1) && $text !== '') : ?>
|
||||
<div class="feed-item-description">
|
||||
<?php
|
||||
// Strip the images.
|
||||
$text = OutputFilter::stripImages($text);
|
||||
$text = HTMLHelper::_('string.truncate', $text, $params->get('word_count', 0), true, false);
|
||||
echo str_replace(''', "'", $text);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif;
|
||||
}
|
||||
17
administrator/modules/mod_frontend/mod_frontend.php
Normal file
17
administrator/modules/mod_frontend/mod_frontend.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_frontend
|
||||
*
|
||||
* @copyright (C) 2019 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;
|
||||
|
||||
$sitename = htmlspecialchars($app->get('sitename', ''), ENT_QUOTES, 'UTF-8');
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_frontend', $params->get('layout', 'default'));
|
||||
41
administrator/modules/mod_frontend/mod_frontend.xml
Normal file
41
administrator/modules/mod_frontend/mod_frontend.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_frontend</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-07</creationDate>
|
||||
<copyright>(C) 2019 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>4.0.0</version>
|
||||
<description>MOD_FRONTEND_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_frontend">mod_frontend.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_frontend.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_frontend.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Frontend_Link" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
27
administrator/modules/mod_frontend/tmpl/default.php
Normal file
27
administrator/modules/mod_frontend/tmpl/default.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_frontend
|
||||
*
|
||||
* @copyright (C) 2019 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;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
?>
|
||||
<a href="<?php echo Uri::root(); ?>" class="header-item-content"
|
||||
title="<?php echo Text::sprintf('MOD_FRONTEND_PREVIEW', $sitename); ?>"
|
||||
target="_blank">
|
||||
<div class="header-item-icon">
|
||||
<span class="icon-external-link-alt" aria-hidden="true"></span>
|
||||
</div>
|
||||
<div class="header-item-text">
|
||||
<?php echo HTMLHelper::_('string.truncate', $sitename, 28, false, false); ?>
|
||||
</div>
|
||||
</a>
|
||||
68
administrator/modules/mod_guidedtours/mod_guidedtours.xml
Normal file
68
administrator/modules/mod_guidedtours/mod_guidedtours.xml
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_guidedtours</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2023-02</creationDate>
|
||||
<copyright>(C) 2023 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>4.3.0</version>
|
||||
<description>MOD_GUIDEDTOURS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\GuidedTours</namespace>
|
||||
<files>
|
||||
<folder module="mod_guidedtours">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_guidedtours.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_guidedtours.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Tours_Menu" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="contextcount"
|
||||
type="number"
|
||||
label="MOD_GUIDEDTOURS_FIELD_CONTEXT_TOUR_COUNT_LABEL"
|
||||
description="MOD_GUIDEDTOURS_FIELD_CONTEXT_TOUR_COUNT_DESC"
|
||||
default="7"
|
||||
filter="integer"
|
||||
min="0"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="tourscount"
|
||||
type="number"
|
||||
label="MOD_GUIDEDTOURS_FIELD_TOUR_COUNT_LABEL"
|
||||
description="MOD_GUIDEDTOURS_FIELD_TOUR_COUNT_DESC"
|
||||
default="7"
|
||||
filter="integer"
|
||||
min="0"
|
||||
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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
administrator/modules/mod_guidedtours/services/provider.php
Normal file
41
administrator/modules/mod_guidedtours/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 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\Extension\Service\Provider\HelperFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\Module;
|
||||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The guided tours module service provider.
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\GuidedTours'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\GuidedTours\\Administrator\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\GuidedTours\Administrator\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_guidedtours
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Runs the dispatcher.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function dispatch()
|
||||
{
|
||||
// The guided tour will not show if no user is logged in.
|
||||
$user = $this->getApplication()->getIdentity();
|
||||
if ($user === null || $user->id === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The module can't show if the plugin is not enabled.
|
||||
if (!PluginHelper::isEnabled('system', 'guidedtours')) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
protected function getLayoutData()
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$data['tours'] = $this->getHelperFactory()->getHelper('GuidedToursHelper')->getTours($data['params'], $this->getApplication());
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\GuidedTours\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Application\AdministratorApplication;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\Uri\Uri;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_guidedtours
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
class GuidedToursHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of tours from a specific context.
|
||||
*
|
||||
* @param Registry $params Object holding the module parameters
|
||||
* @param AdministratorApplication $app The application
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 4.3.0
|
||||
*/
|
||||
public function getTours(Registry $params, AdministratorApplication $app)
|
||||
{
|
||||
$factory = $app->bootComponent('com_guidedtours')->getMVCFactory();
|
||||
|
||||
$user = $app->getIdentity();
|
||||
|
||||
// Get an instance of the guided tour model
|
||||
$tourModel = $factory->createModel('Tours', 'Administrator', ['ignore_request' => true]);
|
||||
|
||||
$tourModel->setState('filter.published', 1);
|
||||
$tourModel->setState('filter.access', $app->getIdentity()->getAuthorisedViewLevels());
|
||||
|
||||
if (Multilanguage::isEnabled()) {
|
||||
$tourModel->setState('filter.language', ['*', $app->getLanguage()->getTag()]);
|
||||
}
|
||||
|
||||
$items = $tourModel->getItems();
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
// The user can only see the tours of extensions that are allowed.
|
||||
$uri = new Uri($item->url);
|
||||
|
||||
if ($extension = $uri->getVar('option')) {
|
||||
if (!$user->authorise('core.manage', $extension)) {
|
||||
unset($items[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
168
administrator/modules/mod_guidedtours/tmpl/default.php
Normal file
168
administrator/modules/mod_guidedtours/tmpl/default.php
Normal file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_guidedtours
|
||||
*
|
||||
* @copyright (C) 2023 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\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$hideLinks = $app->getInput()->getBool('hidemainmenu');
|
||||
|
||||
if ($hideLinks || !$tours) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the Bootstrap Dropdown
|
||||
$app->getDocument()
|
||||
->getWebAssetManager()
|
||||
->useScript('bootstrap.dropdown')
|
||||
->useScript('joomla.dialog-autocreate');
|
||||
|
||||
$lang = $app->getLanguage();
|
||||
$extension = $app->getInput()->get('option');
|
||||
$contextTours = [];
|
||||
$starTours = [];
|
||||
$listTours = [];
|
||||
$allTours = [];
|
||||
$contextCount = $params->get('contextcount', 7);
|
||||
$toursCount = $params->get('tourscount', 7);
|
||||
|
||||
foreach ($tours as $tour) :
|
||||
$uri = new Uri($tour->url);
|
||||
|
||||
if (in_array('*', $tour->extensions)) :
|
||||
$starTours[] = $tour;
|
||||
elseif (in_array($extension, $tour->extensions)) :
|
||||
if ($extension === 'com_categories') :
|
||||
// Special case for the categories page, where the context is complemented with the extension the categories apply to
|
||||
if ($uri->getVar('option', '') === 'com_categories') :
|
||||
if ($uri->getVar('extension', '') === $app->getInput()->get('extension', '')) :
|
||||
if ($contextCount > 0) :
|
||||
$contextTours[] = $tour;
|
||||
$contextCount--;
|
||||
endif;
|
||||
elseif ($toursCount > 0) :
|
||||
$listTours[] = $tour;
|
||||
$toursCount--;
|
||||
endif;
|
||||
else :
|
||||
if (in_array($app->getInput()->get('extension', ''), $tour->extensions)) :
|
||||
if ($contextCount > 0) :
|
||||
$contextTours[] = $tour;
|
||||
$contextCount--;
|
||||
endif;
|
||||
elseif ($toursCount > 0) :
|
||||
$listTours[] = $tour;
|
||||
$toursCount--;
|
||||
endif;
|
||||
endif;
|
||||
elseif ($contextCount > 0) :
|
||||
$contextTours[] = $tour;
|
||||
$contextCount--;
|
||||
endif;
|
||||
elseif ($toursCount > 0) :
|
||||
$listTours[] = $tour;
|
||||
$toursCount--;
|
||||
endif;
|
||||
|
||||
// We assume the url is the starting point
|
||||
$key = $uri->getVar('option') ?? 'com_cpanel';
|
||||
|
||||
if (!isset($allTours[$key])) :
|
||||
$lang->load("$key.sys", JPATH_ADMINISTRATOR)
|
||||
|| $lang->load("$key.sys", JPATH_ADMINISTRATOR . '/components/' . $key);
|
||||
|
||||
$allTours[$key] = [];
|
||||
endif;
|
||||
|
||||
$allTours[$key][] = $tour;
|
||||
endforeach;
|
||||
|
||||
if ($contextCount > 0) :
|
||||
// The '*' tours have lower priority than contextual tours and are added after them, room permitting
|
||||
$contextTours = array_slice(array_merge($contextTours, $starTours), 0, $params->get('contextcount', 7));
|
||||
endif;
|
||||
|
||||
$popupId = 'guidedtours-popup-content' . $module->id;
|
||||
$popupOptions = json_encode([
|
||||
'src' => '#' . $popupId,
|
||||
'width' => '800px',
|
||||
'height' => 'fit-content',
|
||||
'textHeader' => Text::_('MOD_GUIDEDTOURS_START_TOUR'),
|
||||
'preferredParent' => 'body',
|
||||
]);
|
||||
|
||||
?>
|
||||
<div class="header-item-content dropdown header-tours d-none d-sm-block">
|
||||
<button class="dropdown-toggle d-flex align-items-center ps-0 py-0" data-bs-toggle="dropdown" type="button" title="<?php echo Text::_('MOD_GUIDEDTOURS_MENU'); ?>">
|
||||
<div class="header-item-icon">
|
||||
<span class="icon-map-signs" aria-hidden="true"></span>
|
||||
</div>
|
||||
<div class="header-item-text">
|
||||
<?php echo Text::_('MOD_GUIDEDTOURS_MENU'); ?>
|
||||
</div>
|
||||
<span class="icon-angle-down" aria-hidden="true"></span>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php if (count($contextTours) > 0) : ?>
|
||||
<ul class="list-unstyled m-0">
|
||||
<?php foreach ($contextTours as $tour) : ?>
|
||||
<li>
|
||||
<button type="button" class="button-start-guidedtour dropdown-item" data-id="<?php echo $tour->id; ?>">
|
||||
<span class="icon-star icon-fw" aria-hidden="true"></span>
|
||||
<?php echo $tour->title; ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<hr class="dropdown-divider m-0" role="separator" />
|
||||
<?php endif; ?>
|
||||
<?php if (count($listTours) > 0) : ?>
|
||||
<ul class="list-unstyled m-0">
|
||||
<?php foreach ($listTours as $tour) : ?>
|
||||
<li>
|
||||
<button type="button" class="button-start-guidedtour dropdown-item" data-id="<?php echo $tour->id; ?>">
|
||||
<span class="icon-map-signs icon-fw" aria-hidden="true"></span>
|
||||
<?php echo $tour->title; ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<hr class="dropdown-divider m-0" role="separator" />
|
||||
<?php endif; ?>
|
||||
<button type="button" class="dropdown-item text-center" data-joomla-dialog="<?php echo htmlspecialchars($popupOptions); ?>">
|
||||
<?php echo Text::_('MOD_GUIDEDTOURS_SHOW_ALL'); ?>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$modalHtml = [];
|
||||
$modalHtml[] = '<div class="p-3">';
|
||||
$modalHtml[] = '<div class="row">';
|
||||
foreach ($allTours as $extension => $tours) :
|
||||
$modalHtml[] = '<div class="col-lg-6">';
|
||||
$modalHtml[] = '<h4>' . Text::_($extension) . '</h4>';
|
||||
$modalHtml[] = '<ul class="list-unstyled">';
|
||||
foreach ($tours as $tour) :
|
||||
$modalHtml[] = '<li>';
|
||||
$modalHtml[] = '<a href="#" role="button" class="button-start-guidedtour" data-id="' . (int) $tour->id . '">' . htmlentities($tour->title) . '</a>';
|
||||
$modalHtml[] = '</li>';
|
||||
endforeach;
|
||||
$modalHtml[] = '</ul>';
|
||||
$modalHtml[] = '</div>';
|
||||
endforeach;
|
||||
$modalHtml[] = '</div>';
|
||||
$modalHtml[] = '</div>';
|
||||
|
||||
$modalBody = implode($modalHtml);
|
||||
|
||||
?>
|
||||
<template id="<?php echo $popupId; ?>"><?php echo $modalBody; ?></template>
|
||||
39
administrator/modules/mod_latest/mod_latest.php
Normal file
39
administrator/modules/mod_latest/mod_latest.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
*
|
||||
* @copyright (C) 2005 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\Component\ComponentHelper;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\Module\Latest\Administrator\Helper\LatestHelper;
|
||||
|
||||
$model = $app->bootComponent('com_content')->getMVCFactory()->createModel('Articles', 'Administrator', ['ignore_request' => true]);
|
||||
$list = LatestHelper::getList($params, $model);
|
||||
$workflow_enabled = ComponentHelper::getParams('com_content')->get('workflow_enabled');
|
||||
|
||||
if ($workflow_enabled) {
|
||||
$app->getLanguage()->load('com_workflow');
|
||||
}
|
||||
|
||||
if ($params->get('automatic_title', 0)) {
|
||||
$module->title = LatestHelper::getTitle($params);
|
||||
}
|
||||
|
||||
if (\count($list)) {
|
||||
require ModuleHelper::getLayoutPath('mod_latest', $params->get('layout', 'default'));
|
||||
} else {
|
||||
$app->getLanguage()->load('com_content');
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate_module', [
|
||||
'textPrefix' => 'COM_CONTENT',
|
||||
'icon' => 'icon-copy',
|
||||
]);
|
||||
}
|
||||
101
administrator/modules/mod_latest/mod_latest.xml
Normal file
101
administrator/modules/mod_latest/mod_latest.xml
Normal file
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_latest</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-07</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_LATEST_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Latest</namespace>
|
||||
<files>
|
||||
<filename module="mod_latest">mod_latest.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_latest.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_latest.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Articles_-_Latest" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_LATEST_FIELD_COUNT_LABEL"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="ordering"
|
||||
type="list"
|
||||
label="MOD_LATEST_FIELD_ORDERING_LABEL"
|
||||
default="c_dsc"
|
||||
validate="options"
|
||||
>
|
||||
<option value="c_dsc">MOD_LATEST_FIELD_VALUE_ORDERING_ADDED</option>
|
||||
<option value="m_dsc">MOD_LATEST_FIELD_VALUE_ORDERING_MODIFIED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
default=""
|
||||
filter="integer"
|
||||
>
|
||||
<option value="">JOPTION_ANY_CATEGORY</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="user_id"
|
||||
type="list"
|
||||
label="MOD_LATEST_FIELD_AUTHORS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">MOD_LATEST_FIELD_VALUE_AUTHORS_ANYONE</option>
|
||||
<option value="by_me">MOD_LATEST_FIELD_VALUE_AUTHORS_BY_ME</option>
|
||||
<option value="not_me">MOD_LATEST_FIELD_VALUE_AUTHORS_NOT_BY_ME</option>
|
||||
</field>
|
||||
</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>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
136
administrator/modules/mod_latest/src/Helper/LatestHelper.php
Normal file
136
administrator/modules/mod_latest/src/Helper/LatestHelper.php
Normal file
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Latest\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Categories\Categories;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Model\ArticlesModel;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_latest
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class LatestHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of articles.
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param ArticlesModel $model The model.
|
||||
*
|
||||
* @return mixed An array of articles, or false on error.
|
||||
*/
|
||||
public static function getList(Registry $params, ArticlesModel $model)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
|
||||
// Set List SELECT
|
||||
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' .
|
||||
' a.access, a.created, a.created_by, a.created_by_alias, a.featured, a.state, a.publish_up, a.publish_down');
|
||||
|
||||
// Set Ordering filter
|
||||
switch ($params->get('ordering', 'c_dsc')) {
|
||||
case 'm_dsc':
|
||||
$model->setState('list.ordering', 'a.modified DESC, a.created');
|
||||
$model->setState('list.direction', 'DESC');
|
||||
break;
|
||||
|
||||
case 'c_dsc':
|
||||
default:
|
||||
$model->setState('list.ordering', 'a.created');
|
||||
$model->setState('list.direction', 'DESC');
|
||||
break;
|
||||
}
|
||||
|
||||
// Set Category Filter
|
||||
$categoryId = $params->get('catid', null);
|
||||
|
||||
if (is_numeric($categoryId)) {
|
||||
$model->setState('filter.category_id', $categoryId);
|
||||
}
|
||||
|
||||
// Set User Filter.
|
||||
$userId = $user->get('id');
|
||||
|
||||
switch ($params->get('user_id', '0')) {
|
||||
case 'by_me':
|
||||
$model->setState('filter.author_id', $userId);
|
||||
break;
|
||||
|
||||
case 'not_me':
|
||||
$model->setState('filter.author_id', $userId);
|
||||
$model->setState('filter.author_id.include', false);
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the Start and Limit
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('list.limit', $params->get('count', 5));
|
||||
|
||||
$items = $model->getItems();
|
||||
|
||||
if ($error = $model->getError()) {
|
||||
throw new \Exception($error, 500);
|
||||
}
|
||||
|
||||
// Set the links
|
||||
foreach ($items as &$item) {
|
||||
$item->link = '';
|
||||
|
||||
if (
|
||||
$user->authorise('core.edit', 'com_content.article.' . $item->id)
|
||||
|| ($user->authorise('core.edit.own', 'com_content.article.' . $item->id) && ($userId === $item->created_by))
|
||||
) {
|
||||
$item->link = Route::_('index.php?option=com_content&task=article.edit&id=' . $item->id);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the alternate title for the module.
|
||||
*
|
||||
* @param \Joomla\Registry\Registry $params The module parameters.
|
||||
*
|
||||
* @return string The alternate title for the module.
|
||||
*/
|
||||
public static function getTitle($params)
|
||||
{
|
||||
$who = $params->get('user_id', 0);
|
||||
$catid = (int) $params->get('catid', null);
|
||||
$type = $params->get('ordering') === 'c_dsc' ? '_CREATED' : '_MODIFIED';
|
||||
$title = '';
|
||||
|
||||
if ($catid) {
|
||||
$category = Categories::getInstance('Content')->get($catid);
|
||||
$title = Text::_('MOD_POPULAR_UNEXISTING');
|
||||
|
||||
if ($category) {
|
||||
$title = $category->title;
|
||||
}
|
||||
}
|
||||
|
||||
return Text::plural(
|
||||
'MOD_LATEST_TITLE' . $type . ($catid ? '_CATEGORY' : '') . ($who != '0' ? "_$who" : ''),
|
||||
(int) $params->get('count', 5),
|
||||
$title
|
||||
);
|
||||
}
|
||||
}
|
||||
68
administrator/modules/mod_latest/tmpl/default.php
Normal file
68
administrator/modules/mod_latest/tmpl/default.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_latest
|
||||
*
|
||||
* @copyright (C) 2010 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;
|
||||
|
||||
$moduleId = str_replace(' ', '', $module->title) . $module->id;
|
||||
|
||||
?>
|
||||
<table class="table" id="<?php echo $moduleId; ?>">
|
||||
<caption class="visually-hidden"><?php echo $module->title; ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?php echo Text::_('JGLOBAL_TITLE'); ?></th>
|
||||
<?php if ($workflow_enabled) : ?>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('JSTAGE'); ?></th>
|
||||
<?php endif; ?>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('JAUTHOR'); ?></th>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('JDATE'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($list)) : ?>
|
||||
<?php foreach ($list as $i => $item) : ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.checkedout', $moduleId . $i, $item->editor, $item->checked_out_time, $module->id); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($item->link) : ?>
|
||||
<a href="<?php echo $item->link; ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<?php if ($workflow_enabled) : ?>
|
||||
<td>
|
||||
<?php echo Text::_($item->stage_title); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td>
|
||||
<?php echo $item->author_name; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo HTMLHelper::_('date', $item->created, Text::_('DATE_FORMAT_LC4')); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php echo Text::_('MOD_LATEST_NO_MATCHING_RESULTS'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -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>
|
||||
29
administrator/modules/mod_logged/mod_logged.php
Normal file
29
administrator/modules/mod_logged/mod_logged.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @copyright (C) 2005 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\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Module\Logged\Administrator\Helper\LoggedHelper;
|
||||
|
||||
if ($params->get('automatic_title', 0)) {
|
||||
$module->title = LoggedHelper::getTitle($params);
|
||||
}
|
||||
|
||||
// Check if session metadata tracking is enabled
|
||||
if ($app->get('session_metadata', true)) {
|
||||
$users = LoggedHelper::getList($params, $app, Factory::getContainer()->get(DatabaseInterface::class));
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_logged', $params->get('layout', 'default'));
|
||||
} else {
|
||||
require ModuleHelper::getLayoutPath('mod_logged', 'disabled');
|
||||
}
|
||||
79
administrator/modules/mod_logged/mod_logged.xml
Normal file
79
administrator/modules/mod_logged/mod_logged.xml
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_logged</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-01</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_LOGGED_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Logged</namespace>
|
||||
<files>
|
||||
<filename module="mod_logged">mod_logged.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_logged.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_logged.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Logged-in_Users" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_LOGGED_FIELD_COUNT_LABEL"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="name"
|
||||
type="list"
|
||||
label="MOD_LOGGED_NAME"
|
||||
default="1"
|
||||
filter="integer"
|
||||
validate="options"
|
||||
>
|
||||
<option value="1">MOD_LOGGED_NAME</option>
|
||||
<option value="0">JGLOBAL_USERNAME</option>
|
||||
</field>
|
||||
</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>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
89
administrator/modules/mod_logged/src/Helper/LoggedHelper.php
Normal file
89
administrator/modules/mod_logged/src/Helper/LoggedHelper.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Logged\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_logged
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class LoggedHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of logged users.
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param CMSApplication $app The application
|
||||
* @param DatabaseInterface $db The database
|
||||
*
|
||||
* @return mixed An array of users, or false on error.
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public static function getList(Registry $params, CMSApplication $app, DatabaseInterface $db)
|
||||
{
|
||||
$user = $app->getIdentity();
|
||||
$query = $db->getQuery(true)
|
||||
->select('s.time, s.client_id, u.id, u.name, u.username')
|
||||
->from('#__session AS s')
|
||||
->join('LEFT', '#__users AS u ON s.userid = u.id')
|
||||
->where('s.guest = 0')
|
||||
->setLimit($params->get('count', 5), 0);
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$results = $db->loadObjectList();
|
||||
} catch (\RuntimeException $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
foreach ($results as $k => $result) {
|
||||
$results[$k]->logoutLink = '';
|
||||
|
||||
if ($user->authorise('core.manage', 'com_users')) {
|
||||
$results[$k]->editLink = Route::_('index.php?option=com_users&task=user.edit&id=' . $result->id);
|
||||
$results[$k]->logoutLink = Route::_(
|
||||
'index.php?option=com_login&task=logout&uid=' . $result->id . '&' . Session::getFormToken() . '=1'
|
||||
);
|
||||
}
|
||||
|
||||
if ($params->get('name', 1) == 0) {
|
||||
$results[$k]->name = $results[$k]->username;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the alternate title for the module
|
||||
*
|
||||
* @param \Joomla\Registry\Registry $params The module parameters.
|
||||
*
|
||||
* @return string The alternate title for the module.
|
||||
*/
|
||||
public static function getTitle($params)
|
||||
{
|
||||
return Text::plural('MOD_LOGGED_TITLE', $params->get('count', 5));
|
||||
}
|
||||
}
|
||||
64
administrator/modules/mod_logged/tmpl/default.php
Normal file
64
administrator/modules/mod_logged/tmpl/default.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @copyright (C) 2007 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-50">
|
||||
<?php if ($params->get('name', 1) == 0) : ?>
|
||||
<?php echo Text::_('JGLOBAL_USERNAME'); ?>
|
||||
<?php else : ?>
|
||||
<?php echo Text::_('MOD_LOGGED_NAME'); ?>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<th scope="col" class="w-30"><?php echo Text::_('JCLIENT'); ?></th>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('JDATE'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $user) : ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php if (isset($user->editLink)) : ?>
|
||||
<a href="<?php echo $user->editLink; ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo htmlspecialchars($user->name, ENT_QUOTES, 'UTF-8'); ?>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td>
|
||||
<?php if ($user->client_id === null) : ?>
|
||||
<?php // This is a shared session so we do not know the client ?>
|
||||
<?php echo Text::_('JGLOBAL_NONAPPLICABLE'); ?>
|
||||
<?php elseif ($user->client_id) : ?>
|
||||
<?php echo Text::_('JADMINISTRATION'); ?>
|
||||
<?php else : ?>
|
||||
<form action="<?php echo $user->logoutLink; ?>" method="post" name="adminForm">
|
||||
<?php echo Text::_('JSITE'); ?>
|
||||
<button type="submit" class="me-2 btn btn-danger btn-sm">
|
||||
<?php echo Text::_('JLOGOUT'); ?>
|
||||
</button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo HTMLHelper::_('date', $user->time, Text::_('DATE_FORMAT_LC5')); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
21
administrator/modules/mod_logged/tmpl/disabled.php
Normal file
21
administrator/modules/mod_logged/tmpl/disabled.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logged
|
||||
*
|
||||
* @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\Language\Text;
|
||||
|
||||
?>
|
||||
<div class="mb-4">
|
||||
<p class="fw-bold text-center text-muted">
|
||||
<span class="icon-users" aria-hidden="true"></span>
|
||||
<?php echo Text::_('MOD_LOGGED_NO_SESSION_METADATA'); ?>
|
||||
</p>
|
||||
</div>
|
||||
21
administrator/modules/mod_login/mod_login.php
Normal file
21
administrator/modules/mod_login/mod_login.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_login
|
||||
*
|
||||
* @copyright (C) 2006 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\AuthenticationHelper;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Module\Login\Administrator\Helper\LoginHelper;
|
||||
|
||||
$langs = LoginHelper::getLanguageList();
|
||||
$extraButtons = AuthenticationHelper::getLoginButtons('form-login');
|
||||
$return = LoginHelper::getReturnUri();
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_login', $params->get('layout', 'default'));
|
||||
44
administrator/modules/mod_login/mod_login.xml
Normal file
44
administrator/modules/mod_login/mod_login.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_login</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-03</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_LOGIN_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Login</namespace>
|
||||
<files>
|
||||
<filename module="mod_login">mod_login.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_login.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_login.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Login_Form" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
78
administrator/modules/mod_login/src/Helper/LoginHelper.php
Normal file
78
administrator/modules/mod_login/src/Helper/LoginHelper.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_login
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Login\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\LanguageHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_login
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
abstract class LoginHelper
|
||||
{
|
||||
/**
|
||||
* Get an HTML select list of the available languages.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getLanguageList()
|
||||
{
|
||||
$languages = LanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true);
|
||||
|
||||
if (\count($languages) <= 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
usort(
|
||||
$languages,
|
||||
function ($a, $b) {
|
||||
return strcmp($a['value'], $b['value']);
|
||||
}
|
||||
);
|
||||
|
||||
// Fix wrongly set parentheses in RTL languages
|
||||
if (Factory::getApplication()->getLanguage()->isRtl()) {
|
||||
foreach ($languages as &$language) {
|
||||
$language['text'] .= '‎';
|
||||
}
|
||||
}
|
||||
|
||||
array_unshift($languages, HTMLHelper::_('select.option', '', Text::_('JDEFAULTLANGUAGE')));
|
||||
|
||||
return HTMLHelper::_('select.genericlist', $languages, 'lang', 'class="form-select"', 'value', 'text', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the redirect URI after login.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getReturnUri()
|
||||
{
|
||||
$uri = Uri::getInstance();
|
||||
$return = 'index.php' . $uri->toString(['query']);
|
||||
|
||||
if ($return !== 'index.php?option=com_login') {
|
||||
return base64_encode($return);
|
||||
}
|
||||
|
||||
return base64_encode('index.php');
|
||||
}
|
||||
}
|
||||
127
administrator/modules/mod_login/tmpl/default.php
Normal file
127
administrator/modules/mod_login/tmpl/default.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_login
|
||||
*
|
||||
* @copyright (C) 2010 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('keepalive')
|
||||
->useScript('field.passwordview')
|
||||
->registerAndUseScript('mod_login.admin', 'mod_login/admin-login.min.js', [], ['defer' => true], ['core', 'form.validate']);
|
||||
|
||||
Text::script('JSHOWPASSWORD');
|
||||
Text::script('JHIDEPASSWORD');
|
||||
?>
|
||||
<form class="form-validate" action="<?php echo Route::_('index.php', true); ?>" method="post" id="form-login">
|
||||
<fieldset>
|
||||
<legend class="visually-hidden"><?php echo Text::_('MOD_LOGIN'); ?></legend>
|
||||
<div class="form-group">
|
||||
<label for="mod-login-username">
|
||||
<?php echo Text::_('JGLOBAL_USERNAME'); ?>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
|
||||
<input
|
||||
name="username"
|
||||
id="mod-login-username"
|
||||
type="text"
|
||||
class="form-control"
|
||||
required="required"
|
||||
autofocus
|
||||
autocomplete="username"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mod-login-password">
|
||||
<?php echo Text::_('JGLOBAL_PASSWORD'); ?>
|
||||
</label>
|
||||
<div class="input-group">
|
||||
|
||||
<input
|
||||
name="passwd"
|
||||
id="mod-login-password"
|
||||
type="password"
|
||||
class="form-control input-full"
|
||||
required="required"
|
||||
autocomplete="current-password"
|
||||
>
|
||||
<button type="button" class="btn btn-primary input-password-toggle">
|
||||
<span class="icon-eye icon-fw" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::_('JSHOWPASSWORD'); ?></span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
<?php if (!empty($langs)) : ?>
|
||||
<div class="form-group">
|
||||
<label for="lang">
|
||||
<?php echo Text::_('MOD_LOGIN_LANGUAGE'); ?>
|
||||
</label>
|
||||
<?php echo $langs; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($extraButtons as $button) :
|
||||
$dataAttributeKeys = array_filter(array_keys($button), function ($key) {
|
||||
return substr($key, 0, 5) == 'data-';
|
||||
});
|
||||
?>
|
||||
<div class="form-group">
|
||||
<button type="button"
|
||||
class="btn btn-secondary w-100 <?php echo $button['class'] ?? '' ?>"
|
||||
<?php foreach ($dataAttributeKeys as $key) : ?>
|
||||
<?php echo $key ?>="<?php echo $button[$key] ?>"
|
||||
<?php endforeach; ?>
|
||||
<?php if ($button['onclick']) : ?>
|
||||
onclick="<?php echo $button['onclick'] ?>"
|
||||
<?php endif; ?>
|
||||
title="<?php echo Text::_($button['label']) ?>"
|
||||
id="<?php echo $button['id'] ?>"
|
||||
>
|
||||
<?php if (!empty($button['icon'])) : ?>
|
||||
<span class="<?php echo $button['icon'] ?>"></span>
|
||||
<?php elseif (!empty($button['image'])) : ?>
|
||||
<?php echo $button['image']; ?>
|
||||
<?php elseif (!empty($button['svg'])) : ?>
|
||||
<?php echo $button['svg']; ?>
|
||||
<?php endif; ?>
|
||||
<?php echo Text::_($button['label']) ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="form-group">
|
||||
<button type="submit" id="btn-login-submit" class="btn btn-primary w-100 btn-lg"><?php echo Text::_('JLOGIN'); ?></button>
|
||||
</div>
|
||||
<input type="hidden" name="option" value="com_login">
|
||||
<input type="hidden" name="task" value="login">
|
||||
<input type="hidden" name="return" value="<?php echo $return; ?>">
|
||||
<?php echo HTMLHelper::_('form.token'); ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="text-center">
|
||||
<div>
|
||||
<?php echo HTMLHelper::link(
|
||||
Text::_('MOD_LOGIN_CREDENTIALS_LINK'),
|
||||
Text::_('MOD_LOGIN_CREDENTIALS'),
|
||||
[
|
||||
'target' => '_blank',
|
||||
'rel' => 'noopener nofollow',
|
||||
'title' => Text::sprintf('JBROWSERTARGET_NEW_TITLE', Text::_('MOD_LOGIN_CREDENTIALS'))
|
||||
]
|
||||
); ?>
|
||||
</div>
|
||||
</div>
|
||||
20
administrator/modules/mod_loginsupport/mod_loginsupport.php
Normal file
20
administrator/modules/mod_loginsupport/mod_loginsupport.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_logsupport
|
||||
*
|
||||
* @copyright (C) 2019 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\CMS\Language\Text;
|
||||
|
||||
if ($params->get('automatic_title')) {
|
||||
$module->title = Text::_('MOD_LOGINSUPPORT_TITLE');
|
||||
}
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_loginsupport', $params->get('layout', 'default'));
|
||||
110
administrator/modules/mod_loginsupport/mod_loginsupport.xml
Normal file
110
administrator/modules/mod_loginsupport/mod_loginsupport.xml
Normal file
@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_loginsupport</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-06</creationDate>
|
||||
<copyright>(C) 2019 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>4.0.0</version>
|
||||
<description>MOD_LOGINSUPPORT_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Loginsupport</namespace>
|
||||
<files>
|
||||
<filename module="mod_loginsupport">mod_loginsupport.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_loginsupport.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_loginsupport.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Login_Support_Information" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="forum_url"
|
||||
type="url"
|
||||
label="MOD_LOGINSUPPORT_FIELD_FORUM_URL_LABEL"
|
||||
filter="url"
|
||||
default="https://forum.joomla.org/"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="documentation_url"
|
||||
type="url"
|
||||
label="MOD_LOGINSUPPORT_FIELD_DOCUMENTATION_URL_LABEL"
|
||||
filter="url"
|
||||
default="https://docs.joomla.org/"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="news_url"
|
||||
type="url"
|
||||
label="MOD_LOGINSUPPORT_FIELD_NEWS_URL_LABEL"
|
||||
filter="url"
|
||||
default="https://www.joomla.org/announcements.html"
|
||||
/>
|
||||
</fieldset>
|
||||
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<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="1"
|
||||
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="0"
|
||||
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="0"
|
||||
filter="integer"
|
||||
min="0"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="cachemode"
|
||||
type="hidden"
|
||||
default="itemid"
|
||||
>
|
||||
<option value="itemid"></option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
54
administrator/modules/mod_loginsupport/tmpl/default.php
Normal file
54
administrator/modules/mod_loginsupport/tmpl/default.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_loginsupport
|
||||
*
|
||||
* @copyright (C) 2019 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;
|
||||
|
||||
?>
|
||||
<section class="loginsupport">
|
||||
<p><?php echo Text::_('MOD_LOGINSUPPORT_HEADLINE'); ?></p>
|
||||
<ul class="list-unstyled">
|
||||
<li>
|
||||
<?php echo HTMLHelper::link(
|
||||
$params->get('forum_url'),
|
||||
Text::_('MOD_LOGINSUPPORT_FORUM'),
|
||||
[
|
||||
'target' => '_blank',
|
||||
'rel' => 'nofollow noopener',
|
||||
'title' => Text::sprintf('JBROWSERTARGET_NEW_TITLE', Text::_('MOD_LOGINSUPPORT_FORUM'))
|
||||
]
|
||||
); ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo HTMLHelper::link(
|
||||
$params->get('documentation_url'),
|
||||
Text::_('MOD_LOGINSUPPORT_DOCUMENTATION'),
|
||||
[
|
||||
'target' => '_blank',
|
||||
'rel' => 'nofollow noopener',
|
||||
'title' => Text::sprintf('JBROWSERTARGET_NEW_TITLE', Text::_('MOD_LOGINSUPPORT_DOCUMENTATION'))
|
||||
]
|
||||
); ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo HTMLHelper::link(
|
||||
$params->get('news_url'),
|
||||
Text::_('MOD_LOGINSUPPORT_NEWS'),
|
||||
[
|
||||
'target' => '_blank',
|
||||
'rel' => 'nofollow noopener',
|
||||
'title' => Text::sprintf('JBROWSERTARGET_NEW_TITLE', Text::_('MOD_LOGINSUPPORT_NEWS'))
|
||||
]
|
||||
); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
23
administrator/modules/mod_menu/mod_menu.php
Normal file
23
administrator/modules/mod_menu/mod_menu.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_menu
|
||||
*
|
||||
* @copyright (C) 2006 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\Menu\Administrator\Menu\CssMenu;
|
||||
|
||||
$enabled = !$app->getInput()->getBool('hidemainmenu');
|
||||
|
||||
$menu = new CssMenu($app);
|
||||
$root = $menu->load($params, $enabled);
|
||||
$root->level = 0;
|
||||
|
||||
// Render the module layout
|
||||
require ModuleHelper::getLayoutPath('mod_menu', $params->get('layout', 'default'));
|
||||
115
administrator/modules/mod_menu/mod_menu.xml
Normal file
115
administrator/modules/mod_menu/mod_menu.xml
Normal file
@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_menu</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2006-03</creationDate>
|
||||
<copyright>(C) 2006 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.0.0</version>
|
||||
<description>MOD_MENU_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Menu</namespace>
|
||||
<files>
|
||||
<filename module="mod_menu">mod_menu.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_menu.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_menu.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Administrator_Menu" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldprefix="Joomla\Component\Menus\Administrator\Field">
|
||||
<field
|
||||
name="menutype"
|
||||
type="menu"
|
||||
label="MOD_MENU_FIELD_MENUTYPE_LABEL"
|
||||
clientid="1"
|
||||
>
|
||||
<option value="*">MOD_MENU_FIELD_MENUTYPE_OPTION_PREDEFINED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="preset"
|
||||
type="menuPreset"
|
||||
default="default"
|
||||
label="MOD_MENU_FIELD_PRESET_LABEL"
|
||||
description="MOD_MENU_FIELD_PRESET_DESC"
|
||||
showon="menutype:*"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="check"
|
||||
type="radio"
|
||||
label="MOD_MENU_FIELD_CHECK_LABEL"
|
||||
description="MOD_MENU_FIELD_CHECK_DESC"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="menutype!:*"
|
||||
>
|
||||
<option value="0">JNO</option>
|
||||
<option value="1">JYES</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="shownew"
|
||||
type="radio"
|
||||
label="MOD_MENU_FIELD_SHOWNEW"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="menutype:*"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="showhelp"
|
||||
type="radio"
|
||||
label="MOD_MENU_FIELD_SHOWHELP"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="1"
|
||||
filter="integer"
|
||||
showon="menutype:*"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="forum_url"
|
||||
type="url"
|
||||
label="MOD_MENU_FIELD_FORUMURL_LABEL"
|
||||
description="MOD_MENU_FIELD_FORUMURL_DESC"
|
||||
filter="url"
|
||||
default=""
|
||||
showon="menutype:*"
|
||||
validate="url"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
533
administrator/modules/mod_menu/src/Menu/CssMenu.php
Normal file
533
administrator/modules/mod_menu/src/Menu/CssMenu.php
Normal file
@ -0,0 +1,533 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_menu
|
||||
*
|
||||
* @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Menu\Administrator\Menu;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Event\Menu\PreprocessMenuItemsEvent;
|
||||
use Joomla\CMS\Language\Associations;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Menu\AdministratorMenuItem;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
|
||||
use Joomla\Registry\Registry;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Tree based class to render the admin menu
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
class CssMenu
|
||||
{
|
||||
/**
|
||||
* The root of the menu
|
||||
*
|
||||
* @var AdministratorMenuItem
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $root;
|
||||
|
||||
/**
|
||||
* An array of AdministratorMenuItem nodes
|
||||
*
|
||||
* @var AdministratorMenuItem[]
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $nodes = [];
|
||||
|
||||
/**
|
||||
* The module options
|
||||
*
|
||||
* @var Registry
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
protected $params;
|
||||
|
||||
/**
|
||||
* The menu bar state
|
||||
*
|
||||
* @var boolean
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
protected $enabled;
|
||||
|
||||
/**
|
||||
* The application
|
||||
*
|
||||
* @var CMSApplication
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $application;
|
||||
|
||||
/**
|
||||
* A counter for unique IDs
|
||||
*
|
||||
* @var integer
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected $counter = 0;
|
||||
|
||||
/**
|
||||
* CssMenu constructor.
|
||||
*
|
||||
* @param CMSApplication $application The application
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function __construct(CMSApplication $application)
|
||||
{
|
||||
$this->application = $application;
|
||||
$this->root = new AdministratorMenuItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the menu items in the menu tree object
|
||||
*
|
||||
* @param Registry $params Menu configuration parameters
|
||||
* @param bool $enabled Whether the menu should be enabled or disabled
|
||||
*
|
||||
* @return AdministratorMenuItem Root node of the menu tree
|
||||
*
|
||||
* @since 3.7.0
|
||||
*/
|
||||
public function load($params, $enabled)
|
||||
{
|
||||
$this->params = $params;
|
||||
$this->enabled = $enabled;
|
||||
$menutype = $this->params->get('menutype', '*');
|
||||
|
||||
if ($menutype === '*') {
|
||||
$name = $this->params->get('preset', 'default');
|
||||
$this->root = MenusHelper::loadPreset($name);
|
||||
} else {
|
||||
$this->root = MenusHelper::getMenuItems($menutype, true);
|
||||
|
||||
// Can we access everything important with this menu? Create a recovery menu!
|
||||
if (
|
||||
$this->enabled
|
||||
&& $this->params->get('check', 1)
|
||||
&& $this->check($this->root, $this->params)
|
||||
) {
|
||||
$this->params->set('recovery', true);
|
||||
|
||||
// In recovery mode, load the preset inside a special root node.
|
||||
$this->root = new AdministratorMenuItem(['level' => 0]);
|
||||
$heading = new AdministratorMenuItem(['title' => 'MOD_MENU_RECOVERY_MENU_ROOT', 'type' => 'heading']);
|
||||
$this->root->addChild($heading);
|
||||
|
||||
MenusHelper::loadPreset('default', true, $heading);
|
||||
|
||||
$this->preprocess($this->root);
|
||||
|
||||
$this->root->addChild(new AdministratorMenuItem(['type' => 'separator']));
|
||||
|
||||
// Add link to exit recovery mode
|
||||
$uri = clone Uri::getInstance();
|
||||
$uri->setVar('recover_menu', 0);
|
||||
|
||||
$this->root->addChild(new AdministratorMenuItem(['title' => 'MOD_MENU_RECOVERY_EXIT', 'type' => 'url', 'link' => $uri->toString()]));
|
||||
|
||||
return $this->root;
|
||||
}
|
||||
}
|
||||
|
||||
$this->preprocess($this->root);
|
||||
|
||||
return $this->root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to render a given level of a menu using provided layout file
|
||||
*
|
||||
* @param string $layoutFile The layout file to be used to render
|
||||
* @param AdministratorMenuItem $node Node to render the children of
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
public function renderSubmenu($layoutFile, $node)
|
||||
{
|
||||
if (is_file($layoutFile)) {
|
||||
$children = $node->getChildren();
|
||||
|
||||
foreach ($children as $current) {
|
||||
$current->level = $node->level + 1;
|
||||
|
||||
// This sets the scope to this object for the layout file and also isolates other `include`s
|
||||
require $layoutFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the flat list of menu items for important links
|
||||
*
|
||||
* @param AdministratorMenuItem $node The menu items array
|
||||
* @param Registry $params Module options
|
||||
*
|
||||
* @return boolean Whether to show recovery menu
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
protected function check($node, Registry $params)
|
||||
{
|
||||
$me = $this->application->getIdentity();
|
||||
$authMenus = $me->authorise('core.manage', 'com_menus');
|
||||
$authModules = $me->authorise('core.manage', 'com_modules');
|
||||
|
||||
if (!$authMenus && !$authModules) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$items = $node->getChildren(true);
|
||||
$types = array_column($items, 'type');
|
||||
$elements = array_column($items, 'element');
|
||||
$rMenu = $authMenus && !\in_array('com_menus', $elements);
|
||||
$rModule = $authModules && !\in_array('com_modules', $elements);
|
||||
$rContainer = !\in_array('container', $types);
|
||||
|
||||
if ($rMenu || $rModule || $rContainer) {
|
||||
$recovery = $this->application->getUserStateFromRequest('mod_menu.recovery', 'recover_menu', 0, 'int');
|
||||
|
||||
if ($recovery) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$missing = [];
|
||||
|
||||
if ($rMenu) {
|
||||
$missing[] = Text::_('MOD_MENU_IMPORTANT_ITEM_MENU_MANAGER');
|
||||
}
|
||||
|
||||
if ($rModule) {
|
||||
$missing[] = Text::_('MOD_MENU_IMPORTANT_ITEM_MODULE_MANAGER');
|
||||
}
|
||||
|
||||
if ($rContainer) {
|
||||
$missing[] = Text::_('MOD_MENU_IMPORTANT_ITEM_COMPONENTS_CONTAINER');
|
||||
}
|
||||
|
||||
$uri = clone Uri::getInstance();
|
||||
$uri->setVar('recover_menu', 1);
|
||||
|
||||
$table = Table::getInstance('MenuType');
|
||||
$menutype = $params->get('menutype');
|
||||
|
||||
$table->load(['menutype' => $menutype]);
|
||||
|
||||
$menutype = $table->get('title', $menutype);
|
||||
$message = Text::sprintf('MOD_MENU_IMPORTANT_ITEMS_INACCESSIBLE_LIST_WARNING', $menutype, implode(', ', $missing), $uri);
|
||||
|
||||
$this->application->enqueueMessage($message, 'warning');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter and perform other preparatory tasks for loaded menu items based on access rights and module configurations for display
|
||||
*
|
||||
* @param AdministratorMenuItem $parent A menu item to process
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
protected function preprocess($parent)
|
||||
{
|
||||
$user = $this->application->getIdentity();
|
||||
$language = $this->application->getLanguage();
|
||||
$dispatcher = $this->application->getDispatcher();
|
||||
|
||||
$noSeparator = true;
|
||||
$children = $parent->getChildren();
|
||||
|
||||
/**
|
||||
* Trigger onPreprocessMenuItems for the current level of backend menu items.
|
||||
* $children is an array of AdministratorMenuItem objects. A plugin can traverse the whole tree,
|
||||
* but new nodes will only be run through this method if their parents have not been processed yet.
|
||||
*/
|
||||
$children = $dispatcher->dispatch('onPreprocessMenuItems', new PreprocessMenuItemsEvent('onPreprocessMenuItems', [
|
||||
'context' => 'com_menus.administrator.module',
|
||||
'subject' => &$children, // @todo: Remove reference in Joomla 6, see PreprocessMenuItemsEvent::__constructor()
|
||||
'params' => $this->params,
|
||||
'enabled' => $this->enabled,
|
||||
]))->getArgument('subject', $children);
|
||||
|
||||
foreach ($children as $item) {
|
||||
$itemParams = $item->getParams();
|
||||
|
||||
// Exclude item with menu item option set to exclude from menu modules
|
||||
if ($itemParams->get('menu_show', 1) == 0) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
$item->scope = $item->scope ?? 'default';
|
||||
$item->icon = $item->icon ?? '';
|
||||
|
||||
// Whether this scope can be displayed. Applies only to preset items. Db driven items should use un/published state.
|
||||
if (($item->scope === 'help' && $this->params->get('showhelp', 1) == 0) || ($item->scope === 'edit' && !$this->params->get('shownew', 1))) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (substr($item->link, 0, 8) === 'special:') {
|
||||
$special = substr($item->link, 8);
|
||||
|
||||
if ($special === 'language-forum') {
|
||||
$item->link = 'index.php?option=com_admin&view=help&layout=langforum';
|
||||
} elseif ($special === 'custom-forum') {
|
||||
$item->link = $this->params->get('forum_url');
|
||||
}
|
||||
}
|
||||
|
||||
$uri = new Uri($item->link);
|
||||
$query = $uri->getQuery(true);
|
||||
|
||||
/**
|
||||
* If component is passed in the link via option variable, we set $item->element to this value for further
|
||||
* processing. It is needed for links from menu items of third party extensions link to Joomla! core
|
||||
* components like com_categories, com_fields...
|
||||
*/
|
||||
if ($option = $uri->getVar('option')) {
|
||||
$item->element = $option;
|
||||
}
|
||||
|
||||
// Exclude item if is not enabled
|
||||
if ($item->element && !ComponentHelper::isEnabled($item->element)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Multilingual Associations if the site is not set as multilingual and/or Associations is not enabled in
|
||||
* the Language Filter plugin
|
||||
*/
|
||||
|
||||
if ($item->element === 'com_associations' && !Associations::isEnabled()) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Exclude Mass Mail if disabled in global configuration
|
||||
if ($item->scope === 'massmail' && ($this->application->get('mailonline', 1) == 0 || $this->application->get('massmailoff', 0) == 1)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Exclude item if the component is not authorised
|
||||
$assetName = $item->element;
|
||||
|
||||
if ($item->element === 'com_categories') {
|
||||
$assetName = $query['extension'] ?? 'com_content';
|
||||
} elseif ($item->element === 'com_fields') {
|
||||
// Only display Fields menus when enabled in the component
|
||||
$createFields = null;
|
||||
|
||||
if (isset($query['context'])) {
|
||||
$createFields = ComponentHelper::getParams(strstr($query['context'], '.', true))->get('custom_fields_enable', 1);
|
||||
}
|
||||
|
||||
if (!$createFields) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
list($assetName) = isset($query['context']) ? explode('.', $query['context'], 2) : ['com_fields'];
|
||||
} elseif ($item->element === 'com_cpanel' && $item->link === 'index.php') {
|
||||
continue;
|
||||
} elseif (
|
||||
$item->link === 'index.php?option=com_cpanel&view=help'
|
||||
|| $item->link === 'index.php?option=com_cpanel&view=cpanel&dashboard=help'
|
||||
) {
|
||||
if ($this->params->get('showhelp', 1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Exclude help menu item if set such in mod_menu
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
} elseif ($item->element === 'com_workflow') {
|
||||
// Only display Workflow menus when enabled in the component
|
||||
$workflow = null;
|
||||
|
||||
if (isset($query['extension'])) {
|
||||
$parts = explode('.', $query['extension']);
|
||||
|
||||
$workflow = ComponentHelper::getParams($parts[0])->get('workflow_enabled') && $user->authorise('core.manage.workflow', $parts[0]);
|
||||
}
|
||||
|
||||
if (!$workflow) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
list($assetName) = isset($query['extension']) ? explode('.', $query['extension'], 2) : ['com_workflow'];
|
||||
} elseif (\in_array($item->element, ['com_config', 'com_privacy', 'com_actionlogs'], true) && !$user->authorise('core.admin')) {
|
||||
// Special case for components which only allow super user access
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
} elseif ($item->element === 'com_joomlaupdate' && !$user->authorise('core.admin')) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
} elseif (
|
||||
($item->link === 'index.php?option=com_installer&view=install' || $item->link === 'index.php?option=com_installer&view=languages')
|
||||
&& !$user->authorise('core.admin')
|
||||
) {
|
||||
continue;
|
||||
} elseif ($item->element === 'com_admin') {
|
||||
if (isset($query['view']) && $query['view'] === 'sysinfo' && !$user->authorise('core.admin')) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
} elseif ($item->link === 'index.php?option=com_messages&view=messages' && !$user->authorise('core.manage', 'com_users')) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($assetName && !$user->authorise(($item->scope === 'edit') ? 'core.create' : 'core.manage', $assetName)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Exclude if link is invalid
|
||||
if (\is_null($item->link) || !\in_array($item->type, ['separator', 'heading', 'container']) && trim($item->link) === '') {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Process any children if exists
|
||||
if ($item->hasChildren()) {
|
||||
$this->preprocess($item);
|
||||
}
|
||||
|
||||
// Populate automatic children for container items
|
||||
if ($item->type === 'container') {
|
||||
$exclude = (array) $itemParams->get('hideitems') ?: [];
|
||||
$components = MenusHelper::getMenuItems('main', false, $exclude);
|
||||
|
||||
// We are adding the nodes first to preprocess them, then sort them and add them again.
|
||||
foreach ($components->getChildren() as $c) {
|
||||
$item->addChild($c);
|
||||
}
|
||||
|
||||
$this->preprocess($item);
|
||||
$children = ArrayHelper::sortObjects($item->getChildren(), 'text', 1, false, true);
|
||||
|
||||
foreach ($children as $c) {
|
||||
$item->addChild($c);
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude if there are no child items under heading or container
|
||||
if (\in_array($item->type, ['heading', 'container']) && !$item->hasChildren() && empty($item->components)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove repeated and edge positioned separators, It is important to put this check at the end of any logical filtering.
|
||||
if ($item->type === 'separator') {
|
||||
if ($noSeparator) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
$noSeparator = true;
|
||||
} else {
|
||||
$noSeparator = false;
|
||||
}
|
||||
|
||||
// Ok we passed everything, load language at last only
|
||||
if ($item->element) {
|
||||
$language->load($item->element . '.sys', JPATH_ADMINISTRATOR) ||
|
||||
$language->load($item->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $item->element);
|
||||
}
|
||||
|
||||
if ($item->type === 'separator' && $itemParams->get('text_separator') == 0) {
|
||||
$item->title = '';
|
||||
}
|
||||
|
||||
$item->text = Text::_($item->title);
|
||||
}
|
||||
|
||||
// If last one was a separator remove it too.
|
||||
$last = end($parent->getChildren());
|
||||
|
||||
if ($last && $last->type === 'separator' && $last->getSibling(false) && $last->getSibling(false)->type === 'separator') {
|
||||
$parent->removeChild($last);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the CSS class name for an icon identifier or create one if
|
||||
* a custom image path is passed as the identifier
|
||||
*
|
||||
* @param AdministratorMenuItem $node Node to get icon data from
|
||||
*
|
||||
* @return string CSS class name
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
public function getIconClass($node)
|
||||
{
|
||||
$identifier = $node->class;
|
||||
|
||||
// Top level is special
|
||||
if (trim($identifier) == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
// We were passed a class name
|
||||
if (substr($identifier, 0, 6) == 'class:') {
|
||||
$class = substr($identifier, 6);
|
||||
} else {
|
||||
// We were passed background icon url. Build the CSS class for the icon
|
||||
if ($identifier == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$class = preg_replace('#\.[^.]*$#', '', basename($identifier));
|
||||
$class = preg_replace('#\.\.[^A-Za-z0-9\.\_\- ]#', '', $class);
|
||||
}
|
||||
|
||||
$html = 'icon-' . $class . ' icon-fw';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create unique identifier
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function getCounter()
|
||||
{
|
||||
$this->counter++;
|
||||
|
||||
return $this->counter;
|
||||
}
|
||||
}
|
||||
35
administrator/modules/mod_menu/tmpl/default.php
Normal file
35
administrator/modules/mod_menu/tmpl/default.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_menu
|
||||
*
|
||||
* @copyright (C) 2009 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\CMS\Language\Text;
|
||||
|
||||
$doc = $app->getDocument();
|
||||
$class = $enabled ? 'nav flex-column main-nav' : 'nav flex-column main-nav disabled';
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $doc->getWebAssetManager();
|
||||
$wa->getRegistry()->addExtensionRegistryFile('com_cpanel');
|
||||
$wa->useScript('metismenujs')
|
||||
->registerAndUseScript('mod_menu.admin-menu', 'mod_menu/admin-menu.min.js', [], ['defer' => true], ['metismenujs'])
|
||||
->useScript('com_cpanel.admin-system-loader');
|
||||
|
||||
// Recurse through children of root node if they exist
|
||||
if ($root->hasChildren()) {
|
||||
echo '<nav class="main-nav-container" aria-label="' . Text::_('MOD_MENU_ARIA_MAIN_MENU') . '">';
|
||||
echo '<ul id="menu' . $module->id . '" class="' . $class . '">' . "\n";
|
||||
|
||||
// WARNING: Do not use direct 'include' or 'require' as it is important to isolate the scope for each call
|
||||
$menu->renderSubmenu(ModuleHelper::getLayoutPath('mod_menu', 'default_submenu'), $root);
|
||||
|
||||
echo "</ul></nav>\n";
|
||||
}
|
||||
184
administrator/modules/mod_menu/tmpl/default_submenu.php
Normal file
184
administrator/modules/mod_menu/tmpl/default_submenu.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_menu
|
||||
*
|
||||
* @copyright (C) 2017 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
/**
|
||||
* =========================================================================================================
|
||||
* IMPORTANT: The scope of this layout file is the `var \Joomla\Module\Menu\Administrator\Menu\CssMenu` object
|
||||
* and NOT the module context.
|
||||
* =========================================================================================================
|
||||
*/
|
||||
/** @var \Joomla\Module\Menu\Administrator\Menu\CssMenu $this */
|
||||
$class = 'item';
|
||||
$currentParams = $current->getParams();
|
||||
|
||||
// Build the CSS class suffix
|
||||
if (!$this->enabled) {
|
||||
$class .= ' disabled';
|
||||
} elseif ($current->type == 'separator') {
|
||||
$class = $current->title ? 'menuitem-group' : 'divider';
|
||||
} elseif ($current->hasChildren()) {
|
||||
$class .= ' parent';
|
||||
}
|
||||
|
||||
if ($current->level == 1) {
|
||||
$class .= ' item-level-1';
|
||||
} elseif ($current->level == 2) {
|
||||
$class .= ' item-level-2';
|
||||
} elseif ($current->level == 3) {
|
||||
$class .= ' item-level-3';
|
||||
}
|
||||
|
||||
// Set the correct aria role and print the item
|
||||
if ($current->type == 'separator') {
|
||||
echo '<li class="' . $class . '" role="presentation">';
|
||||
} else {
|
||||
echo '<li class="' . $class . '">';
|
||||
}
|
||||
|
||||
// Print a link if it exists
|
||||
$linkClass = [];
|
||||
$dataToggle = '';
|
||||
$iconClass = '';
|
||||
$itemIconClass = '';
|
||||
$itemImage = '';
|
||||
|
||||
if ($current->hasChildren()) {
|
||||
$linkClass[] = 'has-arrow';
|
||||
|
||||
if ($current->level > 2) {
|
||||
$dataToggle = ' data-bs-toggle="dropdown"';
|
||||
}
|
||||
} else {
|
||||
$linkClass[] = 'no-dropdown';
|
||||
}
|
||||
|
||||
// Implode out $linkClass for rendering
|
||||
$linkClass = ' class="' . implode(' ', $linkClass) . '" ';
|
||||
|
||||
// Get the menu link
|
||||
$link = $current->link;
|
||||
|
||||
// Get the menu image class
|
||||
$itemIconClass = $currentParams->get('menu_icon');
|
||||
|
||||
// Get the menu image
|
||||
$itemImage = $currentParams->get('menu_image');
|
||||
|
||||
// Get the menu icon
|
||||
$icon = $this->getIconClass($current);
|
||||
$iconClass = ($icon != '' && $current->level == 1) ? '<span class="' . $icon . '" aria-hidden="true"></span>' : '';
|
||||
$ajax = !empty($current->ajaxbadge) ? '<span class="menu-badge"><span class="icon-spin icon-spinner mt-1 system-counter" data-url="' . $current->ajaxbadge . '"></span></span>' : '';
|
||||
$iconImage = $current->icon;
|
||||
$homeImage = '';
|
||||
|
||||
if ($iconClass === '' && $itemIconClass) {
|
||||
$iconClass = '<span class="' . $itemIconClass . '" aria-hidden="true"></span>';
|
||||
}
|
||||
|
||||
if ($iconImage) {
|
||||
if (substr($iconImage, 0, 6) == 'class:' && substr($iconImage, 6) == 'icon-home') {
|
||||
$iconImage = '<span class="home-image icon-home" aria-hidden="true"></span>';
|
||||
$iconImage .= '<span class="visually-hidden">' . Text::_('JDEFAULT') . '</span>';
|
||||
} elseif (substr($iconImage, 0, 6) == 'image:') {
|
||||
$iconImage = ' <span class="badge">' . substr($iconImage, 6) . '</span>';
|
||||
} else {
|
||||
$iconImage = '';
|
||||
}
|
||||
}
|
||||
|
||||
$itemImage = (empty($itemIconClass) && $itemImage) ? ' <img src="' . Uri::root() . $itemImage . '" alt=""> ' : '';
|
||||
|
||||
// If the item image is not set, the item title would not have margin. Here we add it.
|
||||
if ($icon == '' && $iconClass == '' && $current->level == 1 && $current->target == '') {
|
||||
$iconClass = '<span aria-hidden="true" class="icon-fw"></span>';
|
||||
}
|
||||
|
||||
if ($link != '' && $current->target != '') {
|
||||
echo '<a' . $linkClass . $dataToggle . ' href="' . $link . '" target="' . $current->target . '">'
|
||||
. $iconClass
|
||||
. '<span class="sidebar-item-title">' . $itemImage . Text::_($current->title) . '</span>' . $ajax . '</a>';
|
||||
} elseif ($link != '' && $current->type !== 'separator') {
|
||||
echo '<a' . $linkClass . $dataToggle . ' href="' . $link . '" aria-label="' . Text::_($current->title) . '">'
|
||||
. $iconClass
|
||||
. '<span class="sidebar-item-title">' . $itemImage . Text::_($current->title) . '</span>' . $iconImage . '</a>';
|
||||
} elseif ($current->title != '' && $current->type !== 'separator') {
|
||||
echo '<a' . $linkClass . $dataToggle . ' href="#">'
|
||||
. $iconClass
|
||||
. '<span class="sidebar-item-title">' . $itemImage . Text::_($current->title) . '</span>' . $ajax . '</a>';
|
||||
} elseif ($current->title != '' && $current->type === 'separator') {
|
||||
echo '<span class="sidebar-item-title">' . Text::_($current->title) . '</span>' . $ajax;
|
||||
} else {
|
||||
echo '<span>' . Text::_($current->title) . '</span>' . $ajax;
|
||||
}
|
||||
|
||||
if ($currentParams->get('menu-quicktask') && (int) $this->params->get('shownew', 1) === 1) {
|
||||
$params = $current->getParams();
|
||||
$user = $this->application->getIdentity();
|
||||
$link = $params->get('menu-quicktask');
|
||||
$icon = $params->get('menu-quicktask-icon', 'plus');
|
||||
$title = $params->get('menu-quicktask-title', 'MOD_MENU_QUICKTASK_NEW');
|
||||
$permission = $params->get('menu-quicktask-permission');
|
||||
$scope = $current->scope !== 'default' ? $current->scope : null;
|
||||
|
||||
if (!$permission || $user->authorise($permission, $scope)) {
|
||||
echo '<span class="menu-quicktask"><a href="' . $link . '">';
|
||||
echo '<span class="icon-' . $icon . '" title="' . htmlentities(Text::_($title)) . '" aria-hidden="true"></span>';
|
||||
echo '<span class="visually-hidden">' . Text::_($title) . '</span>';
|
||||
echo '</a></span>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($current->dashboard)) {
|
||||
$titleDashboard = Text::sprintf('MOD_MENU_DASHBOARD_LINK', Text::_($current->title));
|
||||
|
||||
// Prepare the Dashboard icon. We use our own icon, not Fontawesome
|
||||
$pathDashboard = 'media/templates/administrator/atum/images/icons/dashboard.svg';
|
||||
$attrDashboard = [
|
||||
'loading' => 'eager',
|
||||
'decoding' => 'async',
|
||||
'aria-hidden' => 'true',
|
||||
'class' => 'atum-dashboard',
|
||||
'height' => '18',
|
||||
];
|
||||
|
||||
$iconDashboard = HTMLHelper::_('image', $pathDashboard, '', $attrDashboard, false, 0);
|
||||
|
||||
echo '<span class="menu-dashboard"><a href="'
|
||||
. Route::_('index.php?option=com_cpanel&view=cpanel&dashboard=' . $current->dashboard) . '" '
|
||||
. 'title="' . $titleDashboard . '">'
|
||||
. '<span>' . $iconDashboard . '</span>'
|
||||
. '<span class="visually-hidden">' . $titleDashboard . '</span>'
|
||||
. '</a></span>';
|
||||
}
|
||||
|
||||
// Recurse through children if they exist
|
||||
if ($this->enabled && $current->hasChildren()) {
|
||||
if ($current->level > 1) {
|
||||
$id = $current->id ? ' id="menu-' . strtolower($current->id) . '"' : '';
|
||||
|
||||
echo '<ul' . $id . ' class="mm-collapse collapse-level-' . $current->level . '">' . "\n";
|
||||
} else {
|
||||
echo '<ul id="collapse' . $this->getCounter() . '" class="collapse-level-1 mm-collapse">' . "\n";
|
||||
}
|
||||
|
||||
// WARNING: Do not use direct 'include' or 'require' as it is important to isolate the scope for each call
|
||||
$this->renderSubmenu(__FILE__, $current);
|
||||
|
||||
echo "</ul>\n";
|
||||
}
|
||||
|
||||
echo "</li>\n";
|
||||
36
administrator/modules/mod_messages/mod_messages.php
Normal file
36
administrator/modules/mod_messages/mod_messages.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_messages
|
||||
*
|
||||
* @copyright (C) 2019 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;
|
||||
|
||||
// Check permissions.
|
||||
if (!$app->getIdentity()->authorise('core.login.admin') || !$app->getIdentity()->authorise('core.manage', 'com_messages')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get the items from the messages model
|
||||
try {
|
||||
/** @var \Joomla\Component\Messages\Administrator\Model\MessagesModel $messagesModel */
|
||||
$messagesModel = $app->bootComponent('com_messages')->getMVCFactory()
|
||||
->createModel('Messages', 'Administrator', ['ignore_request' => true]);
|
||||
$messagesModel->setState('filter.state', 0);
|
||||
$messages = $messagesModel->getItems();
|
||||
} catch (RuntimeException $e) {
|
||||
$messages = [];
|
||||
|
||||
// Still render the error message from the Exception object
|
||||
$app->enqueueMessage($e->getMessage(), 'error');
|
||||
}
|
||||
|
||||
$countUnread = \count($messages);
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_messages', $params->get('layout', 'default'));
|
||||
41
administrator/modules/mod_messages/mod_messages.xml
Normal file
41
administrator/modules/mod_messages/mod_messages.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_messages</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-07</creationDate>
|
||||
<copyright>(C) 2019 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>4.0.0</version>
|
||||
<description>MOD_MESSAGES_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_messages">mod_messages.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_messages.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_messages.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Messages" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
34
administrator/modules/mod_messages/tmpl/default.php
Normal file
34
administrator/modules/mod_messages/tmpl/default.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_messages
|
||||
*
|
||||
* @copyright (C) 2019 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\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$hideLinks = $app->getInput()->getBool('hidemainmenu');
|
||||
|
||||
if ($hideLinks || $countUnread < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$route = 'index.php?option=com_messages&view=messages';
|
||||
?>
|
||||
<a class="header-item-content" href="<?php echo Route::_($route); ?>" title="<?php echo Text::_('MOD_MESSAGES_PRIVATE_MESSAGES'); ?>">
|
||||
<div class="header-item-icon">
|
||||
<div class="w-auto">
|
||||
<span class="icon-envelope icon-fw" aria-hidden="true"></span>
|
||||
<small class="header-item-count"><?php echo $countUnread; ?></small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-item-text">
|
||||
<?php echo Text::_('MOD_MESSAGES_PRIVATE_MESSAGES'); ?>
|
||||
</div>
|
||||
</a>
|
||||
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_multilangstatus
|
||||
*
|
||||
* @copyright (C) 2011 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\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
|
||||
$multilanguageEnabled = Multilanguage::isEnabled($app, Factory::getContainer()->get(DatabaseInterface::class));
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_multilangstatus', $params->get('layout', 'default'));
|
||||
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_multilangstatus</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2011-09</creationDate>
|
||||
<copyright>(C) 2011 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.0.0</version>
|
||||
<description>MOD_MULTILANGSTATUS_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_multilangstatus">mod_multilangstatus.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_multilangstatus.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_multilangstatus.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<help key="Admin_Modules:_Multilingual_Status" />
|
||||
|
||||
<config>
|
||||
|
||||
<fields name="params">
|
||||
|
||||
<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"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
48
administrator/modules/mod_multilangstatus/tmpl/default.php
Normal file
48
administrator/modules/mod_multilangstatus/tmpl/default.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_multilangstatus
|
||||
*
|
||||
* @copyright (C) 2011 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$hideLinks = $app->getInput()->getBool('hidemainmenu');
|
||||
|
||||
if (!$multilanguageEnabled || $hideLinks) {
|
||||
return;
|
||||
}
|
||||
|
||||
$modalHTML = HTMLHelper::_(
|
||||
'bootstrap.renderModal',
|
||||
'multiLangModal',
|
||||
[
|
||||
'title' => Text::_('MOD_MULTILANGSTATUS'),
|
||||
'url' => Route::_('index.php?option=com_languages&view=multilangstatus&tmpl=component'),
|
||||
'height' => '400px',
|
||||
'width' => '800px',
|
||||
'bodyHeight' => 70,
|
||||
'modalWidth' => 80,
|
||||
'footer' => '<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">' . Text::_('JTOOLBAR_CLOSE') . '</button>',
|
||||
]
|
||||
);
|
||||
|
||||
$app->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('mod_multilangstatus.admin', 'mod_multilangstatus/admin-multilangstatus.min.js', [], ['type' => 'module', 'defer' => true]);
|
||||
?>
|
||||
<a data-bs-target="#multiLangModal" class="header-item-content multilanguage" title="<?php echo Text::_('MOD_MULTILANGSTATUS'); ?>" data-bs-toggle="modal" role="button">
|
||||
<div class="header-item-icon">
|
||||
<span class="icon-language" aria-hidden="true"></span>
|
||||
</div>
|
||||
<div class="header-item-text">
|
||||
<?php echo Text::_('MOD_MULTILANGSTATUS'); ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php echo $modalHTML; ?>
|
||||
49
administrator/modules/mod_popular/mod_popular.php
Normal file
49
administrator/modules/mod_popular/mod_popular.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_popular
|
||||
*
|
||||
* @copyright (C) 2005 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\Component\ComponentHelper;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\CMS\Layout\LayoutHelper;
|
||||
use Joomla\Module\Popular\Administrator\Helper\PopularHelper;
|
||||
|
||||
$model = $app->bootComponent('com_content')->getMVCFactory()->createModel('Articles', 'Administrator', ['ignore_request' => true]);
|
||||
$list = PopularHelper::getList($params, $model);
|
||||
|
||||
// Get module data.
|
||||
if ($params->get('automatic_title', 0)) {
|
||||
$module->title = PopularHelper::getTitle($params);
|
||||
}
|
||||
|
||||
// If recording of hits is disabled.
|
||||
if (!ComponentHelper::getParams('com_content')->get('record_hits', 1)) {
|
||||
echo LayoutHelper::render('joomla.content.emptystate_module', [
|
||||
'title' => 'JGLOBAL_RECORD_HITS_DISABLED',
|
||||
'icon' => 'icon-minus-circle',
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// If there are some articles to display.
|
||||
if (\count($list)) {
|
||||
require ModuleHelper::getLayoutPath('mod_popular', $params->get('layout', 'default'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// If there are no articles to display, show empty state.
|
||||
$app->getLanguage()->load('com_content');
|
||||
|
||||
echo LayoutHelper::render('joomla.content.emptystate_module', [
|
||||
'textPrefix' => 'COM_CONTENT',
|
||||
'icon' => 'icon-copy',
|
||||
]);
|
||||
91
administrator/modules/mod_popular/mod_popular.xml
Normal file
91
administrator/modules/mod_popular/mod_popular.xml
Normal file
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_popular</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-07</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_POPULAR_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Popular</namespace>
|
||||
<files>
|
||||
<filename module="mod_popular">mod_popular.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_popular.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_popular.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Popular_Articles" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="count"
|
||||
type="number"
|
||||
label="MOD_POPULAR_FIELD_COUNT_LABEL"
|
||||
default="5"
|
||||
filter="integer"
|
||||
min="1"
|
||||
validate="number"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="catid"
|
||||
type="category"
|
||||
label="JCATEGORY"
|
||||
extension="com_content"
|
||||
default=""
|
||||
filter="integer"
|
||||
>
|
||||
<option value="">JOPTION_ANY_CATEGORY</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="user_id"
|
||||
type="list"
|
||||
label="MOD_POPULAR_FIELD_AUTHORS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">MOD_POPULAR_FIELD_VALUE_ANYONE</option>
|
||||
<option value="by_me">MOD_POPULAR_FIELD_VALUE_ADDED_OR_MODIFIED_BY_ME</option>
|
||||
<option value="not_me">MOD_POPULAR_FIELD_VALUE_NOT_ADDED_OR_MODIFIED_BY_ME</option>
|
||||
</field>
|
||||
</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>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
127
administrator/modules/mod_popular/src/Helper/PopularHelper.php
Normal file
127
administrator/modules/mod_popular/src/Helper/PopularHelper.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_popular
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Popular\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Categories\Categories;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Component\Content\Administrator\Model\ArticlesModel;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_popular
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
abstract class PopularHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of the most popular articles.
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
* @param ArticlesModel $model The model.
|
||||
*
|
||||
* @return mixed An array of articles, or false on error.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function getList(Registry $params, ArticlesModel $model)
|
||||
{
|
||||
$user = Factory::getUser();
|
||||
|
||||
// Set List SELECT
|
||||
$model->setState('list.select', 'a.id, a.title, a.checked_out, a.checked_out_time, ' .
|
||||
' a.created_by, a.publish_up, a.hits');
|
||||
|
||||
// Set Ordering filter
|
||||
$model->setState('list.ordering', 'a.hits');
|
||||
$model->setState('list.direction', 'DESC');
|
||||
|
||||
// Set Category Filter
|
||||
$categoryId = $params->get('catid', null);
|
||||
|
||||
if (is_numeric($categoryId)) {
|
||||
$model->setState('filter.category_id', $categoryId);
|
||||
}
|
||||
|
||||
// Set User Filter.
|
||||
$userId = $user->get('id');
|
||||
|
||||
switch ($params->get('user_id', '0')) {
|
||||
case 'by_me':
|
||||
$model->setState('filter.author_id', $userId);
|
||||
break;
|
||||
|
||||
case 'not_me':
|
||||
$model->setState('filter.author_id', $userId);
|
||||
$model->setState('filter.author_id.include', false);
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the Start and Limit
|
||||
$model->setState('list.start', 0);
|
||||
$model->setState('list.limit', $params->get('count', 5));
|
||||
|
||||
$items = $model->getItems();
|
||||
|
||||
if ($error = $model->getError()) {
|
||||
throw new \Exception($error, 500);
|
||||
}
|
||||
|
||||
// Set the links
|
||||
foreach ($items as &$item) {
|
||||
$item->link = '';
|
||||
|
||||
if (
|
||||
$user->authorise('core.edit', 'com_content.article.' . $item->id)
|
||||
|| ($user->authorise('core.edit.own', 'com_content.article.' . $item->id) && ($userId === $item->created_by))
|
||||
) {
|
||||
$item->link = Route::_('index.php?option=com_content&task=article.edit&id=' . $item->id);
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the alternate title for the module
|
||||
*
|
||||
* @param Registry $params The module parameters.
|
||||
*
|
||||
* @return string The alternate title for the module.
|
||||
*/
|
||||
public static function getTitle($params)
|
||||
{
|
||||
$who = $params->get('user_id', 0);
|
||||
$catid = (int) $params->get('catid', null);
|
||||
$title = '';
|
||||
|
||||
if ($catid) {
|
||||
$category = Categories::getInstance('Content')->get($catid);
|
||||
$title = Text::_('MOD_POPULAR_UNEXISTING');
|
||||
|
||||
if ($category) {
|
||||
$title = $category->title;
|
||||
}
|
||||
}
|
||||
|
||||
return Text::plural(
|
||||
'MOD_POPULAR_TITLE' . ($catid ? '_CATEGORY' : '') . ($who != '0' ? "_$who" : ''),
|
||||
(int) $params->get('count', 5),
|
||||
$title
|
||||
);
|
||||
}
|
||||
}
|
||||
63
administrator/modules/mod_popular/tmpl/default.php
Normal file
63
administrator/modules/mod_popular/tmpl/default.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_popular
|
||||
*
|
||||
* @copyright (C) 2010 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;
|
||||
|
||||
$moduleId = str_replace(' ', '', $module->title) . $module->id;
|
||||
|
||||
?>
|
||||
<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-60"><?php echo Text::_('JGLOBAL_TITLE'); ?></th>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('JGLOBAL_HITS'); ?></th>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('JDATE'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($list)) : ?>
|
||||
<?php foreach ($list as $i => $item) : ?>
|
||||
<?php // Calculate popular items ?>
|
||||
<?php $hits = (int) $item->hits; ?>
|
||||
<?php $hits_class = ($hits >= 10000 ? 'danger' : ($hits >= 1000 ? 'warning' : ($hits >= 100 ? 'info' : 'secondary'))); ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<?php if ($item->checked_out) : ?>
|
||||
<?php echo HTMLHelper::_('jgrid.checkedout', $moduleId . $i, $item->editor, $item->checked_out_time); ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($item->link) : ?>
|
||||
<a href="<?php echo $item->link; ?>" title="<?php echo Text::_('JACTION_EDIT'); ?> <?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
|
||||
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</a>
|
||||
<?php else : ?>
|
||||
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td>
|
||||
<span class="badge bg-<?php echo $hits_class; ?>"><?php echo $item->hits; ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo HTMLHelper::_('date', $item->publish_up, Text::_('DATE_FORMAT_LC4')); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php echo Text::_('MOD_POPULAR_NO_MATCHING_RESULTS'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_post_installation_messages
|
||||
*
|
||||
* @copyright (C) 2019 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\Extension\ExtensionHelper;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
// Try to get the items from the post-installation model
|
||||
try {
|
||||
/** @var \Joomla\Component\Postinstall\Administrator\Model\MessagesModel $messagesModel */
|
||||
$messagesModel = $app->bootComponent('com_postinstall')->getMVCFactory()
|
||||
->createModel('Messages', 'Administrator', ['ignore_request' => true]);
|
||||
$messagesCount = $messagesModel->getItemsCount();
|
||||
} catch (RuntimeException $e) {
|
||||
$messagesCount = 0;
|
||||
|
||||
// Still render the error message from the Exception object
|
||||
$app->enqueueMessage($e->getMessage(), 'error');
|
||||
}
|
||||
|
||||
$joomlaFilesExtensionId = ExtensionHelper::getExtensionRecord('joomla', 'file')->extension_id;
|
||||
|
||||
// Load the com_postinstall language file
|
||||
$app->getLanguage()->load('com_postinstall', JPATH_ADMINISTRATOR);
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_post_installation_messages', $params->get('layout', 'default'));
|
||||
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_post_installation_messages</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-07</creationDate>
|
||||
<copyright>(C) 2019 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>4.0.0</version>
|
||||
<description>MOD_POST_INSTALLATION_MESSAGES_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_post_installation_messages">mod_post_installation_messages.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_post_installation_messages.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_post_installation_messages.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Post_Installation_Messages" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_post_installation_messages
|
||||
*
|
||||
* @copyright (C) 2019 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\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$hideLinks = $app->getInput()->getBool('hidemainmenu');
|
||||
|
||||
if ($hideLinks || $messagesCount < 1) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<?php if ($app->getIdentity()->authorise('core.manage', 'com_postinstall')) : ?>
|
||||
<a class="header-item-content"
|
||||
href="<?php echo Route::_('index.php?option=com_postinstall&eid=' . $joomlaFilesExtensionId); ?>"
|
||||
title="<?php echo Text::_('MOD_POST_INSTALLATION_MESSAGES'); ?>">
|
||||
<div class="header-item-icon">
|
||||
<div class="w-auto">
|
||||
<span class="icon-bell icon-fw" aria-hidden="true"></span>
|
||||
<small class="header-item-count"><?php echo $messagesCount; ?></small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-item-text">
|
||||
<?php echo Text::_('MOD_POST_INSTALLATION_MESSAGES'); ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_privacy_dashboard
|
||||
*
|
||||
* @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\CMS\Layout\LayoutHelper;
|
||||
use Joomla\Module\PrivacyDashboard\Administrator\Helper\PrivacyDashboardHelper;
|
||||
|
||||
// Only super user can view this data
|
||||
if (!$app->getIdentity()->authorise('core.admin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Boot component to ensure HTML helpers are loaded
|
||||
$app->bootComponent('com_privacy');
|
||||
|
||||
// Load the privacy component language file.
|
||||
$lang = $app->getLanguage();
|
||||
$lang->load('com_privacy', JPATH_ADMINISTRATOR)
|
||||
|| $lang->load('com_privacy', JPATH_ADMINISTRATOR . '/components/com_privacy');
|
||||
|
||||
$list = PrivacyDashboardHelper::getData();
|
||||
|
||||
if (\count($list)) {
|
||||
require ModuleHelper::getLayoutPath('mod_privacy_dashboard', $params->get('layout', 'default'));
|
||||
} else {
|
||||
echo LayoutHelper::render('joomla.content.emptystate_module', [
|
||||
'textPrefix' => 'COM_PRIVACY_REQUESTS',
|
||||
'icon' => 'icon-lock',
|
||||
]);
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_privacy_dashboard</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2018-06</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_PRIVACY_DASHBOARD_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\PrivacyDashboard</namespace>
|
||||
<files>
|
||||
<filename module="mod_privacy_dashboard">mod_privacy_dashboard.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_privacy_dashboard.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_privacy_dashboard.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Privacy_Dashboard" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<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="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,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_privacy_dashboard
|
||||
*
|
||||
* @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\PrivacyDashboard\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\Database\Exception\ExecutionFailureException;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper class for admin privacy dashboard module
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
class PrivacyDashboardHelper
|
||||
{
|
||||
/**
|
||||
* Method to retrieve information about the site privacy requests
|
||||
*
|
||||
* @return array Array containing site privacy requests
|
||||
*
|
||||
* @since 3.9.0
|
||||
*/
|
||||
public static function getData()
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select(
|
||||
[
|
||||
'COUNT(*) AS count',
|
||||
$db->quoteName('status'),
|
||||
$db->quoteName('request_type'),
|
||||
]
|
||||
)
|
||||
->from($db->quoteName('#__privacy_requests'))
|
||||
->group($db->quoteName('status'))
|
||||
->group($db->quoteName('request_type'));
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
return $db->loadObjectList();
|
||||
} catch (ExecutionFailureException $e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
65
administrator/modules/mod_privacy_dashboard/tmpl/default.php
Normal file
65
administrator/modules/mod_privacy_dashboard/tmpl/default.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_privacy_dashboard
|
||||
*
|
||||
* @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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$totalRequests = 0;
|
||||
$activeRequests = 0;
|
||||
|
||||
?>
|
||||
<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-40"><?php echo Text::_('COM_PRIVACY_DASHBOARD_HEADING_REQUEST_TYPE'); ?></th>
|
||||
<th scope="col" class="w-40"><?php echo Text::_('COM_PRIVACY_DASHBOARD_HEADING_REQUEST_STATUS'); ?></th>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('COM_PRIVACY_DASHBOARD_HEADING_REQUEST_COUNT'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (count($list)) : ?>
|
||||
<?php foreach ($list as $i => $item) : ?>
|
||||
<?php if (in_array($item->status, [0, 1])) : ?>
|
||||
<?php $activeRequests += $item->count; ?>
|
||||
<?php endif; ?>
|
||||
<?php $totalRequests += $item->count; ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<a href="<?php echo Route::_('index.php?option=com_privacy&view=requests&filter[request_type]=' . $item->request_type . '&filter[status]=' . $item->status); ?>">
|
||||
<?php echo Text::_('COM_PRIVACY_HEADING_REQUEST_TYPE_TYPE_' . $item->request_type); ?>
|
||||
</a>
|
||||
</th>
|
||||
<td>
|
||||
<?php echo HTMLHelper::_('privacy.statusLabel', $item->status); ?>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-info"><?php echo $item->count; ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php echo Text::_('COM_PRIVACY_DASHBOARD_NO_REQUESTS'); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (count($list)) : ?>
|
||||
<div class="row p-3">
|
||||
<div class="col-md-6"><?php echo Text::plural('COM_PRIVACY_DASHBOARD_BADGE_TOTAL_REQUESTS', $totalRequests); ?></div>
|
||||
<div class="col-md-6"><?php echo Text::plural('COM_PRIVACY_DASHBOARD_BADGE_ACTIVE_REQUESTS', $activeRequests); ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_privacy_status
|
||||
*
|
||||
* @copyright (C) 2019 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\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Component\Privacy\Administrator\Helper\PrivacyHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Module\PrivacyStatus\Administrator\Helper\PrivacyStatusHelper;
|
||||
|
||||
// Only super user can view this data
|
||||
if (!$app->getIdentity()->authorise('core.admin')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Boot component to ensure HTML helpers are loaded
|
||||
$app->bootComponent('com_privacy');
|
||||
|
||||
// Load the privacy component language file.
|
||||
$lang = $app->getLanguage();
|
||||
$lang->load('com_privacy', JPATH_ADMINISTRATOR)
|
||||
|| $lang->load('com_privacy', JPATH_ADMINISTRATOR . '/components/com_privacy');
|
||||
|
||||
$privacyPolicyInfo = PrivacyStatusHelper::getPrivacyPolicyInfo();
|
||||
$requestFormPublished = PrivacyStatusHelper::getRequestFormPublished();
|
||||
$privacyConsentPluginId = PrivacyHelper::getPrivacyConsentPluginId();
|
||||
$sendMailEnabled = (bool) $app->get('mailonline', 1);
|
||||
$numberOfUrgentRequests = PrivacyStatusHelper::getNumberUrgentRequests();
|
||||
$urgentRequestDays = (int) ComponentHelper::getParams('com_privacy')->get('notify', 14);
|
||||
$databaseConnectionEncryption = Factory::getContainer()->get(DatabaseInterface::class)->getConnectionEncryption();
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_privacy_status', $params->get('layout', 'default'));
|
||||
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_privacy_status</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-07</creationDate>
|
||||
<copyright>(C) 2019 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>4.0.0</version>
|
||||
<description>MOD_PRIVACY_STATUS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\PrivacyStatus</namespace>
|
||||
<files>
|
||||
<filename module="mod_privacy_status">mod_privacy_status.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_privacy_status.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_privacy_status.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Privacy_Status_Check" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
|
||||
<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,180 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_privacy_status
|
||||
*
|
||||
* @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\PrivacyStatus\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Event\Privacy\CheckPrivacyPolicyPublishedEvent;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Multilanguage;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper class for admin privacy status module
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class PrivacyStatusHelper
|
||||
{
|
||||
/**
|
||||
* Get the information about the published privacy policy
|
||||
*
|
||||
* @return array Array containing a status of whether a privacy policy is set and a link to the policy document for editing
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static function getPrivacyPolicyInfo()
|
||||
{
|
||||
$dispatcher = Factory::getApplication()->getDispatcher();
|
||||
$policy = [
|
||||
'published' => false,
|
||||
'articlePublished' => false,
|
||||
'editLink' => '',
|
||||
];
|
||||
|
||||
/*
|
||||
* Prior to 3.9.0 it was common for a plugin such as the User - Profile plugin to define a privacy policy or
|
||||
* terms of service article, therefore we will also import the user plugin group to process this event.
|
||||
*/
|
||||
PluginHelper::importPlugin('privacy', null, true, $dispatcher);
|
||||
PluginHelper::importPlugin('user', null, true, $dispatcher);
|
||||
|
||||
return $dispatcher->dispatch(
|
||||
'onPrivacyCheckPrivacyPolicyPublished',
|
||||
new CheckPrivacyPolicyPublishedEvent('onPrivacyCheckPrivacyPolicyPublished', [
|
||||
'subject' => &$policy, // @todo: Remove reference in Joomla 6, see CheckPrivacyPolicyPublishedEvent::__constructor()
|
||||
])
|
||||
)->getArgument('subject', $policy);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether there is a menu item for the request form
|
||||
*
|
||||
* @return array Array containing a status of whether a menu is published for the request form and its current link
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static function getRequestFormPublished()
|
||||
{
|
||||
$status = [
|
||||
'exists' => false,
|
||||
'published' => false,
|
||||
'link' => '',
|
||||
];
|
||||
$lang = '';
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select(
|
||||
[
|
||||
$db->quoteName('id'),
|
||||
$db->quoteName('published'),
|
||||
$db->quoteName('language'),
|
||||
]
|
||||
)
|
||||
->from($db->quoteName('#__menu'))
|
||||
->where(
|
||||
[
|
||||
$db->quoteName('client_id') . ' = 0',
|
||||
$db->quoteName('link') . ' = ' . $db->quote('index.php?option=com_privacy&view=request'),
|
||||
]
|
||||
)
|
||||
->setLimit(1);
|
||||
$db->setQuery($query);
|
||||
|
||||
$menuItem = $db->loadObject();
|
||||
|
||||
// Check if the menu item exists in database
|
||||
if ($menuItem) {
|
||||
$status['exists'] = true;
|
||||
|
||||
// Check if the menu item is published
|
||||
if ($menuItem->published == 1) {
|
||||
$status['published'] = true;
|
||||
}
|
||||
|
||||
// Add language to the url if the site is multilingual
|
||||
if (Multilanguage::isEnabled() && $menuItem->language && $menuItem->language !== '*') {
|
||||
$lang = '&lang=' . $menuItem->language;
|
||||
}
|
||||
}
|
||||
|
||||
$linkMode = Factory::getApplication()->get('force_ssl', 0) == 2 ? Route::TLS_FORCE : Route::TLS_IGNORE;
|
||||
|
||||
if (!$menuItem) {
|
||||
if (Multilanguage::isEnabled()) {
|
||||
// Find the Itemid of the home menu item tagged to the site default language
|
||||
$params = ComponentHelper::getParams('com_languages');
|
||||
$defaultSiteLanguage = $params->get('site');
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true)
|
||||
->select($db->quoteName('id'))
|
||||
->from($db->quoteName('#__menu'))
|
||||
->where(
|
||||
[
|
||||
$db->quoteName('client_id') . ' = 0',
|
||||
$db->quoteName('home') . ' = 1',
|
||||
$db->quoteName('language') . ' = :language',
|
||||
]
|
||||
)
|
||||
->bind(':language', $defaultSiteLanguage)
|
||||
->setLimit(1);
|
||||
$db->setQuery($query);
|
||||
|
||||
$homeId = (int) $db->loadResult();
|
||||
$itemId = $homeId ? '&Itemid=' . $homeId : '';
|
||||
} else {
|
||||
$itemId = '';
|
||||
}
|
||||
|
||||
$status['link'] = Route::link('site', 'index.php?option=com_privacy&view=request' . $itemId, true, $linkMode);
|
||||
} else {
|
||||
$status['link'] = Route::link('site', 'index.php?Itemid=' . $menuItem->id . $lang, true, $linkMode);
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to return number privacy requests older than X days.
|
||||
*
|
||||
* @return integer
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static function getNumberUrgentRequests()
|
||||
{
|
||||
// Load the parameters.
|
||||
$params = ComponentHelper::getComponent('com_privacy')->getParams();
|
||||
$notify = (int) $params->get('notify', 14);
|
||||
$now = Factory::getDate()->toSql();
|
||||
$period = '-' . $notify;
|
||||
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select('COUNT(*)')
|
||||
->from($db->quoteName('#__privacy_requests'))
|
||||
->where(
|
||||
[
|
||||
$db->quoteName('status') . ' = 1',
|
||||
$query->dateAdd($db->quote($now), $period, 'DAY') . ' > ' . $db->quoteName('requested_at'),
|
||||
]
|
||||
);
|
||||
$db->setQuery($query);
|
||||
|
||||
return (int) $db->loadResult();
|
||||
}
|
||||
}
|
||||
151
administrator/modules/mod_privacy_status/tmpl/default.php
Normal file
151
administrator/modules/mod_privacy_status/tmpl/default.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_privacy_status
|
||||
*
|
||||
* @copyright (C) 2019 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\Language\Text;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
?>
|
||||
<table class="table">
|
||||
<caption class="visually-hidden">
|
||||
<?php echo Text::_('MOD_PRIVACY_STATUS'); ?>
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="w-20"><?php echo Text::_('COM_PRIVACY_DASHBOARD_HEADING_STATUS'); ?></th>
|
||||
<th scope="col"><?php echo Text::_('COM_PRIVACY_DASHBOARD_HEADING_CHECK'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($privacyPolicyInfo['published'] && $privacyPolicyInfo['articlePublished']) : ?>
|
||||
<span class="badge bg-success">
|
||||
<span class="icon-check-square" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JPUBLISHED'); ?>
|
||||
</span>
|
||||
<?php elseif ($privacyPolicyInfo['published'] && !$privacyPolicyInfo['articlePublished']) : ?>
|
||||
<span class="badge bg-warning text-dark">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JUNPUBLISHED'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-warning text-dark">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('COM_PRIVACY_STATUS_CHECK_NOT_AVAILABLE'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div><?php echo Text::_('COM_PRIVACY_STATUS_CHECK_PRIVACY_POLICY_PUBLISHED'); ?></div>
|
||||
<?php if ($privacyPolicyInfo['editLink'] !== '') : ?>
|
||||
<small><a href="<?php echo $privacyPolicyInfo['editLink']; ?>"><?php echo Text::_('COM_PRIVACY_EDIT_PRIVACY_POLICY'); ?></a></small>
|
||||
<?php else : ?>
|
||||
<?php $link = Route::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $privacyConsentPluginId); ?>
|
||||
<small><a href="<?php echo $link; ?>"><?php echo Text::_('COM_PRIVACY_EDIT_PRIVACY_CONSENT_PLUGIN'); ?></a></small>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($requestFormPublished['published'] && $requestFormPublished['exists']) : ?>
|
||||
<span class="badge bg-success">
|
||||
<span class="icon-check-square" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JPUBLISHED'); ?>
|
||||
</span>
|
||||
<?php elseif (!$requestFormPublished['published'] && $requestFormPublished['exists']) : ?>
|
||||
<span class="badge bg-warning text-dark">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JUNPUBLISHED'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-warning text-dark">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('COM_PRIVACY_STATUS_CHECK_NOT_AVAILABLE'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div><?php echo Text::_('COM_PRIVACY_STATUS_CHECK_REQUEST_FORM_MENU_ITEM_PUBLISHED'); ?></div>
|
||||
<?php if ($requestFormPublished['link'] !== '') : ?>
|
||||
<small><a href="<?php echo $requestFormPublished['link']; ?>" class="break-word"><?php echo $requestFormPublished['link']; ?></a></small>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($numberOfUrgentRequests === 0) : ?>
|
||||
<span class="badge bg-success">
|
||||
<span class="icon-check-square" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JNONE'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-danger">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('WARNING'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div><?php echo Text::_('COM_PRIVACY_STATUS_CHECK_OUTSTANDING_URGENT_REQUESTS'); ?></div>
|
||||
<small><?php echo Text::plural('COM_PRIVACY_STATUS_CHECK_OUTSTANDING_URGENT_REQUESTS_DESCRIPTION', $urgentRequestDays); ?></small>
|
||||
<?php if ($numberOfUrgentRequests > 0) : ?>
|
||||
<small><a href="<?php echo Route::_('index.php?option=com_privacy&view=requests&filter[status]=1&list[fullordering]=a.requested_at ASC'); ?>"><?php echo Text::_('COM_PRIVACY_SHOW_URGENT_REQUESTS'); ?></a></small>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($sendMailEnabled) : ?>
|
||||
<span class="badge bg-success">
|
||||
<span class="icon-check-square" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JENABLED'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-danger">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JDISABLED'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (!$sendMailEnabled) : ?>
|
||||
<div><?php echo Text::_('COM_PRIVACY_STATUS_CHECK_SENDMAIL_DISABLED'); ?></div>
|
||||
<small><?php echo Text::_('COM_PRIVACY_STATUS_CHECK_SENDMAIL_DISABLED_DESCRIPTION'); ?></small>
|
||||
<?php else : ?>
|
||||
<div><?php echo Text::_('COM_PRIVACY_STATUS_CHECK_SENDMAIL_ENABLED'); ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ($databaseConnectionEncryption !== '') : ?>
|
||||
<span class="badge bg-success">
|
||||
<span class="icon-check-square" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JENABLED'); ?>
|
||||
</span>
|
||||
<?php else : ?>
|
||||
<span class="badge bg-warning text-dark">
|
||||
<span class="icon-exclamation-triangle" aria-hidden="true"></span>
|
||||
<?php echo Text::_('COM_PRIVACY_STATUS_CHECK_NOT_AVAILABLE'); ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($databaseConnectionEncryption === '') : ?>
|
||||
<?php echo Text::_('MOD_PRIVACY_STATUS_CHECK_DATABASE_CONNECTION_ENCRYPTION_DISABLED'); ?>
|
||||
<?php else : ?>
|
||||
<?php echo Text::sprintf('MOD_PRIVACY_STATUS_CHECK_DATABASE_CONNECTION_ENCRYPTION_ENABLED', $databaseConnectionEncryption); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
327
administrator/modules/mod_quickicon/mod_quickicon.xml
Normal file
327
administrator/modules/mod_quickicon/mod_quickicon.xml
Normal file
@ -0,0 +1,327 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_quickicon</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-11</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_QUICKICON_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Quickicon</namespace>
|
||||
<files>
|
||||
<folder module="mod_quickicon">services</folder>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_quickicon.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_quickicon.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Quick_Icons" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="context"
|
||||
type="text"
|
||||
label="MOD_QUICKICON_GROUP_LABEL"
|
||||
description="MOD_QUICKICON_GROUP_DESC"
|
||||
default="mod_quickicon"
|
||||
/>
|
||||
<field
|
||||
name="header_icon"
|
||||
type="text"
|
||||
label="MOD_QUICKICON_HEADER_ICON_LABEL"
|
||||
hint="icon-crosshairs"
|
||||
default=""
|
||||
/>
|
||||
<field
|
||||
name="show_global"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_GLOBAL_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_checkin"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_CHECKIN_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_cache"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_CACHE_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_users"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_USERS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_articles"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_ARTICLES_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_featured"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_FEATURED_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_menuitems"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_MENUITEMS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_workflow"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_WORKFLOW_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_banners"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_BANNERS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_finder"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_FINDER_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_newsfeeds"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_NEWSFEEDS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_tags"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_TAGS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_redirect"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_REDIRECT_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_associations"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_ASSOCIATIONS_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_languages"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_LANGUAGES_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_modules"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_MODULES_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_contact"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_CONTACT_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_categories"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_CATEGORIES_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_media"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_MEDIA_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_menuitems"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_MENUITEMS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_plugins"
|
||||
type="list"
|
||||
label="MOD_QUICKICON_SHOW_PLUGINS_LABEL"
|
||||
default="0"
|
||||
validate="options"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
<option value="2">MOD_QUICKICON_WITH_COUNT</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_template_styles"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_TEMPLATE_STYLES_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
<field
|
||||
name="show_template_code"
|
||||
type="radio"
|
||||
label="MOD_QUICKICON_SHOW_TEMPLATE_CODE_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</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="cache"
|
||||
type="list"
|
||||
label="COM_MODULES_FIELD_CACHING_LABEL"
|
||||
default="0"
|
||||
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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
41
administrator/modules/mod_quickicon/services/provider.php
Normal file
41
administrator/modules/mod_quickicon/services/provider.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_quickicon
|
||||
*
|
||||
* @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\Extension\Service\Provider\HelperFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\Module;
|
||||
use Joomla\CMS\Extension\Service\Provider\ModuleDispatcherFactory;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The quickicon module service provider.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
return new class () implements ServiceProviderInterface {
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new ModuleDispatcherFactory('\\Joomla\\Module\\Quickicon'));
|
||||
$container->registerServiceProvider(new HelperFactory('\\Joomla\\Module\\Quickicon\\Administrator\\Helper'));
|
||||
|
||||
$container->registerServiceProvider(new Module());
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_quickicon
|
||||
*
|
||||
* @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\Quickicon\Administrator\Dispatcher;
|
||||
|
||||
use Joomla\CMS\Dispatcher\AbstractModuleDispatcher;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareInterface;
|
||||
use Joomla\CMS\Helper\HelperFactoryAwareTrait;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Dispatcher class for mod_quickicon
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class Dispatcher extends AbstractModuleDispatcher implements HelperFactoryAwareInterface
|
||||
{
|
||||
use HelperFactoryAwareTrait;
|
||||
|
||||
/**
|
||||
* Returns the layout data.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected function getLayoutData()
|
||||
{
|
||||
$data = parent::getLayoutData();
|
||||
|
||||
$data['buttons'] = $this->getHelperFactory()->getHelper('QuickIconHelper')->getButtons($data['params'], $this->getApplication());
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_quickicon
|
||||
*
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Quickicon\Administrator\Event;
|
||||
|
||||
use Joomla\CMS\Event\AbstractEvent;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Event object for retrieving pluggable quick icons
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class QuickIconsEvent extends AbstractEvent
|
||||
{
|
||||
/**
|
||||
* The event context
|
||||
*
|
||||
* @var string
|
||||
* @since 4.0.0
|
||||
*/
|
||||
private $context;
|
||||
|
||||
/**
|
||||
* Get the event context
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function getContext()
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the event context
|
||||
*
|
||||
* @param string $context The event context
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function setContext($context)
|
||||
{
|
||||
$this->context = $context;
|
||||
|
||||
return $context;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,418 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_quickicon
|
||||
*
|
||||
* @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Quickicon\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Module\Quickicon\Administrator\Event\QuickIconsEvent;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_quickicon
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
class QuickIconHelper
|
||||
{
|
||||
/**
|
||||
* Stack to hold buttons
|
||||
*
|
||||
* @var array[]
|
||||
* @since 1.6
|
||||
*/
|
||||
protected $buttons = [];
|
||||
|
||||
/**
|
||||
* Helper method to return button list.
|
||||
*
|
||||
* This method returns the array by reference so it can be
|
||||
* used to add custom buttons or remove default ones.
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param ?CMSApplication $application The application
|
||||
*
|
||||
* @return array An array of buttons
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
public function getButtons(Registry $params, CMSApplication $application = null)
|
||||
{
|
||||
if ($application == null) {
|
||||
$application = Factory::getApplication();
|
||||
}
|
||||
|
||||
$key = (string) $params;
|
||||
$context = (string) $params->get('context', 'mod_quickicon');
|
||||
|
||||
if (!isset($this->buttons[$key])) {
|
||||
// Load mod_quickicon language file in case this method is called before rendering the module
|
||||
$application->getLanguage()->load('mod_quickicon');
|
||||
|
||||
$this->buttons[$key] = [];
|
||||
|
||||
if ($params->get('show_users')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-users',
|
||||
'link' => Route::_('index.php?option=com_users&view=users'),
|
||||
'linkadd' => Route::_('index.php?option=com_users&task=user.add'),
|
||||
'name' => 'MOD_QUICKICON_USER_MANAGER',
|
||||
'access' => ['core.manage', 'com_users', 'core.create', 'com_users'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_users') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_users&task=users.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_menuitems')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-list',
|
||||
'link' => Route::_('index.php?option=com_menus&view=items&menutype='),
|
||||
'linkadd' => Route::_('index.php?option=com_menus&task=item.add'),
|
||||
'name' => 'MOD_QUICKICON_MENUITEMS_MANAGER',
|
||||
'access' => ['core.manage', 'com_menus', 'core.create', 'com_menus'],
|
||||
'group' => 'MOD_QUICKICON_STRUCTURE',
|
||||
];
|
||||
|
||||
if ($params->get('show_menuitems') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_menus&task=items.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_articles')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-file-alt',
|
||||
'link' => Route::_('index.php?option=com_content&view=articles'),
|
||||
'linkadd' => Route::_('index.php?option=com_content&task=article.add'),
|
||||
'name' => 'MOD_QUICKICON_ARTICLE_MANAGER',
|
||||
'access' => ['core.manage', 'com_content', 'core.create', 'com_content'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_articles') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_content&task=articles.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_tags') && $params->get('show_tags')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-tag',
|
||||
'link' => Route::_('index.php?option=com_tags&view=tags'),
|
||||
'linkadd' => Route::_('index.php?option=com_tags&task=tag.edit'),
|
||||
'name' => 'MOD_QUICKICON_TAGS_MANAGER',
|
||||
'access' => ['core.manage', 'com_tags', 'core.create', 'com_tags'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_tags') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_tags&task=tags.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_categories')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-folder-open',
|
||||
'link' => Route::_('index.php?option=com_categories&view=categories&extension=com_content'),
|
||||
'linkadd' => Route::_('index.php?option=com_categories&task=category.add'),
|
||||
'name' => 'MOD_QUICKICON_CATEGORY_MANAGER',
|
||||
'access' => ['core.manage', 'com_content', 'core.create', 'com_content'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_categories') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_categories&task=categories.getQuickiconContent&extension=content&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_media')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-images',
|
||||
'link' => Route::_('index.php?option=com_media'),
|
||||
'name' => 'MOD_QUICKICON_MEDIA_MANAGER',
|
||||
'access' => ['core.manage', 'com_media'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if ($params->get('show_modules')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-cube',
|
||||
'link' => Route::_('index.php?option=com_modules&view=modules&client_id=0'),
|
||||
'linkadd' => Route::_('index.php?option=com_modules&view=select&client_id=0'),
|
||||
'name' => 'MOD_QUICKICON_MODULE_MANAGER',
|
||||
'access' => ['core.manage', 'com_modules'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_modules') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_modules&task=modules.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_plugins')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-plug',
|
||||
'link' => Route::_('index.php?option=com_plugins'),
|
||||
'name' => 'MOD_QUICKICON_PLUGIN_MANAGER',
|
||||
'access' => ['core.manage', 'com_plugins'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_plugins') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_plugins&task=plugins.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_template_styles')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-paint-brush',
|
||||
'link' => Route::_('index.php?option=com_templates&view=styles&client_id=0'),
|
||||
'name' => 'MOD_QUICKICON_TEMPLATE_STYLES',
|
||||
'access' => ['core.admin', 'com_templates'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if ($params->get('show_template_code')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-code',
|
||||
'link' => Route::_('index.php?option=com_templates&view=templates&client_id=0'),
|
||||
'name' => 'MOD_QUICKICON_TEMPLATE_CODE',
|
||||
'access' => ['core.admin', 'com_templates'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if ($params->get('show_checkin')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-unlock-alt',
|
||||
'link' => Route::_('index.php?option=com_checkin'),
|
||||
'name' => 'MOD_QUICKICON_CHECKINS',
|
||||
'access' => ['core.admin', 'com_checkin'],
|
||||
'group' => 'MOD_QUICKICON_SYSTEM',
|
||||
];
|
||||
|
||||
if ($params->get('show_checkin') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_checkin&task=getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_cache')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-cloud',
|
||||
'link' => Route::_('index.php?option=com_cache'),
|
||||
'name' => 'MOD_QUICKICON_CACHE',
|
||||
'access' => ['core.admin', 'com_cache'],
|
||||
'group' => 'MOD_QUICKICON_SYSTEM',
|
||||
];
|
||||
|
||||
if ($params->get('show_cache') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_cache&task=display.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_global')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-cog',
|
||||
'link' => Route::_('index.php?option=com_config'),
|
||||
'name' => 'MOD_QUICKICON_GLOBAL_CONFIGURATION',
|
||||
'access' => ['core.manage', 'com_config', 'core.admin', 'com_config'],
|
||||
'group' => 'MOD_QUICKICON_SYSTEM',
|
||||
];
|
||||
}
|
||||
|
||||
if ($params->get('show_featured')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-star featured',
|
||||
'link' => Route::_('index.php?option=com_content&view=featured'),
|
||||
'name' => 'MOD_QUICKICON_FEATURED_MANAGER',
|
||||
'access' => ['core.manage', 'com_content'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_featured') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_content&task=featured.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if ($params->get('show_workflow')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-file-alt contact',
|
||||
'link' => Route::_('index.php?option=com_workflow&view=workflows&extension=com_content.article'),
|
||||
'linkadd' => Route::_('index.php?option=com_workflow&view=workflow&layout=edit&extension=com_content.article'),
|
||||
'name' => 'MOD_QUICKICON_WORKFLOW_MANAGER',
|
||||
'access' => ['core.manage', 'com_workflow', 'core.create', 'com_workflow'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_banners') && $params->get('show_banners')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-bookmark banners',
|
||||
'link' => Route::_('index.php?option=com_banners&view=banners'),
|
||||
'linkadd' => Route::_('index.php?option=com_banners&view=banner&layout=edit'),
|
||||
'name' => 'MOD_QUICKICON_BANNER_MANAGER',
|
||||
'access' => ['core.manage', 'com_banners', 'core.create', 'com_banners'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_banners') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_banners&task=banners.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_contact') && $params->get('show_contact')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-address-book contact',
|
||||
'link' => Route::_('index.php?option=com_contact&view=contacts'),
|
||||
'linkadd' => Route::_('index.php?option=com_contact&view=contact&layout=edit'),
|
||||
'name' => 'MOD_QUICKICON_CONTACT_MANAGER',
|
||||
'access' => ['core.manage', 'com_contact', 'core.create', 'com_contact'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_contact') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_contact&task=contacts.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_newsfeeds') && $params->get('show_newsfeeds')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-rss newsfeeds',
|
||||
'link' => Route::_('index.php?option=com_newsfeeds&view=newsfeeds'),
|
||||
'linkadd' => Route::_('index.php?option=com_newsfeeds&view=newsfeed&layout=edit'),
|
||||
'name' => 'MOD_QUICKICON_NEWSFEEDS_MANAGER',
|
||||
'access' => ['core.manage', 'com_newsfeeds', 'core.create', 'com_newsfeeds'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_newsfeeds') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_newsfeeds&task=newsfeeds.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_redirect') && $params->get('show_redirect')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-map-signs redirect',
|
||||
'link' => Route::_('index.php?option=com_redirect&view=links'),
|
||||
'linkadd' => Route::_('index.php?option=com_redirect&view=link&layout=edit'),
|
||||
'name' => 'MOD_QUICKICON_REDIRECT_MANAGER',
|
||||
'access' => ['core.manage', 'com_redirect', 'core.create', 'com_redirect'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_associations') && $params->get('show_associations')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-language',
|
||||
'link' => Route::_('index.php?option=com_associations&view=associations'),
|
||||
'name' => 'MOD_QUICKICON_ASSOCIATIONS_MANAGER',
|
||||
'access' => ['core.manage', 'com_associations'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if (ComponentHelper::isEnabled('com_finder') && $params->get('show_finder')) {
|
||||
$this->buttons[$key][] = [
|
||||
'image' => 'icon-search-plus finder',
|
||||
'link' => Route::_('index.php?option=com_finder&view=index'),
|
||||
'name' => 'MOD_QUICKICON_FINDER_MANAGER',
|
||||
'access' => ['core.manage', 'com_finder'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
}
|
||||
|
||||
if ($params->get('show_languages')) {
|
||||
$tmp = [
|
||||
'image' => 'icon-comments langmanager',
|
||||
'link' => Route::_('index.php?option=com_languages&view=languages'),
|
||||
'linkadd' => Route::_('index.php?option=com_installer&view=languages'),
|
||||
'name' => 'MOD_QUICKICON_LANGUAGES_MANAGER',
|
||||
'access' => ['core.manage', 'com_languages'],
|
||||
'group' => 'MOD_QUICKICON_SITE',
|
||||
];
|
||||
|
||||
if ($params->get('show_languages') == 2) {
|
||||
$tmp['ajaxurl'] = 'index.php?option=com_languages&task=languages.getQuickiconContent&format=json';
|
||||
}
|
||||
|
||||
$this->buttons[$key][] = $tmp;
|
||||
}
|
||||
PluginHelper::importPlugin('quickicon');
|
||||
|
||||
$arrays = (array) $application->triggerEvent(
|
||||
'onGetIcons',
|
||||
new QuickIconsEvent('onGetIcons', ['context' => $context])
|
||||
);
|
||||
|
||||
foreach ($arrays as $response) {
|
||||
if (!\is_array($response)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($response as $icon) {
|
||||
$default = [
|
||||
'link' => null,
|
||||
'image' => null,
|
||||
'text' => null,
|
||||
'name' => null,
|
||||
'linkadd' => null,
|
||||
'access' => true,
|
||||
'class' => null,
|
||||
'group' => 'MOD_QUICKICON',
|
||||
];
|
||||
|
||||
$icon = array_merge($default, $icon);
|
||||
|
||||
if (!\is_null($icon['link']) && (!\is_null($icon['text']) || !\is_null($icon['name']))) {
|
||||
$this->buttons[$key][] = $icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->buttons[$key];
|
||||
}
|
||||
}
|
||||
30
administrator/modules/mod_quickicon/tmpl/default.php
Normal file
30
administrator/modules/mod_quickicon/tmpl/default.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_quickicon
|
||||
*
|
||||
* @copyright (C) 2009 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;
|
||||
|
||||
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $app->getDocument()->getWebAssetManager();
|
||||
$wa->useScript('core')
|
||||
->useScript('bootstrap.dropdown');
|
||||
$wa->registerAndUseScript('mod_quickicon', 'mod_quickicon/quickicon.min.js', ['relative' => true, 'version' => 'auto'], ['type' => 'module']);
|
||||
|
||||
$html = HTMLHelper::_('icons.buttons', $buttons);
|
||||
?>
|
||||
<?php if (!empty($html)) : ?>
|
||||
<nav class="quick-icons px-3 pb-3" aria-label="<?php echo Text::_('MOD_QUICKICON_NAV_LABEL') . ' ' . $module->title; ?>">
|
||||
<ul class="nav flex-wrap">
|
||||
<?php echo $html; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
18
administrator/modules/mod_sampledata/mod_sampledata.php
Normal file
18
administrator/modules/mod_sampledata/mod_sampledata.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_sampledata
|
||||
*
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
$items = \Joomla\Module\Sampledata\Administrator\Helper\SampledataHelper::getList();
|
||||
|
||||
// Filter out empty entries
|
||||
$items = array_filter($items);
|
||||
|
||||
require \Joomla\CMS\Helper\ModuleHelper::getLayoutPath('mod_sampledata', $params->get('layout', 'default'));
|
||||
39
administrator/modules/mod_sampledata/mod_sampledata.xml
Normal file
39
administrator/modules/mod_sampledata/mod_sampledata.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_sampledata</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2017-07</creationDate>
|
||||
<copyright>(C) 2017 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.8.0</version>
|
||||
<description>MOD_SAMPLEDATA_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Sampledata</namespace>
|
||||
<files>
|
||||
<filename module="mod_sampledata">mod_sampledata.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<media destination="mod_sampledata" folder="media">
|
||||
<folder>js</folder>
|
||||
</media>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_sampledata.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_sampledata.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Sample_Data" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
validate="moduleLayout"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_sampledata
|
||||
*
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Sampledata\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Event\AbstractEvent;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_sampledata
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
abstract class SampledataHelper
|
||||
{
|
||||
/**
|
||||
* Get a list of sampledata.
|
||||
*
|
||||
* @return mixed An array of sampledata, or false on error.
|
||||
*
|
||||
* @since 3.8.0
|
||||
*/
|
||||
public static function getList()
|
||||
{
|
||||
PluginHelper::importPlugin('sampledata');
|
||||
|
||||
return Factory::getApplication()
|
||||
->getDispatcher()
|
||||
->dispatch(
|
||||
'onSampledataGetOverview',
|
||||
AbstractEvent::create(
|
||||
'onSampledataGetOverview',
|
||||
[
|
||||
'subject' => new \stdClass(),
|
||||
]
|
||||
)
|
||||
)
|
||||
->getArgument('result') ?? [];
|
||||
}
|
||||
}
|
||||
59
administrator/modules/mod_sampledata/tmpl/default.php
Normal file
59
administrator/modules/mod_sampledata/tmpl/default.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_sampledata
|
||||
*
|
||||
* @copyright (C) 2017 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\Language\Text;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$app->getDocument()->getWebAssetManager()
|
||||
->registerAndUseScript('mod_sampledata', 'mod_sampledata/sampledata-process.js', [], ['type' => 'module'], ['core']);
|
||||
|
||||
Text::script('MOD_SAMPLEDATA_COMPLETED');
|
||||
Text::script('MOD_SAMPLEDATA_CONFIRM_START');
|
||||
Text::script('MOD_SAMPLEDATA_ERROR_RESPONSE');
|
||||
Text::script('MOD_SAMPLEDATA_INVALID_RESPONSE');
|
||||
Text::script('MOD_SAMPLEDATA_ITEM_ALREADY_PROCESSED');
|
||||
|
||||
$app->getDocument()->addScriptOptions(
|
||||
'sample-data',
|
||||
[
|
||||
'icon' => Uri::root(true) . '/media/system/images/ajax-loader.gif',
|
||||
]
|
||||
);
|
||||
?>
|
||||
<?php if ($items) : ?>
|
||||
<ul id="sample-data-wrapper" class="list-group list-group-flush sample-data">
|
||||
<?php foreach ($items as $i => $item) : ?>
|
||||
<li class="list-group-item sampledata-<?php echo $item->name; ?>">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="sample-data__title">
|
||||
<span class="sample-data__icon icon-<?php echo $item->icon; ?> me-1" aria-hidden="true"></span>
|
||||
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>
|
||||
</div>
|
||||
<button type="button" class="btn btn-secondary btn-sm apply-sample-data" data-type="<?php echo $item->name; ?>" data-steps="<?php echo $item->steps; ?>">
|
||||
<span class="icon-upload" aria-hidden="true"></span> <?php echo Text::_('JLIB_INSTALLER_INSTALL'); ?>
|
||||
<span class="visually-hidden"><?php echo $item->title; ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<p class="sample-data__desc small mt-1"><?php echo $item->description; ?></p>
|
||||
</li>
|
||||
<?php // Progress bar ?>
|
||||
<li class="list-group-item sampledata-progress-<?php echo $item->name; ?> d-none">
|
||||
<div class="progress mb-3">
|
||||
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"></div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<a href="index.php?option=com_plugins&filter[folder]=sampledata" class="btn btn-secondary btn-sm manage-sample-data float-end m-3">
|
||||
<span class="icon-tasks" aria-hidden="true"></span> <?php echo Text::_('MOD_SAMPLEDATA_MANAGE_SAMPLEDATA'); ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
22
administrator/modules/mod_stats_admin/mod_stats_admin.php
Normal file
22
administrator/modules/mod_stats_admin/mod_stats_admin.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_stats_admin
|
||||
*
|
||||
* @copyright (C) 2012 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\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Module\StatsAdmin\Administrator\Helper\StatsAdminHelper;
|
||||
|
||||
$serverinfo = $params->get('serverinfo');
|
||||
$siteinfo = $params->get('siteinfo');
|
||||
$list = StatsAdminHelper::getStats($params, $app, Factory::getContainer()->get(DatabaseInterface::class));
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_stats_admin', $params->get('layout', 'default'));
|
||||
99
administrator/modules/mod_stats_admin/mod_stats_admin.xml
Normal file
99
administrator/modules/mod_stats_admin/mod_stats_admin.xml
Normal file
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_stats_admin</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2004-07</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_STATS_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\StatsAdmin</namespace>
|
||||
<files>
|
||||
<filename module="mod_stats_admin">mod_stats_admin.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_stats.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_stats.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Site_Modules:_Statistics" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="serverinfo"
|
||||
type="radio"
|
||||
label="MOD_STATS_FIELD_SERVERINFO_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="siteinfo"
|
||||
type="radio"
|
||||
label="MOD_STATS_FIELD_SITEINFO_LABEL"
|
||||
layout="joomla.form.field.radio.switcher"
|
||||
default="0"
|
||||
filter="integer"
|
||||
>
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</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="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,147 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_stats_admin
|
||||
*
|
||||
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\StatsAdmin\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Plugin\PluginHelper;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\Database\DatabaseInterface;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper class for admin stats module
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
class StatsAdminHelper
|
||||
{
|
||||
/**
|
||||
* Method to retrieve information about the site
|
||||
*
|
||||
* @param Registry $params The module parameters
|
||||
* @param CMSApplication $app The application
|
||||
* @param DatabaseInterface $db The database
|
||||
*
|
||||
* @return array Array containing site information
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public static function getStats(Registry $params, CMSApplication $app, DatabaseInterface $db)
|
||||
{
|
||||
$user = $app->getIdentity();
|
||||
|
||||
$rows = [];
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
$serverinfo = $params->get('serverinfo', 0);
|
||||
$siteinfo = $params->get('siteinfo', 0);
|
||||
|
||||
$i = 0;
|
||||
|
||||
if ($serverinfo) {
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = Text::_('MOD_STATS_PHP');
|
||||
$rows[$i]->icon = 'cogs';
|
||||
$rows[$i]->data = PHP_VERSION;
|
||||
$i++;
|
||||
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = Text::_($db->name);
|
||||
$rows[$i]->icon = 'database';
|
||||
$rows[$i]->data = $db->getVersion();
|
||||
$i++;
|
||||
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = Text::_('MOD_STATS_CACHING');
|
||||
$rows[$i]->icon = 'tachometer-alt';
|
||||
$rows[$i]->data = $app->get('caching') ? Text::_('JENABLED') : Text::_('JDISABLED');
|
||||
$i++;
|
||||
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = Text::_('MOD_STATS_GZIP');
|
||||
$rows[$i]->icon = 'bolt';
|
||||
$rows[$i]->data = $app->get('gzip') ? Text::_('JENABLED') : Text::_('JDISABLED');
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($siteinfo) {
|
||||
$query->select('COUNT(id) AS count_users')
|
||||
->from('#__users');
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$users = $db->loadResult();
|
||||
} catch (\RuntimeException $e) {
|
||||
$users = false;
|
||||
}
|
||||
|
||||
$query->clear()
|
||||
->select('COUNT(id) AS count_items')
|
||||
->from('#__content')
|
||||
->where('state = 1');
|
||||
$db->setQuery($query);
|
||||
|
||||
try {
|
||||
$items = $db->loadResult();
|
||||
} catch (\RuntimeException $e) {
|
||||
$items = false;
|
||||
}
|
||||
|
||||
if ($users) {
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = Text::_('MOD_STATS_USERS');
|
||||
$rows[$i]->icon = 'users';
|
||||
$rows[$i]->data = $users;
|
||||
|
||||
if ($user->authorise('core.manage', 'com_users')) {
|
||||
$rows[$i]->link = Route::_('index.php?option=com_users');
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($items) {
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = Text::_('MOD_STATS_ARTICLES');
|
||||
$rows[$i]->icon = 'file';
|
||||
$rows[$i]->data = $items;
|
||||
$rows[$i]->link = Route::_('index.php?option=com_content&view=articles&filter[published]=1');
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Include additional data defined by published system plugins
|
||||
PluginHelper::importPlugin('system');
|
||||
|
||||
$arrays = (array) $app->triggerEvent('onGetStats', ['mod_stats_admin']);
|
||||
|
||||
foreach ($arrays as $response) {
|
||||
foreach ($response as $row) {
|
||||
// We only add a row if the title and data are given
|
||||
if (isset($row['title']) && isset($row['data'])) {
|
||||
$rows[$i] = new \stdClass();
|
||||
$rows[$i]->title = $row['title'];
|
||||
$rows[$i]->icon = $row['icon'] ?? 'info';
|
||||
$rows[$i]->data = $row['data'];
|
||||
$rows[$i]->link = $row['link'] ?? null;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
49
administrator/modules/mod_stats_admin/tmpl/default.php
Normal file
49
administrator/modules/mod_stats_admin/tmpl/default.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_stats_admin
|
||||
*
|
||||
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
\Joomla\CMS\Factory::getApplication()->getDocument()->addScriptDeclaration('
|
||||
(function() {
|
||||
document.addEventListener(\'DOMContentLoaded\', function() {
|
||||
var elms = document.querySelectorAll("a.js-revert");
|
||||
|
||||
if (elms.length) {
|
||||
elms.forEach(function(el) {
|
||||
el.addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var activeTab = [];
|
||||
activeTab.push("#" + e.target.href.split("#")[1]);
|
||||
var path = window.location.pathname;
|
||||
localStorage.removeItem(e.target.href.replace(/&return=[a-zA-Z0-9%]+/, "").replace(/&[a-zA-Z-_]+=[0-9]+/, ""));
|
||||
localStorage.setItem(path + e.target.href.split("index.php")[1].split("#")[0], JSON.stringify(activeTab));
|
||||
return window.location.href = e.target.href.split("#")[0];
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
})();
|
||||
');
|
||||
?>
|
||||
<ul class="list-group list-group-flush stats-module">
|
||||
<?php foreach ($list as $item) : ?>
|
||||
<li class="list-group-item">
|
||||
<span class="me-2 icon-<?php echo $item->icon; ?> icon-fw" aria-hidden="true"></span> <?php echo $item->title; ?>
|
||||
|
||||
<?php if (isset($item->link)) : ?>
|
||||
<a class="btn btn-info btn-sm js-revert" href="<?php echo $item->link; ?>"><?php echo $item->data; ?></a>
|
||||
<?php else : ?>
|
||||
<?php echo $item->data; ?>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
40
administrator/modules/mod_submenu/mod_submenu.php
Normal file
40
administrator/modules/mod_submenu/mod_submenu.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_submenu
|
||||
*
|
||||
* @copyright (C) 2006 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\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
|
||||
use Joomla\Module\Submenu\Administrator\Menu\Menu;
|
||||
|
||||
$menutype = $params->get('menutype', '*');
|
||||
$root = false;
|
||||
|
||||
if ($menutype === '*') {
|
||||
$name = $params->get('preset', 'system');
|
||||
$root = MenusHelper::loadPreset($name);
|
||||
} else {
|
||||
$root = MenusHelper::getMenuItems($menutype, true);
|
||||
}
|
||||
|
||||
if ($root && $root->hasChildren()) {
|
||||
Factory::getLanguage()->load(
|
||||
'mod_menu',
|
||||
JPATH_ADMINISTRATOR,
|
||||
Factory::getLanguage()->getTag(),
|
||||
true
|
||||
);
|
||||
|
||||
Menu::preprocess($root);
|
||||
|
||||
// Render the module layout
|
||||
require ModuleHelper::getLayoutPath('mod_submenu', $params->get('layout', 'default'));
|
||||
}
|
||||
62
administrator/modules/mod_submenu/mod_submenu.xml
Normal file
62
administrator/modules/mod_submenu/mod_submenu.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_submenu</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2006-02</creationDate>
|
||||
<copyright>(C) 2006 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.0.0</version>
|
||||
<description>MOD_SUBMENU_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Submenu</namespace>
|
||||
<files>
|
||||
<filename module="mod_submenu">mod_submenu.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_submenu.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_submenu.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Administrator_Dashboard_Menu" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic" addfieldprefix="Joomla\Component\Menus\Administrator\Field">
|
||||
<field
|
||||
name="menutype"
|
||||
type="menu"
|
||||
label="MOD_SUBMENU_FIELD_MENUTYPE_LABEL"
|
||||
clientid="1"
|
||||
>
|
||||
<option value="*">MOD_SUBMENU_FIELD_MENUTYPE_OPTION_PREDEFINED</option>
|
||||
</field>
|
||||
|
||||
<field
|
||||
name="preset"
|
||||
type="menuPreset"
|
||||
label="MOD_SUBMENU_FIELD_PRESET_LABEL"
|
||||
showon="menutype:*"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
237
administrator/modules/mod_submenu/src/Menu/Menu.php
Normal file
237
administrator/modules/mod_submenu/src/Menu/Menu.php
Normal file
@ -0,0 +1,237 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_submenu
|
||||
*
|
||||
* @copyright (C) 2019 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Submenu\Administrator\Menu;
|
||||
|
||||
use Joomla\CMS\Component\ComponentHelper;
|
||||
use Joomla\CMS\Event\Menu\PreprocessMenuItemsEvent;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Language\Associations;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Menu\MenuItem;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
use Joomla\Component\Menus\Administrator\Helper\MenusHelper;
|
||||
use Joomla\Utilities\ArrayHelper;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper class to handle permissions in mod_submenu
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
abstract class Menu
|
||||
{
|
||||
/**
|
||||
* Filter and perform other preparatory tasks for loaded menu items based on access rights and module configurations for display
|
||||
*
|
||||
* @param MenuItem $parent A menu item to process
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public static function preprocess($parent)
|
||||
{
|
||||
$app = Factory::getApplication();
|
||||
$user = $app->getIdentity();
|
||||
$children = $parent->getChildren();
|
||||
$language = Factory::getLanguage();
|
||||
$dispatcher = $app->getDispatcher();
|
||||
|
||||
/**
|
||||
* Trigger onPreprocessMenuItems for the current level of backend menu items.
|
||||
* $children is an array of MenuItem objects. A plugin can traverse the whole tree,
|
||||
* but new nodes will only be run through this method if their parents have not been processed yet.
|
||||
*/
|
||||
$children = $dispatcher->dispatch('onPreprocessMenuItems', new PreprocessMenuItemsEvent('onPreprocessMenuItems', [
|
||||
'context' => 'administrator.module.mod_submenu',
|
||||
'subject' => &$children, // @todo: Remove reference in Joomla 6, see PreprocessMenuItemsEvent::__constructor()
|
||||
'params' => null,
|
||||
'enabled' => true,
|
||||
]))->getArgument('subject', $children);
|
||||
|
||||
foreach ($children as $item) {
|
||||
if (substr($item->link, 0, 8) === 'special:') {
|
||||
$special = substr($item->link, 8);
|
||||
|
||||
if ($special === 'language-forum') {
|
||||
$item->link = 'index.php?option=com_admin&view=help&layout=langforum';
|
||||
}
|
||||
}
|
||||
|
||||
$uri = new Uri($item->link);
|
||||
$query = $uri->getQuery(true);
|
||||
|
||||
/**
|
||||
* This is needed to populate the element property when the component is no longer
|
||||
* installed but its core menu items are left behind.
|
||||
*/
|
||||
if ($option = $uri->getVar('option')) {
|
||||
$item->element = $option;
|
||||
}
|
||||
|
||||
// Exclude item if is not enabled
|
||||
if ($item->element && !ComponentHelper::isEnabled($item->element)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Multilingual Associations if the site is not set as multilingual and/or Associations is not enabled in
|
||||
* the Language Filter plugin
|
||||
*/
|
||||
|
||||
if ($item->element === 'com_associations' && !Associations::isEnabled()) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
$itemParams = $item->getParams();
|
||||
|
||||
// Exclude item with menu item option set to exclude from menu modules
|
||||
if ($itemParams->get('menu-permission')) {
|
||||
@list($action, $asset) = explode(';', $itemParams->get('menu-permission'));
|
||||
|
||||
if (!$user->authorise($action, $asset)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Populate automatic children for container items
|
||||
if ($item->type === 'container') {
|
||||
$exclude = (array) $itemParams->get('hideitems') ?: [];
|
||||
$components = MenusHelper::getMenuItems('main', false, $exclude);
|
||||
|
||||
// We are adding the nodes first to preprocess them, then sort them and add them again.
|
||||
foreach ($components->getChildren() as $c) {
|
||||
if (!$c->hasChildren()) {
|
||||
$temp = clone $c;
|
||||
$c->addChild($temp);
|
||||
}
|
||||
|
||||
$item->addChild($c);
|
||||
}
|
||||
|
||||
self::preprocess($item);
|
||||
$children = ArrayHelper::sortObjects($item->getChildren(), 'text', 1, false, true);
|
||||
|
||||
foreach ($children as $c) {
|
||||
$parent->addChild($c);
|
||||
}
|
||||
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Exclude Mass Mail if disabled in global configuration
|
||||
if ($item->scope === 'massmail' && ($app->get('massmailoff', 0) == 1)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Exclude item if the component is not authorised
|
||||
$assetName = $item->element;
|
||||
|
||||
if ($item->element === 'com_categories') {
|
||||
$assetName = $query['extension'] ?? 'com_content';
|
||||
} elseif ($item->element === 'com_fields') {
|
||||
parse_str($item->link, $query);
|
||||
|
||||
// Only display Fields menus when enabled in the component
|
||||
$createFields = null;
|
||||
|
||||
if (isset($query['context'])) {
|
||||
$createFields = ComponentHelper::getParams(strstr($query['context'], '.', true))->get('custom_fields_enable', 1);
|
||||
}
|
||||
|
||||
if (!$createFields || !$user->authorise('core.manage', 'com_users')) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
} elseif ($item->element === 'com_workflow') {
|
||||
parse_str($item->link, $query);
|
||||
|
||||
// Only display Workflow menus when enabled in the component
|
||||
$workflow = null;
|
||||
|
||||
if (isset($query['extension'])) {
|
||||
$parts = explode('.', $query['extension']);
|
||||
|
||||
$workflow = ComponentHelper::getParams($parts[0])->get('workflow_enabled') && $user->authorise('core.manage.workflow', $parts[0]);
|
||||
}
|
||||
|
||||
if (!$workflow) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
[$assetName] = isset($query['extension']) ? explode('.', $query['extension'], 2) : ['com_workflow'];
|
||||
} elseif (\in_array($item->element, ['com_config', 'com_privacy', 'com_actionlogs'], true) && !$user->authorise('core.admin')) {
|
||||
// Special case for components which only allow super user access
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
} elseif ($item->element === 'com_joomlaupdate' && !$user->authorise('core.admin')) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
} elseif (
|
||||
($item->link === 'index.php?option=com_installer&view=install' || $item->link === 'index.php?option=com_installer&view=languages')
|
||||
&& !$user->authorise('core.admin')
|
||||
) {
|
||||
continue;
|
||||
} elseif ($item->element === 'com_admin') {
|
||||
parse_str($item->link, $query);
|
||||
|
||||
if (isset($query['view']) && $query['view'] === 'sysinfo' && !$user->authorise('core.admin')) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
} elseif ($item->element === 'com_menus') {
|
||||
// Get badges for Menus containing a Home page.
|
||||
$iconImage = $item->icon;
|
||||
|
||||
if ($iconImage) {
|
||||
if (substr($iconImage, 0, 6) === 'class:' && substr($iconImage, 6) === 'icon-home') {
|
||||
$iconImage = '<span class="home-image icon-home" aria-hidden="true"></span>';
|
||||
$iconImage .= '<span class="visually-hidden">' . Text::_('JDEFAULT') . '</span>';
|
||||
} elseif (substr($iconImage, 0, 6) === 'image:') {
|
||||
$iconImage = ' <span class="badge bg-secondary">' . substr($iconImage, 6) . '</span>';
|
||||
}
|
||||
|
||||
$item->iconImage = $iconImage;
|
||||
}
|
||||
}
|
||||
|
||||
if ($assetName && !$user->authorise(($item->scope === 'edit') ? 'core.create' : 'core.manage', $assetName)) {
|
||||
$parent->removeChild($item);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($item->hasChildren()) {
|
||||
self::preprocess($item);
|
||||
}
|
||||
|
||||
// Ok we passed everything, load language at last only
|
||||
if ($item->element) {
|
||||
$language->load($item->element . '.sys', JPATH_ADMINISTRATOR) ||
|
||||
$language->load($item->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $item->element);
|
||||
}
|
||||
|
||||
if ($item->type === 'separator' && $item->getParams()->get('text_separator') == 0) {
|
||||
$item->title = '';
|
||||
}
|
||||
|
||||
$item->text = Text::_($item->title);
|
||||
}
|
||||
}
|
||||
}
|
||||
123
administrator/modules/mod_submenu/tmpl/default.php
Normal file
123
administrator/modules/mod_submenu/tmpl/default.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_submenu
|
||||
*
|
||||
* @copyright (C) 2010 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
|
||||
$user = $app->getIdentity();
|
||||
|
||||
/** @var \Joomla\CMS\Menu\MenuItem $root */
|
||||
?>
|
||||
<?php foreach ($root->getChildren() as $child) : ?>
|
||||
<?php if ($child->hasChildren()) : ?>
|
||||
<div class="module-wrapper">
|
||||
<div class="card">
|
||||
<?php
|
||||
$child->img = $child->img ?? '';
|
||||
|
||||
if (substr($child->img, 0, 6) === 'class:') {
|
||||
$iconImage = '<span class="icon-' . substr($child->img, 6) . '" aria-hidden="true"></span>';
|
||||
} elseif (substr($child->img, 0, 6) === 'image:') {
|
||||
$iconImage = '<img src="' . substr($child->img, 6) . '" aria-hidden="true">';
|
||||
} elseif (!empty($child->img)) {
|
||||
$iconImage = '<img src="' . $child->img . '" aria-hidden="true">';
|
||||
} elseif ($child->icon) {
|
||||
$iconImage = '<span class="icon-' . $child->icon . '" aria-hidden="true"></span>';
|
||||
} else {
|
||||
$iconImage = '';
|
||||
}
|
||||
?>
|
||||
<h2 class="card-header">
|
||||
<?php echo $iconImage; ?>
|
||||
<?php echo Text::_($child->title); ?>
|
||||
</h2>
|
||||
<ul class="list-group list-group-flush">
|
||||
<?php foreach ($child->getChildren() as $item) : ?>
|
||||
<?php $params = $item->getParams(); ?>
|
||||
<?php // Only if Menu-show = true ?>
|
||||
<?php if ($params->get('menu_show', 1)) : ?>
|
||||
<li class="list-group-item d-flex align-items-center">
|
||||
<?php $class = $params->get('menu-quicktask') ? '' : 'class="flex-grow-1"'; ?>
|
||||
<a <?php echo $class; ?> href="<?php echo $item->link; ?>"
|
||||
<?php echo $item->target === '_blank' ? ' title="' . Text::sprintf('JBROWSERTARGET_NEW_TITLE', Text::_($item->title)) . '"' : ''; ?>
|
||||
<?php echo $item->target ? ' target="' . $item->target . '"' : ''; ?>>
|
||||
<?php if (!empty($params->get('menu_image'))) : ?>
|
||||
<?php
|
||||
$image = htmlspecialchars($params->get('menu_image'), ENT_QUOTES, 'UTF-8');
|
||||
$class = htmlspecialchars($params->get('menu_image_css'), ENT_QUOTES, 'UTF-8');
|
||||
$alt = $params->get('menu_text') ? '' : htmlspecialchars(Text::_($item->title), ENT_QUOTES, 'UTF-8');
|
||||
?>
|
||||
<?php echo HTMLHelper::_('image', $image, $alt, 'class="' . $class . '"'); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo ($params->get('menu_text', 1)) ? htmlspecialchars(Text::_($item->title), ENT_QUOTES, 'UTF-8') : ''; ?>
|
||||
<?php if ($item->ajaxbadge) : ?>
|
||||
<span class="menu-badge">
|
||||
<span class="icon-spin icon-spinner mt-1 system-counter float-end" data-url="<?php echo $item->ajaxbadge; ?>"></span>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php echo $item->iconImage; ?>
|
||||
<?php if ($params->get('menu-quicktask')) : ?>
|
||||
<?php $permission = $params->get('menu-quicktask-permission'); ?>
|
||||
<?php $scope = $item->scope !== 'default' ? $item->scope : null; ?>
|
||||
<?php if (!$permission || $user->authorise($permission, $scope)) : ?>
|
||||
<span class="menu-quicktask">
|
||||
<?php
|
||||
$link = $params->get('menu-quicktask');
|
||||
$icon = $params->get('menu-quicktask-icon', 'plus');
|
||||
|
||||
$title = Text::_($params->get('menu-quicktask-title'));
|
||||
|
||||
if (empty($params->get('menu-quicktask-title'))) {
|
||||
$title = Text::_('MOD_MENU_QUICKTASK_NEW');
|
||||
}
|
||||
|
||||
$sronly = Text::_($item->title) . ' - ' . $title;
|
||||
?>
|
||||
<a href="<?php echo $link; ?>">
|
||||
<span class="icon-<?php echo $icon; ?>" title="<?php echo htmlentities($title); ?>" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo htmlentities($sronly); ?></span>
|
||||
</a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ($item->dashboard) : ?>
|
||||
<span class="menu-dashboard">
|
||||
<?php
|
||||
$titleDashboard = Text::sprintf('MOD_MENU_DASHBOARD_LINK', Text::_($child->title));
|
||||
|
||||
// Prepare the Dashboard icon. We use our own icon, not Fontawesome
|
||||
$pathDashboard = 'media/templates/administrator/atum/images/icons/dashboard.svg';
|
||||
$attrDashboard = [
|
||||
'loading' => 'eager',
|
||||
'decoding' => 'async',
|
||||
'aria-hidden' => 'true',
|
||||
'class' => 'atum-dashboard',
|
||||
'height' => '18',
|
||||
];
|
||||
$iconDashboard = HTMLHelper::_('image', $pathDashboard, '', $attrDashboard, false, 0);
|
||||
?>
|
||||
<a href="<?php echo Route::_('index.php?option=com_cpanel&view=cpanel&dashboard=' . $item->dashboard); ?>" title="<?php echo $titleDashboard; ?>">
|
||||
<span><?php echo $iconDashboard; ?></span>
|
||||
<span class="visually-hidden"><?php echo $titleDashboard; ?></span>
|
||||
</a>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
20
administrator/modules/mod_title/mod_title.php
Normal file
20
administrator/modules/mod_title/mod_title.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_title
|
||||
*
|
||||
* @copyright (C) 2006 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;
|
||||
|
||||
// Get the component title div
|
||||
if (isset($app->JComponentTitle)) {
|
||||
$title = $app->JComponentTitle;
|
||||
}
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_title', $params->get('layout', 'default'));
|
||||
42
administrator/modules/mod_title/mod_title.xml
Normal file
42
administrator/modules/mod_title/mod_title.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_title</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-11</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_TITLE_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_title">mod_title.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_title.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_title.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Title" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
19
administrator/modules/mod_title/tmpl/default.php
Normal file
19
administrator/modules/mod_title/tmpl/default.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_title
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<?php if (!empty($title)) : ?>
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="container-title">
|
||||
<?php echo $title; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
20
administrator/modules/mod_toolbar/mod_toolbar.php
Normal file
20
administrator/modules/mod_toolbar/mod_toolbar.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_toolbar
|
||||
*
|
||||
* @copyright (C) 2005 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\Factory;
|
||||
use Joomla\CMS\Helper\ModuleHelper;
|
||||
|
||||
/** @var $params Joomla\Registry\Registry */
|
||||
|
||||
$toolbar = Factory::getApplication()->getDocument()->getToolbar($params->get('toolbar', 'toolbar'))->render();
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_toolbar', $params->get('layout', 'default'));
|
||||
52
administrator/modules/mod_toolbar/mod_toolbar.xml
Normal file
52
administrator/modules/mod_toolbar/mod_toolbar.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_toolbar</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2005-11</creationDate>
|
||||
<copyright>(C) 2005 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.0.0</version>
|
||||
<description>MOD_TOOLBAR_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_toolbar">mod_toolbar.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_toolbar.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_toolbar.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Toolbar" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field
|
||||
name="toolbar"
|
||||
type="text"
|
||||
default="toolbar"
|
||||
label="MOD_TOOLBAR_FIELD_TOOLBAR_LABEL"
|
||||
description="MOD_TOOLBAR_FIELD_TOOLBAR_DESCRIPTION"
|
||||
/>
|
||||
</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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
14
administrator/modules/mod_toolbar/tmpl/default.php
Normal file
14
administrator/modules/mod_toolbar/tmpl/default.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_toolbar
|
||||
*
|
||||
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
// Echo the toolbar.
|
||||
echo $toolbar;
|
||||
17
administrator/modules/mod_user/mod_user.php
Normal file
17
administrator/modules/mod_user/mod_user.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_user
|
||||
*
|
||||
* @copyright (C) 2006 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;
|
||||
|
||||
$user = $app->getIdentity();
|
||||
|
||||
require ModuleHelper::getLayoutPath('mod_user', $params->get('layout', 'default'));
|
||||
41
administrator/modules/mod_user/mod_user.xml
Normal file
41
administrator/modules/mod_user/mod_user.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_user</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2019-07</creationDate>
|
||||
<copyright>(C) 2019 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>4.0.0</version>
|
||||
<description>MOD_USER_XML_DESCRIPTION</description>
|
||||
<files>
|
||||
<filename module="mod_user">mod_user.php</filename>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_user.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_user.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_User_Menu" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="advanced">
|
||||
<field
|
||||
name="layout"
|
||||
type="modulelayout"
|
||||
label="JFIELD_ALT_LAYOUT_LABEL"
|
||||
class="form-select"
|
||||
/>
|
||||
|
||||
<field
|
||||
name="moduleclass_sfx"
|
||||
type="textarea"
|
||||
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
|
||||
rows="3"
|
||||
validate="CssIdentifier"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
61
administrator/modules/mod_user/tmpl/default.php
Normal file
61
administrator/modules/mod_user/tmpl/default.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_user
|
||||
*
|
||||
* @copyright (C) 2019 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;
|
||||
use Joomla\CMS\Router\Route;
|
||||
use Joomla\CMS\Session\Session;
|
||||
use Joomla\CMS\Uri\Uri;
|
||||
|
||||
$hideLinks = $app->getInput()->getBool('hidemainmenu');
|
||||
|
||||
if ($hideLinks) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the Bootstrap Dropdown
|
||||
HTMLHelper::_('bootstrap.dropdown', '.dropdown-toggle');
|
||||
?>
|
||||
<div class="header-item-content dropdown header-profile">
|
||||
<button class="dropdown-toggle d-flex align-items-center ps-0 py-0" data-bs-toggle="dropdown" type="button"
|
||||
title="<?php echo Text::_('MOD_USER_MENU'); ?>">
|
||||
<span class="header-item-icon">
|
||||
<span class="icon-user-circle" aria-hidden="true"></span>
|
||||
</span>
|
||||
<span class="header-item-text">
|
||||
<?php echo Text::_('MOD_USER_MENU'); ?>
|
||||
</span>
|
||||
<span class="icon-angle-down" aria-hidden="true"></span>
|
||||
</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<div class="dropdown-header">
|
||||
<span class="icon-user-circle icon-fw" aria-hidden="true"></span>
|
||||
<?php echo Text::sprintf('MOD_USER_TITLE', $user->name); ?>
|
||||
</div>
|
||||
<?php $uri = Uri::getInstance(); ?>
|
||||
<?php $route = 'index.php?option=com_users&task=user.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-user_details'; ?>
|
||||
<a class="dropdown-item" href="<?php echo Route::_($route); ?>">
|
||||
<span class="icon-user icon-fw" aria-hidden="true"></span>
|
||||
<?php echo Text::_('MOD_USER_EDIT_ACCOUNT'); ?>
|
||||
</a>
|
||||
<?php $route = 'index.php?option=com_users&task=user.edit&id=' . $user->id . '&return=' . base64_encode($uri) . '#attrib-accessibility'; ?>
|
||||
<a class="dropdown-item" href="<?php echo Route::_($route); ?>">
|
||||
<span class="icon-universal-access icon-fw" aria-hidden="true"></span>
|
||||
<?php echo Text::_('MOD_USER_ACCESSIBILITY_SETTINGS'); ?>
|
||||
</a>
|
||||
<?php $route = 'index.php?option=com_login&task=logout&' . Session::getFormToken() . '=1'; ?>
|
||||
<a class="dropdown-item" href="<?php echo Route::_($route); ?>">
|
||||
<span class="icon-power-off icon-fw" aria-hidden="true"></span>
|
||||
<?php echo Text::_('JLOGOUT'); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
15
administrator/modules/mod_version/mod_version.php
Normal file
15
administrator/modules/mod_version/mod_version.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_version
|
||||
*
|
||||
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
$version = \Joomla\Module\Version\Administrator\Helper\VersionHelper::getVersion();
|
||||
|
||||
require \Joomla\CMS\Helper\ModuleHelper::getLayoutPath('mod_version', $params->get('layout', 'default'));
|
||||
44
administrator/modules/mod_version/mod_version.xml
Normal file
44
administrator/modules/mod_version/mod_version.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extension type="module" client="administrator" method="upgrade">
|
||||
<name>mod_version</name>
|
||||
<author>Joomla! Project</author>
|
||||
<creationDate>2012-01</creationDate>
|
||||
<copyright>(C) 2012 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.0.0</version>
|
||||
<description>MOD_VERSION_XML_DESCRIPTION</description>
|
||||
<namespace path="src">Joomla\Module\Version</namespace>
|
||||
<files>
|
||||
<filename module="mod_version">mod_version.php</filename>
|
||||
<folder>src</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
<languages>
|
||||
<language tag="en-GB">language/en-GB/mod_version.ini</language>
|
||||
<language tag="en-GB">language/en-GB/mod_version.sys.ini</language>
|
||||
</languages>
|
||||
<help key="Admin_Modules:_Joomla_Version_Information" />
|
||||
<config>
|
||||
<fields name="params">
|
||||
<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"
|
||||
/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
</extension>
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_version
|
||||
*
|
||||
* @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Module\Version\Administrator\Helper;
|
||||
|
||||
use Joomla\CMS\Version;
|
||||
|
||||
// phpcs:disable PSR1.Files.SideEffects
|
||||
\defined('_JEXEC') or die;
|
||||
// phpcs:enable PSR1.Files.SideEffects
|
||||
|
||||
/**
|
||||
* Helper for mod_version
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
abstract class VersionHelper
|
||||
{
|
||||
/**
|
||||
* Get the Joomla version number.
|
||||
*
|
||||
* @return string String containing the current Joomla version.
|
||||
*/
|
||||
public static function getVersion()
|
||||
{
|
||||
$version = new Version();
|
||||
|
||||
return '‎' . $version->getShortVersion();
|
||||
}
|
||||
}
|
||||
22
administrator/modules/mod_version/tmpl/default.php
Normal file
22
administrator/modules/mod_version/tmpl/default.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage mod_version
|
||||
*
|
||||
* @copyright (C) 2012 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\Language\Text;
|
||||
|
||||
?>
|
||||
<div class="header-item-content joomlaversion">
|
||||
<div class="header-item-text no-link">
|
||||
<span class="icon-joomla" aria-hidden="true"></span>
|
||||
<span class="visually-hidden"><?php echo Text::sprintf('MOD_VERSION_CURRENT_VERSION_TEXT', $version); ?></span>
|
||||
<span aria-hidden="true"><?php echo $version; ?></span>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user