getModel(); $this->plugins = $model->getFeaturePlugins(); $this->siteInfo = $model->getSiteInfo(); // Daily support PIN from health token try { $db = \Joomla\CMS\Factory::getDbo(); $db->setQuery( $db->getQuery(true) ->select($db->quoteName('params')) ->from($db->quoteName('#__extensions')) ->where($db->quoteName('element') . ' = ' . $db->quote('mokosuiteclient')) ->where($db->quoteName('type') . ' = ' . $db->quote('plugin')) ->where($db->quoteName('folder') . ' = ' . $db->quote('system')) ); $token = (json_decode((string) $db->loadResult()))->health_api_token ?? ''; if (!empty($token)) { $hash = hash_hmac('sha256', gmdate('Y-m-d'), $token); $this->supportPin = 'MOKO-' . strtoupper(substr($hash, 0, 4)) . '-' . strtoupper(substr($hash, 4, 4)); } } catch (\Throwable $e) {} $this->recentLogins = $model->getRecentLogins(5); $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'); } } }