summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2016-09-01 19:29:14 +0200
committerSimon Rettberg2016-09-01 19:29:14 +0200
commitc7dad7af7974c648ef69e0eb57fab66fea90b36b (patch)
tree948bb6318a4cba0804744bab43cb5aef0bb15079 /modules-available/statistics/page.inc.php
parent[dozmod] Don't wrap date/time column in table (diff)
downloadslx-admin-c7dad7af7974c648ef69e0eb57fab66fea90b36b.tar.gz
slx-admin-c7dad7af7974c648ef69e0eb57fab66fea90b36b.tar.xz
slx-admin-c7dad7af7974c648ef69e0eb57fab66fea90b36b.zip
[statistics] Show current lecture, use new logging format/columns if possible
Diffstat (limited to 'modules-available/statistics/page.inc.php')
-rw-r--r--modules-available/statistics/page.inc.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/modules-available/statistics/page.inc.php b/modules-available/statistics/page.inc.php
index 0639d784..43b3a6e8 100644
--- a/modules-available/statistics/page.inc.php
+++ b/modules-available/statistics/page.inc.php
@@ -101,6 +101,11 @@ class Page_Statistics extends Page
'op' => Page_Statistics::$op_nominal,
'type' => 'string',
'column' => false
+ ],
+ 'currentuser' => [
+ 'op' => Page_Statistics::$op_nominal,
+ 'type' => 'string',
+ 'column' => false
]
];
if (Module::isAvailable('locations')) {
@@ -597,7 +602,20 @@ class Page_Statistics extends Page
private function fillSessionInfo(&$row)
{
- $res = Database::simpleQuery('SELECT dateline, username, data FROM statistic'
+ if (!empty($row['currentuser'])) {
+ $row['username'] = $row['currentuser'];
+ if (strlen($row['currentsession']) === 36 && Module::isAvailable('dozmod')) {
+ $lecture = Database::simpleQuery("SELECT lectureid, displayname FROM sat.lecture WHERE lectureid = :lectureid",
+ array('lectureid' => $row['currentsession']));
+ if ($lecture !== false) {
+ $row['currentsession'] = $lecture['displayname'];
+ $row['lectureid'] = $lecture['lectureid'];
+ }
+ }
+ $row['session'] = $row['currentsession'];
+ return;
+ }
+ $res = Database::queryFirst('SELECT dateline, username, data FROM statistic'
. " WHERE clientip = :ip AND typeid = '.vmchooser-session-name'"
. ' AND dateline BETWEEN :start AND :end', array(
'ip' => $row['clientip'],
@@ -619,7 +637,7 @@ class Page_Statistics extends Page
private function showMachine($uuid)
{
$client = Database::queryFirst('SELECT machineuuid, locationid, macaddr, clientip, firstseen, lastseen, logintime, lastboot,'
- . ' mbram, kvmstate, cpumodel, id44mb, data, hostname, notes FROM machine WHERE machineuuid = :uuid',
+ . ' mbram, kvmstate, cpumodel, id44mb, data, hostname, currentuser, currentsession, notes FROM machine WHERE machineuuid = :uuid',
array('uuid' => $uuid));
// Hack: Get raw collected data
if (Request::get('raw', false)) {