From 9ccef127acd6dca0971e12726b019e2beaf7e4ce Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Thu, 12 Jan 2017 12:41:21 +0100 Subject: [statistics_reporting] moved some functions to a new class --- .../statistics_reporting/page.inc.php | 55 ++++------------------ 1 file changed, 8 insertions(+), 47 deletions(-) (limited to 'modules-available/statistics_reporting/page.inc.php') diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index e2c76b09..82c03acc 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -24,55 +24,16 @@ class Page_Statistics_Reporting extends Page { // timespan you want to see = Days selected * seconds per Day (86400) // default = 14 days - $cutOff = Request::get('cutoff', 14, 'int') - 1; + GetData::$cutOff = Request::get('cutoff', 14, 'int') - 1; + GetData::$lowerTimeBound = Request::get('lower', 0, 'int'); + GetData::$upperTimeBound = Request::get('upper', 24, 'int'); - $lowerTimeBound = Request::get('lower', 0, 'int'); + $data = array_merge(GetData::total(), array('perLocation' => array(), 'perClient' => array(), 'perUser' => array(), 'perVM' => array())); + $data['perLocation'] = GetData::perLocation(); + $data['perClient'] = GetData::perClient(); + $data['perUser'] = GetData::perUser(); + $data['perVM'] = GetData::perVM(); - $upperTimeBound = Request::get('upper', 24, 'int'); - - - // total time online, average time online, total number of logins - $res = StatisticReporting::getOverallStatistics($cutOff, $lowerTimeBound, $upperTimeBound); - $row = $res->fetch(PDO::FETCH_ASSOC); - $data = array('time' => StatisticReporting::formatSeconds($row['sum']), 'medianTime' => StatisticReporting::formatSeconds(StatisticReporting::calcMedian($row['median'])), 'sessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions']); - - //total time offline - $res = StatisticReporting::getTotalOfflineStatistics($cutOff, $lowerTimeBound, $upperTimeBound); - $row = $res->fetch(PDO::FETCH_ASSOC); - $data = array_merge($data, array('totalOfftime' => StatisticReporting::formatSeconds($row['timeOff']))); - - // per location - $res = StatisticReporting::getLocationStatistics($cutOff, $lowerTimeBound, $upperTimeBound); - $data[] = array('perLocation' => array()); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $median = StatisticReporting::calcMedian(StatisticReporting::calcMedian($row['medianTime'])); - $data['perLocation'][] = array('location' => $row['locName'], 'time' => StatisticReporting::formatSeconds($row['timeSum']), 'timeInSeconds' => $row['timeSum'], - 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row['offlineSum']), 'offlineTimeInSeconds' => $row['offlineSum'], 'sessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions']); - } - - // per client - $res = StatisticReporting::getClientStatistics($cutOff, $lowerTimeBound, $upperTimeBound); - $data[] = array('perClient' => array()); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $median = StatisticReporting::calcMedian(StatisticReporting::calcMedian($row['medianTime'])); - $data['perClient'][] = array('hostname' => $row['clientName'], 'time' => StatisticReporting::formatSeconds($row['timeSum']), 'timeInSeconds' => $row['timeSum'], - 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row['offlineSum']), 'offlineTimeInSeconds' => $row['offlineSum'], 'lastStart' => date(DATE_RSS,$row['lastStart']), 'lastStartUnixtime' => $row['lastStart'], - 'lastLogout' => date(DATE_RSS,$row['lastLogout']), 'lastLogoutUnixtime' => $row['lastLogout'], 'sessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions'], 'locationName' => $row['locName']); - } - - // per user - $res = StatisticReporting::getUserStatistics($cutOff, $lowerTimeBound, $upperTimeBound); - $data[] = array('perUser' => array()); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $data['perUser'][] = array('user' => $row['name'], 'sessions' => $row['count']); - } - - // per vm - $res = StatisticReporting::getVMStatistics($cutOff, $lowerTimeBound, $upperTimeBound); - $data[] = array('perVM' => array()); - while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $data['perVM'][] = array('vm' => $row['name'], 'sessions' => $row['count']); - } Render::addTemplate('columnChooser'); Render::addTemplate('_page', $data); -- cgit v1.2.3-55-g7522