<?php
namespace App\Dashboard\Widget; class ServerLoadLogs extends \App\Dashboard\Widget\Charts\ServerStats { protected function populateLocalOptionsForm(\Engine\Form\Container\GeneralAbstract $form) { return $form; } protected function getServerStatsData($selectDate) { $calledClass = get_called_class(); $className = stripClassNamespace($calledClass); $loaderLang = \App\Loader_Lang::getInstance(); $loaderLang->loadAppFile("_customLoad/dashboard/widgets/_general.lang.php"); $loaderLang->loadAppFile("_customLoad/dashboard/widgets/{$className}.lang.php"); $_LANG = $loaderLang->getAll(); $output = []; global $DBTServerStats; $db = \DB::getInstance(); $startTimeToday = \Engine\DateTime::createFromIsoDatetime($selectDate." 00:00:00")->formatTime(); $currentTimeToday = \Engine\DateTime::createFromIsoDatetime($selectDate." 23:59:59")->formatTime(); $query = "SELECT `timestamp`, `serverLoad` AS value FROM `$DBTServerStats` WHERE timestamp >=? AND  timestamp <=? ORDER BY timestamp ASC"; $serverStatsReport = $db->Execute($query, [$startTimeToday, $currentTimeToday]); $rows = $serverStatsReport->GetRows(); if (!count($rows)) { $output['errorMessage']=$_LANG['dashboard']['widgetsList'][__NAMESPACE__."\\ServerLoadLogs"]['msgs']['noDBData']; return $output; } $output['values'] = $rows; return $output; } } 