diff options
author | Christian Hofmaier | 2016-12-12 18:30:28 +0100 |
---|---|---|
committer | Christian Hofmaier | 2016-12-12 18:30:28 +0100 |
commit | 8c57a58760c716fa2ad8387ef8ba4eaac8b741a6 (patch) | |
tree | 956c9ffc5e1ddd7ed2e8a0fcb3375c356710c4a0 /modules-available/statistics_reporting/page.inc.php | |
parent | Merge branch 'master' of git.openslx.org:openslx-ng/slx-admin into statistics... (diff) | |
download | slx-admin-8c57a58760c716fa2ad8387ef8ba4eaac8b741a6.tar.gz slx-admin-8c57a58760c716fa2ad8387ef8ba4eaac8b741a6.tar.xz slx-admin-8c57a58760c716fa2ad8387ef8ba4eaac8b741a6.zip |
[statistics_reporting] edited time bound possibility
Diffstat (limited to 'modules-available/statistics_reporting/page.inc.php')
-rw-r--r-- | modules-available/statistics_reporting/page.inc.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index e009317c..9417d2da 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -1,11 +1,9 @@ <?php + class Page_Statistics_Reporting extends Page { - private $cutOffTimer; - - /** * Called before any page rendering happens - early hook to check parameters etc. */ @@ -24,24 +22,28 @@ class Page_Statistics_Reporting extends Page */ protected function doRender() { - // timespan you want to see = Days selected * seconds per Day + // timespan you want to see = Days selected * seconds per Day (86400) // default = 14 days $cutOff = Request::get('cutoff', 14, 'int'); - $chooserData = array('cutoff' => $cutOff); - $this->cutOffTimer = $cutOff * 86400; + $cutOffTimer = $cutOff * 86400; + + $lowerTimeBound = Request::get('lower', 0, 'int'); + + $upperTimeBound = Request::get('upper', 24, 'int'); // total time online, average time online, total number of logins - $res = StatisticReporting::getOverallStatistics($this->cutOffTimer); + $res = StatisticReporting::getOverallStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $row = $res->fetch(PDO::FETCH_NUM); $data = array('time' => StatisticReporting::formatSeconds($row[0]), 'avgTime' => StatisticReporting::formatSeconds($row[1]), 'totalLogins' => $row[2]); + //total time offline - $res = StatisticReporting::getTotalOfflineStatistics($this->cutOffTimer); + $res = StatisticReporting::getTotalOfflineStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $row = $res->fetch(PDO::FETCH_NUM); $data = array_merge($data, array('totalOfftime' => StatisticReporting::formatSeconds($row[0]))); // per location - $res = StatisticReporting::getLocationStatistics($this->cutOffTimer); + $res = StatisticReporting::getLocationStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $data[] = array('perLocation' => array()); while ($row = $res->fetch(PDO::FETCH_NUM)) { $data['perLocation'][] = array('location' => $row[0], 'time' => StatisticReporting::formatSeconds($row[1]), 'timeInSeconds' => $row[1], @@ -49,7 +51,7 @@ class Page_Statistics_Reporting extends Page } // per client - $res = StatisticReporting::getClientStatistics($this->cutOffTimer); + $res = StatisticReporting::getClientStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $data[] = array('perClient' => array()); while ($row = $res->fetch(PDO::FETCH_NUM)) { $data['perClient'][] = array('hostname' => $row[0], 'time' => StatisticReporting::formatSeconds($row[1]), 'timeInSeconds' => $row[1], @@ -58,20 +60,20 @@ class Page_Statistics_Reporting extends Page } // per user - $res = StatisticReporting::getUserStatistics($this->cutOffTimer); + $res = StatisticReporting::getUserStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $data[] = array('perUser' => array()); while ($row = $res->fetch(PDO::FETCH_NUM)) { $data['perUser'][] = array('user' => $row[0], 'loginCount' => $row[1]); } // per vm - $res = StatisticReporting::getVMStatistics($this->cutOffTimer); + $res = StatisticReporting::getVMStatistics($cutOffTimer, $lowerTimeBound, $upperTimeBound); $data[] = array('perVM' => array()); while ($row = $res->fetch(PDO::FETCH_NUM)) { $data['perVM'][] = array('vm' => $row[0], 'loginCount' => $row[1]); } - Render::addTemplate('columnChooser', $chooserData); + Render::addTemplate('columnChooser'); Render::addTemplate('_page', $data); } } |