dd4de77202
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 20s
Universal: PR Check / Validate PR (pull_request) Failing after 8s
Universal: PR Check / Secret Scan (pull_request) Successful in 10s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 46s
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
- Add 'calendar' and 'analytics' entries to MokoSuiteCrossHelper submenu - Add COM_MOKOSUITECROSS_CALENDAR_PREV_MONTH/NEXT_MONTH/TODAY strings - Add COM_MOKOSUITECROSS_SUBMENU_CALENDAR string Authored-by: Moko Consulting
66 lines
2.0 KiB
PHP
66 lines
2.0 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\Analytics;
|
|
|
|
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
|
|
{
|
|
public $heatmap;
|
|
public $bestTimes;
|
|
public $hourlyDistribution;
|
|
public $dayDistribution;
|
|
public $services;
|
|
public $serviceId;
|
|
public $period;
|
|
|
|
public function display($tpl = null): void
|
|
{
|
|
/** @var \Joomla\Component\MokoSuiteCross\Administrator\Model\AnalyticsModel $model */
|
|
$model = $this->getModel();
|
|
|
|
$input = Factory::getApplication()->input;
|
|
$this->period = $input->getInt('period', 90);
|
|
$this->serviceId = $input->getInt('service_id', 0);
|
|
|
|
$validPeriods = [7, 30, 90, 180, 365];
|
|
|
|
if (!\in_array($this->period, $validPeriods, true)) {
|
|
$this->period = 90;
|
|
}
|
|
|
|
$sid = $this->serviceId > 0 ? $this->serviceId : null;
|
|
|
|
$this->heatmap = $model->getHeatmap($this->period, $sid);
|
|
$this->bestTimes = $model->getBestTimes($this->period, $sid);
|
|
$this->hourlyDistribution = $model->getHourlyDistribution($this->period, $sid);
|
|
$this->dayDistribution = $model->getDayOfWeekDistribution($this->period, $sid);
|
|
$this->services = $model->getServices();
|
|
|
|
$this->addToolbar();
|
|
|
|
MokoSuiteCrossHelper::addSubmenu('analytics');
|
|
|
|
parent::display($tpl);
|
|
}
|
|
|
|
protected function addToolbar(): void
|
|
{
|
|
ToolbarHelper::title('MokoSuiteCross -- Analytics', 'chart');
|
|
}
|
|
}
|