From 452a0a49d0e9bef75667e488b37580dd5688a923 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 2 Feb 2017 16:06:40 +0100 Subject: [statistics_reporting] Move logic js -> php (for export feature) --- .../templates/table-client.html | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 modules-available/statistics_reporting/templates/table-client.html (limited to 'modules-available/statistics_reporting/templates/table-client.html') diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html new file mode 100644 index 00000000..e4538da6 --- /dev/null +++ b/modules-available/statistics_reporting/templates/table-client.html @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + {{#data}} + + + + + + + + + + + + {{/data}} + +
{{lang_hostname}}{{lang_location}}{{lang_totalTime}}{{lang_medianSessionLength}}{{lang_longSessions}}{{lang_shortSessions}}{{lang_totalOffTime}}{{lang_clientLogout}}{{lang_clientStart}}
{{hostname}}{{location}}{{time_s}}{{medianTime_s}}{{sessions}}{{shortSessions}}{{offTime_s}}{{lastLogout_s}}{{lastStart_s}}
-- cgit v1.2.3-55-g7522 From 1aee69c75e10a1f098ec3a93614cc36da407e22b Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 7 Feb 2017 14:06:27 +0100 Subject: [statistics_reporting] Unify translation handling --- .../statistics_reporting/lang/de/module.json | 9 +++++-- .../lang/de/template-tags.json | 30 ++++++++-------------- .../statistics_reporting/lang/en/module.json | 7 ++++- .../lang/en/template-tags.json | 22 +++++----------- .../statistics_reporting/page.inc.php | 15 +++-------- .../templates/table-client.html | 4 +-- .../templates/table-total.html | 2 +- 7 files changed, 37 insertions(+), 52 deletions(-) (limited to 'modules-available/statistics_reporting/templates/table-client.html') diff --git a/modules-available/statistics_reporting/lang/de/module.json b/modules-available/statistics_reporting/lang/de/module.json index 86ed5f45..64003d47 100644 --- a/modules-available/statistics_reporting/lang/de/module.json +++ b/modules-available/statistics_reporting/lang/de/module.json @@ -1,5 +1,10 @@ { - "module_name": "Statistik Auswertung", + "module_name": "Statistikauswertung", "notAssigned": "Nicht zugewiesen", - "page_title": "Statistik Auswertung" + "page_title": "Statistikauswertung", + "table_client": "Nach Clients", + "table_location": "Nach Orten", + "table_total": "Gesamt", + "table_user": "Nach Benutzern", + "table_vm": "Nach Veranstaltungen" } \ No newline at end of file diff --git a/modules-available/statistics_reporting/lang/de/template-tags.json b/modules-available/statistics_reporting/lang/de/template-tags.json index d4d7887a..379e2030 100644 --- a/modules-available/statistics_reporting/lang/de/template-tags.json +++ b/modules-available/statistics_reporting/lang/de/template-tags.json @@ -1,28 +1,20 @@ { "lang_apply": "Anwenden", - "lang_clientLogout": "Letzter VM Logout", - "lang_clientStart": "Letzter Client Boot", - "lang_hostname": "Client Name", - "lang_last1": "Heute", - "lang_last14": "Letzten 14 Tage", - "lang_last2": "Letzten 2 Tage", - "lang_last30": "Letzten 30 Tage", - "lang_last7": "Letzten 7 Tage", - "lang_last90": "Letzten 90 Tage", - "lang_location": "Raum", + "lang_displayColumns": "Auswahl angezeigter Spalten", + "lang_displaySelection": "Anzeigemodus, Auswahl Zeitfenster", + "lang_export": "Exportieren", + "lang_hostname": "Hostname", + "lang_lastLogout": "Letzter Logout", + "lang_lastStart": "Letzter Boot", + "lang_location": "Ort", "lang_longSessions": "Sitzungen \u2265 60s", - "lang_medianSessionLength": "Mittlere Sitzungsdauer", - "lang_overallOfftime": "Insgesamte Zeit Offline", - "lang_perclient": "Pro Client", - "lang_perlocation": "Pro Raum", - "lang_peruser": "Pro Benutzer", - "lang_pervm": "Pro VM", + "lang_medianSessionLength": "Sitzungsdauer Median", "lang_reportingDescription": "Helfen Sie uns bwLehrpool, durch das w\u00f6chentliche, automatische Verschicken eines anonymisierten Statistikberichts, zu verbessern.", "lang_sessions": "Sitzungen", "lang_shortSessions": "Sitzungen < 60s", "lang_total": "Gesamt", - "lang_totalOffTime": "Gesamtzeit Offline", - "lang_totalTime": "Gesamte Zeit", + "lang_totalOffTime": "Gesamtzeit offline", + "lang_totalTime": "Gesamtzeit", "lang_user": "Nutzer", - "lang_vm": "VM" + "lang_vm": "Veranstaltung" } \ No newline at end of file diff --git a/modules-available/statistics_reporting/lang/en/module.json b/modules-available/statistics_reporting/lang/en/module.json index 5362fee2..f5ed37d3 100644 --- a/modules-available/statistics_reporting/lang/en/module.json +++ b/modules-available/statistics_reporting/lang/en/module.json @@ -1,5 +1,10 @@ { "module_name": "Statistics Reporting", "notAssigned": "Not assigned", - "page_title": "Statistics Reporting" + "page_title": "Statistics Reporting", + "table_client": "By client", + "table_location": "By location", + "table_total": "Total", + "table_user": "By user", + "table_vm": "By lecture" } \ 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 0047c7a4..466a8530 100644 --- a/modules-available/statistics_reporting/lang/en/template-tags.json +++ b/modules-available/statistics_reporting/lang/en/template-tags.json @@ -1,22 +1,14 @@ { "lang_apply": "Apply", - "lang_clientLogout": "Last VM Logout", - "lang_clientStart": "Last Client Boot", - "lang_hostname": "Client Name", - "lang_last1": "Today", - "lang_last14": "Last 14 days", - "lang_last2": "Last 2 days", - "lang_last30": "Last 30 days", - "lang_last7": "Last 7 days", - "lang_last90": "Last 90 days", + "lang_displayColumns": "Select columns to display", + "lang_displaySelection": "Select display mode and specify time span", + "lang_export": "Export", + "lang_hostname": "Hostname", + "lang_lastLogout": "Last logout", + "lang_lastStart": "Last boot", "lang_location": "Location", "lang_longSessions": "Sessions \u2265 60s", "lang_medianSessionLength": "Median Session Length", - "lang_overallOfftime": "Overall time offline", - "lang_perclient": "Per Client", - "lang_perlocation": "Per Location", - "lang_peruser": "Per User", - "lang_pervm": "Per VM", "lang_reportingDescription": "Help us improve bwLehrpool by automatically sending an anonymized statistics report once per week.", "lang_sessions": "Sessions", "lang_shortSessions": "Sessions < 60s", @@ -24,5 +16,5 @@ "lang_totalOffTime": "Total Time Offline", "lang_totalTime": "Total Time", "lang_user": "User", - "lang_vm": "VM" + "lang_vm": "Lecture" } \ No newline at end of file diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 05a26c41..c5640d41 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -13,8 +13,8 @@ class Page_Statistics_Reporting extends Page /** * @var array Names of columns that are being used by the various tables */ - private $COLUMNS = array('col_lastlogout', 'col_laststart', 'col_location', 'col_longsessions', 'col_mediantime', - 'col_sessions', 'col_shortsessions', 'col_timeoffline', 'col_totaltime'); + private $COLUMNS = array('lastLogout', 'lastStart', 'location', 'longSessions', 'medianSessionLength', + 'sessions', 'shortSessions', 'totalOffTime', 'totalTime'); /** * @var array Names of the tables we can display @@ -66,15 +66,6 @@ class Page_Statistics_Reporting extends Page /* * Leave these here for the translate module - * Dictionary::translate('col_lastlogout'); - * Dictionary::translate('col_laststart'); - * Dictionary::translate('col_location'); - * Dictionary::translate('col_longsessions'); - * Dictionary::translate('col_mediantime'); - * Dictionary::translate('col_sessions'); - * Dictionary::translate('col_shortsessions'); - * Dictionary::translate('col_timeoffline'); - * Dictionary::translate('col_totaltime'); * Dictionary::translate('table_total'); * Dictionary::translate('table_location'); * Dictionary::translate('table_client'); @@ -91,7 +82,7 @@ class Page_Statistics_Reporting extends Page foreach ($this->COLUMNS as $column) { $data['columns'][] = array( 'id' => $column, - 'name' => Dictionary::translate($column, true), + 'name' => Dictionary::translateFile('template-tags', 'lang_' . $column, true), 'checked' => Request::get($column, 'on', 'string') === 'on' ? 'checked' : '', ); } diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html index e4538da6..e53a49d6 100644 --- a/modules-available/statistics_reporting/templates/table-client.html +++ b/modules-available/statistics_reporting/templates/table-client.html @@ -8,8 +8,8 @@ {{lang_longSessions}} {{lang_shortSessions}} {{lang_totalOffTime}} - {{lang_clientLogout}} - {{lang_clientStart}} + {{lang_lastLogout}} + {{lang_lastStart}} diff --git a/modules-available/statistics_reporting/templates/table-total.html b/modules-available/statistics_reporting/templates/table-total.html index 8e24dc01..2e100ae5 100644 --- a/modules-available/statistics_reporting/templates/table-total.html +++ b/modules-available/statistics_reporting/templates/table-total.html @@ -6,7 +6,7 @@ {{lang_medianSessionLength}} {{lang_longSessions}} {{lang_shortSessions}} - {{lang_overallOfftime}} + {{lang_totalOffTime}} -- cgit v1.2.3-55-g7522 From 3428949ab80ad023693834a789008f230728493a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 7 Feb 2017 14:33:04 +0100 Subject: [statistics_reporting] Fix hiding of checkboxes not matching any column --- .../statistics_reporting/page.inc.php | 2 +- .../templates/columnChooser.html | 28 +++++----------------- .../templates/table-client.html | 28 +++++++++++----------- .../templates/table-location.html | 20 ++++++++-------- .../templates/table-total.html | 20 ++++++++-------- 5 files changed, 41 insertions(+), 57 deletions(-) (limited to 'modules-available/statistics_reporting/templates/table-client.html') diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 8ae9ec92..06f9cfb6 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -81,7 +81,7 @@ class Page_Statistics_Reporting extends Page foreach ($this->COLUMNS as $column) { $data['columns'][] = array( - 'id' => $column, + 'id' => 'col_' . $column, 'name' => Dictionary::translateFile('template-tags', 'lang_' . $column, true), 'checked' => Request::get($column, 'on', 'string') === 'on' ? 'checked' : '', ); diff --git a/modules-available/statistics_reporting/templates/columnChooser.html b/modules-available/statistics_reporting/templates/columnChooser.html index 83d1b9e1..efc1f355 100644 --- a/modules-available/statistics_reporting/templates/columnChooser.html +++ b/modules-available/statistics_reporting/templates/columnChooser.html @@ -34,11 +34,11 @@
{{lang_displayColumns}}
{{#columns}} - -
- - -
+ +
+ + +
{{/columns}}
@@ -117,18 +117,12 @@ th.eq(data.column).append(' '); }); - if (getParameter("type") == "location" && getParameter("location")) { - var target = $(".locationName:contains('"+decodeURIComponent(getParameter("location")).replace(/\+/g, " ")+"'):first"); - $(window).scrollTop(target.offset().top - $(window).height()/2); - target.parent().css( "background-color", "#f8ff99" ); - } - $(".locationLink").click(function(e) { e.preventDefault(); var form = $('#controlsForm'); $('').attr('type', 'hidden') .attr('name', "location") - .attr('value', $(this).text()) + .attr('value', $(this).data('lid')) .appendTo(form); form.find('#select-table').val("location"); form.submit(); @@ -174,14 +168,4 @@ data: { action: "setReporting", reporting: $("#checkbox-reporting").is(":checked") ? "on" : "off", token: TOKEN } }); } - - function getParameter(name) { - var query = window.location.search.substring(1); - var vars = query.split("&"); - for (var i=0;i \ No newline at end of file diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html index e53a49d6..2bb79447 100644 --- a/modules-available/statistics_reporting/templates/table-client.html +++ b/modules-available/statistics_reporting/templates/table-client.html @@ -3,13 +3,13 @@ {{lang_hostname}} {{lang_location}} - {{lang_totalTime}} - {{lang_medianSessionLength}} - {{lang_longSessions}} - {{lang_shortSessions}} - {{lang_totalOffTime}} - {{lang_lastLogout}} - {{lang_lastStart}} + {{lang_totalTime}} + {{lang_medianSessionLength}} + {{lang_longSessions}} + {{lang_shortSessions}} + {{lang_totalOffTime}} + {{lang_lastLogout}} + {{lang_lastStart}} @@ -17,13 +17,13 @@ {{hostname}} {{location}} - {{time_s}} - {{medianTime_s}} - {{sessions}} - {{shortSessions}} - {{offTime_s}} - {{lastLogout_s}} - {{lastStart_s}} + {{time_s}} + {{medianTime_s}} + {{sessions}} + {{shortSessions}} + {{offTime_s}} + {{lastLogout_s}} + {{lastStart_s}} {{/data}} diff --git a/modules-available/statistics_reporting/templates/table-location.html b/modules-available/statistics_reporting/templates/table-location.html index 55fa8e6f..02292e5b 100644 --- a/modules-available/statistics_reporting/templates/table-location.html +++ b/modules-available/statistics_reporting/templates/table-location.html @@ -2,22 +2,22 @@ {{lang_location}} - {{lang_totalTime}} - {{lang_medianSessionLength}} - {{lang_longSessions}} - {{lang_shortSessions}} - {{lang_totalOffTime}} + {{lang_totalTime}} + {{lang_medianSessionLength}} + {{lang_longSessions}} + {{lang_shortSessions}} + {{lang_totalOffTime}} {{#data}} {{location}} - {{time_s}} - {{medianTime_s}} - {{sessions}} - {{shortSessions}} - {{offTime_s}} + {{time_s}} + {{medianTime_s}} + {{sessions}} + {{shortSessions}} + {{offTime_s}} {{/data}} diff --git a/modules-available/statistics_reporting/templates/table-total.html b/modules-available/statistics_reporting/templates/table-total.html index 2e100ae5..e59dda25 100644 --- a/modules-available/statistics_reporting/templates/table-total.html +++ b/modules-available/statistics_reporting/templates/table-total.html @@ -2,21 +2,21 @@ - {{lang_totalTime}} - {{lang_medianSessionLength}} - {{lang_longSessions}} - {{lang_shortSessions}} - {{lang_totalOffTime}} + {{lang_totalTime}} + {{lang_medianSessionLength}} + {{lang_longSessions}} + {{lang_shortSessions}} + {{lang_totalOffTime}} {{lang_total}} - {{data.time_s}} - {{data.medianTime_s}} - {{data.sessions}} - {{data.shortSessions}} - {{data.totalOfftime_s}} + {{data.time_s}} + {{data.medianTime_s}} + {{data.sessions}} + {{data.shortSessions}} + {{data.totalOfftime_s}} -- cgit v1.2.3-55-g7522 From 47db4f25c7b2d257c176bf5616bb60d8745a4a07 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 7 Feb 2017 14:57:03 +0100 Subject: [statistics_reporting] Fix location highlighting (do it server side) --- modules-available/statistics_reporting/page.inc.php | 11 ++++++++++- .../statistics_reporting/templates/table-client.html | 2 +- .../statistics_reporting/templates/table-location.html | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) (limited to 'modules-available/statistics_reporting/templates/table-client.html') diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 06f9cfb6..90188121 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -209,7 +209,16 @@ class Page_Statistics_Reporting extends Page case 'total': return GetData::total($flags); case 'location': - return GetData::perLocation($flags); + $data = GetData::perLocation($flags); + $highlight = Request::get('location', false, 'int'); + if ($highlight !== false) { + foreach ($data as &$row) { + if ($row['locationId'] == $highlight) { + $row['highlight'] = true; + } + } + } + return $data; case 'client': return GetData::perClient($flags); case 'user': diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html index 2bb79447..2fb2f574 100644 --- a/modules-available/statistics_reporting/templates/table-client.html +++ b/modules-available/statistics_reporting/templates/table-client.html @@ -16,7 +16,7 @@ {{#data}} {{hostname}} - {{location}} + {{location}} {{time_s}} {{medianTime_s}} {{sessions}} diff --git a/modules-available/statistics_reporting/templates/table-location.html b/modules-available/statistics_reporting/templates/table-location.html index 02292e5b..9479b7af 100644 --- a/modules-available/statistics_reporting/templates/table-location.html +++ b/modules-available/statistics_reporting/templates/table-location.html @@ -11,7 +11,7 @@ {{#data}} - + {{location}} {{time_s}} {{medianTime_s}} -- cgit v1.2.3-55-g7522 From 3a09daee1ebaf014536e14e82ca0fd4c2c92a41f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 8 Feb 2017 13:38:04 +0100 Subject: [statistics_reporting] Consistent field naming across classes, templates etc. --- .../statistics_reporting/inc/getdata.inc.php | 46 +++++++++++----------- .../statistics_reporting/inc/queries.inc.php | 8 ++-- .../templates/table-client.html | 8 ++-- .../templates/table-location.html | 8 ++-- .../templates/table-total.html | 8 ++-- 5 files changed, 39 insertions(+), 39 deletions(-) (limited to 'modules-available/statistics_reporting/templates/table-client.html') diff --git a/modules-available/statistics_reporting/inc/getdata.inc.php b/modules-available/statistics_reporting/inc/getdata.inc.php index 9604d652..83f118e6 100644 --- a/modules-available/statistics_reporting/inc/getdata.inc.php +++ b/modules-available/statistics_reporting/inc/getdata.inc.php @@ -17,17 +17,17 @@ class GetData // total time online, average time online, total number of logins $res = Queries::getOverallStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $row = $res->fetch(PDO::FETCH_ASSOC); - $data = array('time' => $row['sum'], 'medianTime' => self::calcMedian($row['median']), 'sessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions']); + $data = array('totalTime' => $row['sum'], 'medianSessionLength' => self::calcMedian($row['median']), 'longSessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions']); //total time offline $res = Queries::getTotalOfflineStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $row = $res->fetch(PDO::FETCH_ASSOC); - $data = array_merge($data, array('totalOfftime' => $row['timeOff'])); + $data['totalOffTime'] = $row['timeOff']; if ($printable) { - $data["time_s"] = self::formatSeconds($data["time"]); - $data["medianTime_s"] = self::formatSeconds($data["medianTime"]); - $data["totalOfftime_s"] = self::formatSeconds($data["totalOfftime"]); + $data["totalTime_s"] = self::formatSeconds($data["totalTime"]); + $data["medianSessionLength_s"] = self::formatSeconds($data["medianSessionLength"]); + $data["totalOffTime_s"] = self::formatSeconds($data["totalOffTime"]); } return $data; @@ -40,22 +40,22 @@ class GetData $res = Queries::getLocationStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $data = array(); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $median = self::calcMedian(self::calcMedian($row['medianTime'])); + $median = self::calcMedian(self::calcMedian($row['medianSessionLength'])); $entry = array( 'location' => ($anonymize ? $row['locHash'] : $row['locName']), - 'time' => $row['timeSum'], - 'medianTime' => $median, - 'offTime' => $row['offlineSum'], - 'sessions' => $row['longSessions'], + 'totalTime' => $row['timeSum'], + 'medianSessionLength' => $median, + 'totalOffTime' => $row['offlineSum'], + 'longSessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions'] ); if (!$anonymize) { $entry['locationId'] = $row['locId']; } if ($printable) { - $entry['time_s'] = self::formatSeconds($row['timeSum']); - $entry['medianTime_s'] = self::formatSeconds($median); - $entry['offTime_s'] = self::formatSeconds($row['offlineSum']); + $entry['totalTime_s'] = self::formatSeconds($row['timeSum']); + $entry['medianSessionLength_s'] = self::formatSeconds($median); + $entry['totalOffTime_s'] = self::formatSeconds($row['offlineSum']); } $data[] = $entry; } @@ -69,15 +69,15 @@ class GetData $res = Queries::getClientStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $data = array(); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { - $median = self::calcMedian(self::calcMedian($row['medianTime'])); + $median = self::calcMedian(self::calcMedian($row['medianSessionLength'])); $entry = array( 'hostname' => ($anonymize ? $row['clientHash'] : $row['clientName']), - 'time' => $row['timeSum'], - 'medianTime' => $median, - 'offTime' => $row['offlineSum'], + 'totalTime' => $row['timeSum'], + 'medianSessionLength' => $median, + 'totalOffTime' => $row['offlineSum'], 'lastStart' => $row['lastStart'], 'lastLogout' => $row['lastLogout'], - 'sessions' => $row['longSessions'], + 'longSessions' => $row['longSessions'], 'shortSessions' => $row['shortSessions'], 'location' => ($anonymize ? $row['locHash'] : $row['locName']), ); @@ -85,11 +85,11 @@ class GetData $entry['locationId'] = $row['locId']; } if ($printable) { - $entry['time_s'] = self::formatSeconds($row['timeSum']); - $entry['medianTime_s'] = self::formatSeconds($median); - $entry['offTime_s'] = self::formatSeconds($row['offlineSum']); - $entry['lastStart_s'] = date(DATE_RSS, $row['lastStart']); - $entry['lastLogout_s'] = date(DATE_RSS, $row['lastLogout']); + $entry['totalTime_s'] = self::formatSeconds($row['timeSum']); + $entry['medianSessionLength_s'] = self::formatSeconds($median); + $entry['totalOffTime_s'] = self::formatSeconds($row['offlineSum']); + $entry['lastStart_s'] = date(DATE_ISO8601, $row['lastStart']); + $entry['lastLogout_s'] = date(DATE_ISO8601, $row['lastLogout']); } $data[] = $entry; } diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php index 7a56414b..1d1d3a44 100644 --- a/modules-available/statistics_reporting/inc/queries.inc.php +++ b/modules-available/statistics_reporting/inc/queries.inc.php @@ -8,8 +8,8 @@ class Queries public static function getClientStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) { $notassigned = Dictionary::translate('notAssigned', true); Database::exec("SET SESSION group_concat_max_len = 1000000000"); - $res = Database::simpleQuery("SELECT t1.name AS clientName, timeSum, medianTime, offlineSum, lastStart, lastLogout, longSessions, shortSessions, locId, locName, MD5(CONCAT(locId, :salt)) AS locHash, MD5(CONCAT(t1.uuid, :salt)) AS clientHash 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, '$notassigned') AS 'locName', location.locationid AS 'locId' + $res = Database::simpleQuery("SELECT t1.name AS clientName, timeSum, medianSessionLength, offlineSum, lastStart, lastLogout, longSessions, shortSessions, locId, locName, MD5(CONCAT(locId, :salt)) AS locHash, MD5(CONCAT(t1.uuid, :salt)) AS clientHash FROM ( + SELECT machine.hostname AS 'name', machine.machineuuid AS 'uuid', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianSessionLength', 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', location.locationid AS 'locId' FROM ".self::getBoundedTableQueryString('~session-length', $from, $to, $lowerTimeBound, $upperTimeBound)." sessionTable INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid LEFT JOIN location ON machine.locationid = location.locationid @@ -30,8 +30,8 @@ class Queries public static function getLocationStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24, $excludeToday = false) { $notassigned = Dictionary::translate('notAssigned', true); Database::exec("SET SESSION group_concat_max_len = 1000000000"); - $res = Database::simpleQuery("SELECT t1.locId, t1.locName AS locName, MD5(CONCAT(t1.locId, :salt)) AS locHash, timeSum, medianTime, offlineSum, longSessions, shortSessions FROM ( - SELECT IFNULL(location.locationname, '$notassigned') AS 'locName', location.locationid AS 'locId', 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' + $res = Database::simpleQuery("SELECT t1.locId, t1.locName AS locName, MD5(CONCAT(t1.locId, :salt)) AS locHash, timeSum, medianSessionLength, offlineSum, longSessions, shortSessions FROM ( + SELECT IFNULL(location.locationname, '$notassigned') AS 'locName', location.locationid AS 'locId', SUM(CAST(sessionTable.length AS UNSIGNED)) AS 'timeSum', GROUP_CONCAT(sessionTable.length) AS 'medianSessionLength', SUM(sessionTable.length >= 60) AS 'longSessions', SUM(sessionTable.length < 60) AS 'shortSessions' FROM ".self::getBoundedTableQueryString('~session-length', $from, $to, $lowerTimeBound, $upperTimeBound)." sessionTable INNER JOIN machine ON sessionTable.machineuuid = machine.machineuuid LEFT JOIN location ON machine.locationid = location.locationid diff --git a/modules-available/statistics_reporting/templates/table-client.html b/modules-available/statistics_reporting/templates/table-client.html index 2fb2f574..be504cef 100644 --- a/modules-available/statistics_reporting/templates/table-client.html +++ b/modules-available/statistics_reporting/templates/table-client.html @@ -17,11 +17,11 @@ {{hostname}} {{location}} - {{time_s}} - {{medianTime_s}} - {{sessions}} + {{totalTime_s}} + {{medianSessionLength_s}} + {{longSessions}} {{shortSessions}} - {{offTime_s}} + {{totalOffTime_s}} {{lastLogout_s}} {{lastStart_s}} diff --git a/modules-available/statistics_reporting/templates/table-location.html b/modules-available/statistics_reporting/templates/table-location.html index 9479b7af..ccac623d 100644 --- a/modules-available/statistics_reporting/templates/table-location.html +++ b/modules-available/statistics_reporting/templates/table-location.html @@ -13,11 +13,11 @@ {{#data}} {{location}} - {{time_s}} - {{medianTime_s}} - {{sessions}} + {{totalTime_s}} + {{medianSessionLength_s}} + {{longSessions}} {{shortSessions}} - {{offTime_s}} + {{totalOffTime_s}} {{/data}} diff --git a/modules-available/statistics_reporting/templates/table-total.html b/modules-available/statistics_reporting/templates/table-total.html index e59dda25..4048a178 100644 --- a/modules-available/statistics_reporting/templates/table-total.html +++ b/modules-available/statistics_reporting/templates/table-total.html @@ -12,11 +12,11 @@ {{lang_total}} - {{data.time_s}} - {{data.medianTime_s}} - {{data.sessions}} + {{data.totalTime_s}} + {{data.medianSessionLength_s}} + {{data.longSessions}} {{data.shortSessions}} - {{data.totalOfftime_s}} + {{data.totalOffTime_s}} -- cgit v1.2.3-55-g7522