From 8c9c28df0401f0bc89ab1cfc05332e6e1727d0d3 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Fri, 23 Dec 2016 17:24:05 +0100 Subject: [statistics_reporting] added location column in client table --- .../statistics_reporting/inc/statisticreporting.inc.php | 8 +++++--- .../statistics_reporting/lang/de/template-tags.json | 3 ++- .../statistics_reporting/lang/en/template-tags.json | 3 ++- modules-available/statistics_reporting/templates/_page.html | 4 +++- .../statistics_reporting/templates/columnChooser.html | 12 ++++++++++++ 5 files changed, 24 insertions(+), 6 deletions(-) (limited to 'modules-available/statistics_reporting') 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 diff --git a/modules-available/statistics_reporting/lang/de/template-tags.json b/modules-available/statistics_reporting/lang/de/template-tags.json index 207949a9..841e87bd 100644 --- a/modules-available/statistics_reporting/lang/de/template-tags.json +++ b/modules-available/statistics_reporting/lang/de/template-tags.json @@ -26,5 +26,6 @@ "lang_last14": "Letzten 14 Tage", "lang_last30": "Letzten 30 Tage", "lang_last90": "Letzten 90 Tage", - "lang_apply": "Anwenden" + "lang_apply": "Anwenden", + "lang_notassigned": "NICHT ZUGEWIESEN" } \ No newline at end of file diff --git a/modules-available/statistics_reporting/lang/en/template-tags.json b/modules-available/statistics_reporting/lang/en/template-tags.json index e9430960..73b3c2fc 100644 --- a/modules-available/statistics_reporting/lang/en/template-tags.json +++ b/modules-available/statistics_reporting/lang/en/template-tags.json @@ -26,5 +26,6 @@ "lang_last14": "Last 14 days", "lang_last30": "Last 30 days", "lang_last90": "Last 90 days", - "lang_apply": "Apply" + "lang_apply": "Apply", + "lang_notassigned": "NOT ASSIGNED" } \ No newline at end of file diff --git a/modules-available/statistics_reporting/templates/_page.html b/modules-available/statistics_reporting/templates/_page.html index d2aaecde..fbdde6d5 100644 --- a/modules-available/statistics_reporting/templates/_page.html +++ b/modules-available/statistics_reporting/templates/_page.html @@ -41,7 +41,7 @@ {{#perLocation}} - {{location}} + {{location}} {{time}} {{medianTime}} {{sessions}} @@ -59,6 +59,7 @@ {{lang_hostname}} + {{lang_location}} {{lang_totalTime}} {{lang_medianSessionLength}} {{lang_sessions}} @@ -72,6 +73,7 @@ {{#perClient}} {{hostname}} + {{locationName}} {{time}} {{medianTime}} {{sessions}} diff --git a/modules-available/statistics_reporting/templates/columnChooser.html b/modules-available/statistics_reporting/templates/columnChooser.html index 49c9a75d..06cd6770 100644 --- a/modules-available/statistics_reporting/templates/columnChooser.html +++ b/modules-available/statistics_reporting/templates/columnChooser.html @@ -24,6 +24,7 @@
+ @@ -69,9 +70,20 @@ var arrow = data.direction === dir.ASC ? "down" : "up"; th.eq(data.column).append(' '); }); + + $(".locationLink").click(function(e) { + e.preventDefault(); + $('#select-table').val('perlocation'); + chooseTable('perlocation'); + var target = $(".locationName:contains('"+$(this).text()+"'):first"); + $(window).scrollTop(target.offset().top - $(window).height()/2); + target.parent().css( "background-color", "#f8ff99" ); + return false; + }); }); function chooseTable(v) { + $("tr").removeAttr('style'); $("[id^=table-]").hide(); $('#table-'+v).show(); $("[id^=button-]").hide(); -- cgit v1.2.3-55-g7522