68dd129c0f
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 7s
Generic: Repo Health / Access control (pull_request) Successful in 1s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Universal: PR Check / Validate PR (pull_request) Failing after 9s
Generic: Project CI / Lint & Validate (pull_request) Successful in 14s
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 16s
Universal: Auto Version Bump / Version Bump (push) Successful in 14s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 13s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 19s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 35s
Generic: Project CI / Tests (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Has been cancelled
Joomla: Extension CI / PHPStan Analysis (pull_request) Has been cancelled
Joomla: Extension CI / Build RC Pre-Release (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
- htmlspecialchars() on all icon/title output in menu module - SPDX license header on cache Dispatcher - Moved orphaned requestNew() docblock to correct location - Replaced deprecated Factory::getDbo() with DI container pattern Claude-Session: https://claude.ai/code/session_01Jo2JpjCwfHAh2HHRSjczKq
103 lines
3.7 KiB
PHP
103 lines
3.7 KiB
PHP
<?php
|
|
/**
|
|
* @package MokoSuiteClient
|
|
* @subpackage com_mokosuiteclient
|
|
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
|
|
* @license GNU General Public License version 3 or later; see LICENSE
|
|
*/
|
|
|
|
namespace Moko\Component\MokoSuiteClient\Administrator\View\Dashboard;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
|
|
|
class HtmlView extends BaseHtmlView
|
|
{
|
|
protected $plugins = [];
|
|
protected $siteInfo;
|
|
protected $recentLogins = [];
|
|
protected $pendingUpdates = [];
|
|
protected $checkedOutItems = [];
|
|
protected $wafBlocks = [];
|
|
protected $wafChartData = [];
|
|
protected $loginChartData = [];
|
|
protected $mokoExtensions = [];
|
|
public $supportPin = '';
|
|
public $supportPinAvailable = false;
|
|
public $regularLabsAvailable = false;
|
|
|
|
public function display($tpl = null)
|
|
{
|
|
$model = $this->getModel();
|
|
|
|
$this->plugins = $model->getFeaturePlugins();
|
|
$this->siteInfo = $model->getSiteInfo();
|
|
|
|
// Daily support PIN from health token
|
|
$pinState = \Moko\Component\MokoSuiteClient\Administrator\Helper\SupportPinHelper::getState(
|
|
\Joomla\CMS\Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class)
|
|
);
|
|
$this->supportPinAvailable = $pinState['available'];
|
|
$this->supportPin = $pinState['pin'];
|
|
|
|
// Detect Regular Labs data for import (source table must exist AND our destination table)
|
|
try {
|
|
$rlDb = \Joomla\CMS\Factory::getContainer()->get(\Joomla\Database\DatabaseInterface::class);
|
|
$rlTables = $rlDb->getTableList();
|
|
$rlPrefix = $rlDb->getPrefix();
|
|
$this->regularLabsAvailable =
|
|
(in_array($rlPrefix . 'conditions', $rlTables) && in_array($rlPrefix . 'mokosuiteclient_conditions', $rlTables))
|
|
|| (in_array($rlPrefix . 'snippets', $rlTables) && in_array($rlPrefix . 'mokosuiteclient_snippets', $rlTables))
|
|
|| (in_array($rlPrefix . 'rereplacer', $rlTables) && in_array($rlPrefix . 'mokosuiteclient_replacements', $rlTables))
|
|
|| (in_array($rlPrefix . 'contenttemplater', $rlTables) && in_array($rlPrefix . 'mokosuiteclient_content_templates', $rlTables));
|
|
} catch (\Throwable $e) {}
|
|
|
|
$this->recentLogins = $model->getRecentLogins(10);
|
|
$this->pendingUpdates = $model->getPendingUpdates();
|
|
$this->checkedOutItems = $model->getCheckedOutItems();
|
|
$this->wafBlocks = $model->getRecentWafBlocks(5);
|
|
$this->wafChartData = $model->getWafBlocksByDay(14);
|
|
$this->loginChartData = $model->getLoginsByDay(14);
|
|
$this->mokoExtensions = $model->getMokoExtensions();
|
|
|
|
// Check for importable Akeeba data
|
|
try
|
|
{
|
|
$importModel = new \Moko\Component\MokoSuiteClient\Administrator\Model\ImportModel();
|
|
$this->adminToolsAvailable = $importModel->checkAdminToolsAvailable();
|
|
$this->atsAvailable = $importModel->checkAtsAvailable();
|
|
}
|
|
catch (\Throwable $e)
|
|
{
|
|
$this->adminToolsAvailable = null;
|
|
$this->atsAvailable = null;
|
|
}
|
|
|
|
$this->addToolbar();
|
|
|
|
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
|
|
$wa->registerAndUseStyle('com_mokosuiteclient.dashboard', 'com_mokosuiteclient/dashboard.css');
|
|
$wa->registerAndUseScript('com_mokosuiteclient.dashboard', 'com_mokosuiteclient/dashboard.js', [], ['defer' => true]);
|
|
|
|
parent::display($tpl);
|
|
}
|
|
|
|
protected function addToolbar(): void
|
|
{
|
|
ToolbarHelper::title(Text::_('COM_MOKOSUITECLIENT_DASHBOARD_TITLE'), 'cogs');
|
|
|
|
$user = Factory::getApplication()->getIdentity();
|
|
|
|
if ($user->authorise('core.admin', 'com_mokosuiteclient'))
|
|
{
|
|
ToolbarHelper::preferences('com_mokosuiteclient');
|
|
}
|
|
|
|
ToolbarHelper::help('', false, 'https://git.mokoconsulting.tech/MokoConsulting/MokoSuiteClient/wiki/Dashboard');
|
|
}
|
|
}
|