summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting/inc
diff options
context:
space:
mode:
authorUdo Walter2016-12-23 17:24:05 +0100
committerUdo Walter2016-12-23 17:24:05 +0100
commit8c9c28df0401f0bc89ab1cfc05332e6e1727d0d3 (patch)
treee8150dc5aa84fadecc05190a2ab0017ae7c3b569 /modules-available/statistics_reporting/inc
parent[statistics_reporting] replaced empty location string (diff)
downloadslx-admin-8c9c28df0401f0bc89ab1cfc05332e6e1727d0d3.tar.gz
slx-admin-8c9c28df0401f0bc89ab1cfc05332e6e1727d0d3.tar.xz
slx-admin-8c9c28df0401f0bc89ab1cfc05332e6e1727d0d3.zip
[statistics_reporting] added location column in client table
Diffstat (limited to 'modules-available/statistics_reporting/inc')
-rw-r--r--modules-available/statistics_reporting/inc/statisticreporting.inc.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules-available/statistics_reporting/inc/statisticreporting.inc.php b/modules-available/statistics_reporting/inc/statisticreporting.inc.php
index 9941b078..b75c6eaa 100644
--- a/modules-available/statistics_reporting/inc/statisticreporting.inc.php
+++ b/modules-available/statistics_reporting/inc/statisticreporting.inc.php
@@ -5,8 +5,9 @@ class StatisticReporting
{
public static function getClientStatistics($cutOff, $lowerTimeBound = 0, $upperTimeBound = 24) {
+ $notassigned = Dictionary::translateFile('template-tags', 'lang_notassigned');
$res = Database::simpleQuery("SELECT t1.name, timeSum, medianTime, offlineSum, longSessions, lastLogout, lastStart, shortSessions, locName FROM (
- SELECT machine.hostname AS 'name', machine.machineuuid AS 'uuid', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions',MAX(sessionTable.dateline + sessionTable.data) AS 'lastLogout', IFNULL(location.locationname, 'NOT ASSIGNED') AS 'locName'
+ SELECT machine.hostname AS 'name', machine.machineuuid AS 'uuid', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions',MAX(sessionTable.dateline + sessionTable.data) AS 'lastLogout', IFNULL(location.locationname, '$notassigned') AS 'locName'
FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound, $cutOff)." sessionTable
INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid
LEFT JOIN location ON machine.locationid = location.locationid
@@ -24,15 +25,16 @@ class StatisticReporting
// IFNULL(location.locationname, 'NOT ASSIGNED') - NOT ASSIGNED string can be replaced with anything (name of the null-ids in the table)
public static function getLocationStatistics($cutOff, $lowerTimeBound = 0, $upperTimeBound = 24) {
+ $notassigned = Dictionary::translateFile('template-tags', 'lang_notassigned');
$res = Database::simpleQuery("SELECT t1.locName, timeSum, medianTime, offlineSum, longSessions, shortSessions FROM (
- SELECT IFNULL(location.locationname, 'NOT ASSIGNED') AS 'locName', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions'
+ SELECT IFNULL(location.locationname, '$notassigned') AS 'locName', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianTime', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions'
FROM ".self::getBoundedTableQueryString('~session-length', $lowerTimeBound, $upperTimeBound, $cutOff)." sessionTable
INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid
LEFT JOIN location ON machine.locationid = location.locationid
GROUP BY location.locationname
) t1
INNER JOIN (
- SELECT IFNULL(location.locationname, 'NOT ASSIGNED') AS 'locName', SUM(CAST(offlineTable.length AS UNSIGNED)) AS 'offlineSum'
+ SELECT IFNULL(location.locationname, '$notassigned') AS 'locName', SUM(CAST(offlineTable.length AS UNSIGNED)) AS 'offlineSum'
FROM ".self::getBoundedTableQueryString('~offline-length', $lowerTimeBound, $upperTimeBound, $cutOff)." offlineTable
INNER JOIN machine ON offlineTable.machineuuid = machine.machineuuid
LEFT JOIN location ON machine.locationid = location.locationid