summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting/page.inc.php
diff options
context:
space:
mode:
authorChristian Hofmaier2017-01-09 16:48:45 +0100
committerChristian Hofmaier2017-01-09 16:48:45 +0100
commitd7fa39c85738fb998c79a866a7f0ed36b9403a87 (patch)
tree01d5f373e87f66da158a80970b49ca011b9a4d09 /modules-available/statistics_reporting/page.inc.php
parent[statistics_reporting] bugfix (diff)
downloadslx-admin-d7fa39c85738fb998c79a866a7f0ed36b9403a87.tar.gz
slx-admin-d7fa39c85738fb998c79a866a7f0ed36b9403a87.tar.xz
slx-admin-d7fa39c85738fb998c79a866a7f0ed36b9403a87.zip
[statistics_reporting] improved readability, added hashed values to queries
Diffstat (limited to 'modules-available/statistics_reporting/page.inc.php')
-rw-r--r--modules-available/statistics_reporting/page.inc.php34
1 files changed, 17 insertions, 17 deletions
diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php
index c309bfb6..e2c76b09 100644
--- a/modules-available/statistics_reporting/page.inc.php
+++ b/modules-available/statistics_reporting/page.inc.php
@@ -33,45 +33,45 @@ class Page_Statistics_Reporting extends Page
// total time online, average time online, total number of logins
$res = StatisticReporting::getOverallStatistics($cutOff, $lowerTimeBound, $upperTimeBound);
- $row = $res->fetch(PDO::FETCH_NUM);
- $data = array('time' => StatisticReporting::formatSeconds($row[0]), 'medianTime' => StatisticReporting::formatSeconds(StatisticReporting::calcMedian($row[1])), 'sessions' => $row[2], 'shortSessions' => $row[3]);
+ $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_NUM);
- $data = array_merge($data, array('totalOfftime' => StatisticReporting::formatSeconds($row[0])));
+ $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_NUM)) {
- $median = StatisticReporting::calcMedian(StatisticReporting::calcMedian($row[2]));
- $data['perLocation'][] = array('location' => $row[0], 'time' => StatisticReporting::formatSeconds($row[1]), 'timeInSeconds' => $row[1],
- 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row[3]), 'offlineTimeInSeconds' => $row[3], 'sessions' => $row[4], 'shortSessions' => $row[5]);
+ 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_NUM)) {
- $median = StatisticReporting::calcMedian(StatisticReporting::calcMedian($row[2]));
- $data['perClient'][] = array('hostname' => $row[0], 'time' => StatisticReporting::formatSeconds($row[1]), 'timeInSeconds' => $row[1],
- 'medianTime' => StatisticReporting::formatSeconds($median), 'medianTimeInSeconds' => $median, 'offTime' => StatisticReporting::formatSeconds($row[3]), 'offlineTimeInSeconds' => $row[3], 'lastStart' => date(DATE_RSS,$row[4]), 'lastStartUnixtime' => $row[4],
- 'lastLogout' => date(DATE_RSS,$row[5]), 'lastLogoutUnixtime' => $row[5], 'sessions' => $row[6], 'shortSessions' => $row[7], 'locationName' => $row[8]);
+ 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_NUM)) {
- $data['perUser'][] = array('user' => $row[0], 'sessions' => $row[1]);
+ 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_NUM)) {
- $data['perVM'][] = array('vm' => $row[0], 'sessions' => $row[1]);
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ $data['perVM'][] = array('vm' => $row['name'], 'sessions' => $row['count']);
}
Render::addTemplate('columnChooser');