From 217d1e44ba137c83e52ff9229a303dc8cda98283 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 9 Oct 2018 11:06:54 -0400 Subject: [PATCH] Rough in an archived status filter in montagereview. --- .../classic/views/js/montagereview.js.php | 2 +- web/skins/classic/views/montagereview.php | 54 ++++++++++++++----- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/web/skins/classic/views/js/montagereview.js.php b/web/skins/classic/views/js/montagereview.js.php index ce9f767f5..1acb3ada0 100644 --- a/web/skins/classic/views/js/montagereview.js.php +++ b/web/skins/classic/views/js/montagereview.js.php @@ -53,7 +53,7 @@ if ( !$liveMode ) { $next_frames = array(); - if ( $result = dbQuery($frameSql) ) { + if ( $result = dbQuery($framesSql) ) { $next_frame = null; while( $frame = $result->fetch(PDO::FETCH_ASSOC) ) { $event_id = $frame['EventId']; diff --git a/web/skins/classic/views/montagereview.php b/web/skins/classic/views/montagereview.php index f57bb82f3..2fea36ae0 100644 --- a/web/skins/classic/views/montagereview.php +++ b/web/skins/classic/views/montagereview.php @@ -111,7 +111,7 @@ $eventsSql = 'SELECT // where not isnull(E.Frames) and not isnull(StartTime) "; // Note that the delta value seems more accurate than the time stamp for some reason. -$frameSql = ' +$framesSql = ' SELECT Id, FrameId, EventId, TimeStamp, UNIX_TIMESTAMP(TimeStamp) AS TimeStampSecs, Score, Delta FROM Frames WHERE EventId IN (SELECT E.Id FROM Events AS E WHERE 1>0 @@ -119,15 +119,27 @@ $frameSql = ' // This program only calls itself with the time range involved -- it does all monitors (the user can see, in the called group) all the time - $monitor_ids_sql = ''; +$monitor_ids_sql = ''; if ( ! empty($user['MonitorIds']) ) { $eventsSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')'; - $frameSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')'; + $framesSql .= ' AND E.MonitorId IN ('.$user['MonitorIds'].')'; } if ( count($selected_monitor_ids) ) { $monitor_ids_sql = ' IN (' . implode(',',$selected_monitor_ids).')'; $eventsSql .= ' AND E.MonitorId '.$monitor_ids_sql; - $frameSql .= ' AND E.MonitorId '.$monitor_ids_sql; + $framesSql .= ' AND E.MonitorId '.$monitor_ids_sql; +} +if ( isset($_REQUEST['archive_status']) ) { + $_SESSION['archive_status'] = $_REQUEST['archive_status']; +} +if ( isset($_SESSION['archive_status']) ) { + if ( $_SESSION['archive_status'] == 'Archived' ) { + $eventsSql .= ' AND E.Archived=1'; + $framesSql .= ' AND E.Archived=1'; + } else if ( $_SESSION['archive_status'] == 'Unarchived' ) { + $eventsSql .= ' AND E.Archived=0'; + $framesSql .= ' AND E.Archived=0'; + } } // Parse input parameters -- note for future, validate/clean up better in case we don't get called from self. @@ -195,24 +207,23 @@ $minTimeSecs = $maxTimeSecs = 0; if ( isset($minTime) && isset($maxTime) ) { $minTimeSecs = strtotime($minTime); $maxTimeSecs = strtotime($maxTime); - Logger::Debug("Min/max time secs: $minTimeSecs $maxTimeSecs"); $eventsSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'"; - $frameSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'"; - $frameSql .= ") AND TimeStamp > '" . $minTime . "' AND TimeStamp < '" . $maxTime . "'"; + $framesSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'"; + $framesSql .= ") AND TimeStamp > '" . $minTime . "' AND TimeStamp < '" . $maxTime . "'"; } else { - $frameSql .= ')'; + $framesSql .= ')'; } -#$frameSql .= ' GROUP BY E.Id, E.MonitorId, F.TimeStamp, F.Delta ORDER BY E.MonitorId, F.TimeStamp ASC'; -#$frameSql .= ' GROUP BY E.Id, E.MonitorId, F.TimeStamp, F.Delta ORDER BY E.MonitorId, F.TimeStamp ASC'; +#$framesSql .= ' GROUP BY E.Id, E.MonitorId, F.TimeStamp, F.Delta ORDER BY E.MonitorId, F.TimeStamp ASC'; +#$framesSql .= ' GROUP BY E.Id, E.MonitorId, F.TimeStamp, F.Delta ORDER BY E.MonitorId, F.TimeStamp ASC'; $eventsSql .= ' ORDER BY E.Id ASC'; // DESC is intentional. We process them in reverse order so that we can point each frame to the next one in time. -$frameSql .= ' ORDER BY Id DESC'; +$framesSql .= ' ORDER BY Id DESC'; $monitors = array(); foreach( $displayMonitors as $row ) { if ( $row['Function'] == 'None' || $row['Type'] == 'WebSite' ) continue; - $Monitor = new Monitor( $row ); + $Monitor = new Monitor($row); $monitors[] = $Monitor; } @@ -225,7 +236,7 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
-