primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -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',
]);
}

View File

@ -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>

View File

@ -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 [];
}
}
}

View 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; ?>