Files
MokoSuiteCross/source/packages/com_mokosuitecross/src/View/Dashboard/HtmlView.php
T
jmiller d6848e6b90
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 11s
fix: resolve 10 critical/medium bugs from deep dive audit
- deleteFromPlatforms(): use CredentialHelper::decrypt() + Joomla 6
  dispatcher pattern instead of json_decode + deprecated triggerEvent (#226, #228)
- PostsController: add ACL checks on retryFailed/purgePosted (#224)
- QueueProcessor: recover stale posting entries stuck >10min (#235)
- onContentChangeState: respect post_on_first_publish_only (#238)
- Uninstall SQL: add analytics + category_rules table drops (#225)
- Dashboard/Calendar: remove deprecated Sidebar::render() (#250)
- AnalyticsHelper: rewrite AJAX endpoints to query posts table (#246)
- Submenu helper: remove duplicate calendar key (#248)
- CHANGELOG: remove 3 duplicate version headers (#240)

Authored-by: Moko Consulting

Claude-Session: https://claude.ai/code/session_014iwLv3vUVsSxP8LyZ6STTj
2026-06-29 11:27:48 -05:00

75 lines
2.2 KiB
PHP

<?php
/**
* @package MokoSuiteCross
* @subpackage com_mokosuitecross
* @author Moko Consulting <hello@mokoconsulting.tech>
* @copyright Copyright (C) 2026 Moko Consulting. All rights reserved.
* @license GNU General Public License version 3 or later; see LICENSE
* SPDX-License-Identifier: GPL-3.0-or-later
*/
namespace Joomla\Component\MokoSuiteCross\Administrator\View\Dashboard;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\Component\MokoSuiteCross\Administrator\Helper\MokoSuiteCrossHelper;
class HtmlView extends BaseHtmlView
{
protected $stats;
protected $migrationAvailable;
protected $recentActivity;
protected $serviceBreakdown;
protected $dailyTrend;
protected $topArticles;
public $period;
public function display($tpl = null): void
{
$model = $this->getModel();
// Read period parameter for date range filtering
$this->period = Factory::getApplication()->input->getInt('period', 30);
$validPeriods = [7, 30, 90, 0];
if (!in_array($this->period, $validPeriods, true)) {
$this->period = 30;
}
// Calculate the since date based on period (0 = all time)
$since = null;
if ($this->period > 0) {
$since = Factory::getDate('now - ' . $this->period . ' days')->toSql();
}
$this->stats = $this->get('Stats');
$this->migrationAvailable = $this->get('MigrationAvailable');
$this->recentActivity = $model->getRecentActivity(10);
$this->serviceBreakdown = $model->getServiceBreakdown($since);
$this->dailyTrend = $model->getDailyTrend($this->period ?: 365);
$this->topArticles = $model->getTopArticles(5, $since);
$this->addToolbar();
MokoSuiteCrossHelper::addSubmenu('dashboard');
parent::display($tpl);
}
protected function addToolbar(): void
{
$canDo = MokoSuiteCrossHelper::getActions();
ToolbarHelper::title('MokoSuiteCross — Dashboard', 'share-alt');
if ($canDo->get('core.admin')) {
ToolbarHelper::preferences('com_mokosuitecross');
}
}
}