diff options
author | Christian Hofmaier | 2017-04-12 14:30:18 +0200 |
---|---|---|
committer | Christian Hofmaier | 2017-04-12 14:30:18 +0200 |
commit | 9f27c7cdeb1df2f9c42373f419c6621d4faa71ca (patch) | |
tree | e55c6e1d95685df2117401e97f946b962f4e0f47 /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) | |
download | slx-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.php | 12 |
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) |