summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting/inc/getdata.inc.php
diff options
context:
space:
mode:
authorChristian Hofmaier2017-04-12 14:30:18 +0200
committerChristian Hofmaier2017-04-12 14:30:18 +0200
commit9f27c7cdeb1df2f9c42373f419c6621d4faa71ca (patch)
treee55c6e1d95685df2117401e97f946b962f4e0f47 /modules-available/statistics_reporting/inc/getdata.inc.php
parent[permissionmanager] changed description to tooltips (diff)
parent[rebootcontrol] New module for shutting down and rebooting clients (diff)
downloadslx-admin-9f27c7cdeb1df2f9c42373f419c6621d4faa71ca.tar.gz
slx-admin-9f27c7cdeb1df2f9c42373f419c6621d4faa71ca.tar.xz
slx-admin-9f27c7cdeb1df2f9c42373f419c6621d4faa71ca.zip
Merge branches 'master' and 'permission-manager' of git.openslx.org:openslx-ng/slx-admin into permission-manager
Diffstat (limited to 'modules-available/statistics_reporting/inc/getdata.inc.php')
-rw-r--r--modules-available/statistics_reporting/inc/getdata.inc.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules-available/statistics_reporting/inc/getdata.inc.php b/modules-available/statistics_reporting/inc/getdata.inc.php
index f65ee868..da3a9a26 100644
--- a/modules-available/statistics_reporting/inc/getdata.inc.php
+++ b/modules-available/statistics_reporting/inc/getdata.inc.php
@@ -40,6 +40,7 @@ class GetData
$res = Queries::getLocationStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$data = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ self::nullToZero($row);
$median = self::calcMedian(self::calcMedian($row['medianSessionLength']));
$entry = array(
'location' => ($anonymize ? $row['locHash'] : $row['locName']),
@@ -69,6 +70,7 @@ class GetData
$res = Queries::getClientStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound);
$data = array();
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ self::nullToZero($row);
$median = self::calcMedian(self::calcMedian($row['medianSessionLength']));
$entry = array(
'hostname' => ($anonymize ? $row['clientHash'] : $row['clientName']),
@@ -116,12 +118,20 @@ class GetData
$data = array();
$vm = $anonymize ? 'vmHash' : 'name';
while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ self::nullToZero($row);
$data[] = array('vm' => $row[$vm], 'sessions' => $row['count']);
}
return $data;
}
-
+ private static function nullToZero(&$row)
+ {
+ foreach ($row as &$field) {
+ if (is_null($field)) {
+ $field = 0;
+ }
+ }
+ }
// Format $seconds into ".d .h .m .s" format (day, hour, minute, second)
private static function formatSeconds($seconds)