From 3df87f6f36645cfef4f427c782b5df573db45194 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Sun, 24 Jul 2022 18:31:39 +1000 Subject: [PATCH] Highlight still connected devices in green on teh timeline --- front/php/server/events.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/front/php/server/events.php b/front/php/server/events.php index 1d0fa228..b083f0ab 100644 --- a/front/php/server/events.php +++ b/front/php/server/events.php @@ -217,9 +217,9 @@ function getDeviceSessions() { // Disconnection DateTime if ($row['ses_StillConnected'] == true) { - $end = '...'; + $end = '...'; } elseif ($row['ses_EventTypeDisconnection'] == '') { - $end = $row['ses_EventTypeDisconnection']; + $end = $row['ses_EventTypeDisconnection']; } else { $end = formatDate ($row['ses_DateTimeDisconnection']); } @@ -267,7 +267,7 @@ function getDevicePresence() { // SQL $SQL = 'SELECT ses_EventTypeConnection, ses_DateTimeConnection, - ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_IP, ses_AdditionalInfo, + ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_IP, ses_AdditionalInfo, ses_StillConnected, CASE WHEN ses_EventTypeConnection = "" THEN @@ -292,10 +292,13 @@ function getDevicePresence() { // Event color if ($row['ses_EventTypeConnection'] == '' || $row['ses_EventTypeDisconnection'] == '') { $color = '#f39c12'; + } elseif ($row['ses_StillConnected'] == 1 ) { + $color = '#00a659'; } else { $color = '#0073b7'; } + // tooltip $tooltip = 'Connection: ' . formatEventDate ($row['ses_DateTimeConnection'], $row['ses_EventTypeConnection']) . chr(13) . 'Disconnection: ' . formatEventDate ($row['ses_DateTimeDisconnection'], $row['ses_EventTypeDisconnection']) . chr(13) . @@ -331,9 +334,9 @@ function getEventsCalendar() { $startDate = '"'. $_REQUEST ['start'] .'"'; $endDate = '"'. $_REQUEST ['end'] .'"'; - // SQL + // SQL $SQL = 'SELECT ses_MAC, ses_EventTypeConnection, ses_DateTimeConnection, - ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_IP, ses_AdditionalInfo, + ses_EventTypeDisconnection, ses_DateTimeDisconnection, ses_IP, ses_AdditionalInfo, ses_StillConnected, CASE WHEN ses_EventTypeConnection = "" THEN @@ -357,6 +360,8 @@ function getEventsCalendar() { // Event color if ($row['ses_EventTypeConnection'] == '' || $row['ses_EventTypeDisconnection'] == '') { $color = '#f39c12'; + } elseif ($row['ses_StillConnected'] == 1 ) { + $color = '#00a659'; } else { $color = '#0073b7'; }