Rough in an archived status filter in montagereview.

This commit is contained in:
Isaac Connor 2018-10-09 11:06:54 -04:00
parent 4d626dfb4e
commit 217d1e44ba
2 changed files with 42 additions and 14 deletions

View File

@ -53,7 +53,7 @@ if ( !$liveMode ) {
$next_frames = array(); $next_frames = array();
if ( $result = dbQuery($frameSql) ) { if ( $result = dbQuery($framesSql) ) {
$next_frame = null; $next_frame = null;
while( $frame = $result->fetch(PDO::FETCH_ASSOC) ) { while( $frame = $result->fetch(PDO::FETCH_ASSOC) ) {
$event_id = $frame['EventId']; $event_id = $frame['EventId'];

View File

@ -111,7 +111,7 @@ $eventsSql = 'SELECT
// where not isnull(E.Frames) and not isnull(StartTime) "; // where not isnull(E.Frames) and not isnull(StartTime) ";
// Note that the delta value seems more accurate than the time stamp for some reason. // 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 SELECT Id, FrameId, EventId, TimeStamp, UNIX_TIMESTAMP(TimeStamp) AS TimeStampSecs, Score, Delta
FROM Frames FROM Frames
WHERE EventId IN (SELECT E.Id FROM Events AS E WHERE 1>0 WHERE EventId IN (SELECT E.Id FROM Events AS E WHERE 1>0
@ -122,12 +122,24 @@ $frameSql = '
$monitor_ids_sql = ''; $monitor_ids_sql = '';
if ( ! empty($user['MonitorIds']) ) { if ( ! empty($user['MonitorIds']) ) {
$eventsSql .= ' AND E.MonitorId IN ('.$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) ) { if ( count($selected_monitor_ids) ) {
$monitor_ids_sql = ' IN (' . implode(',',$selected_monitor_ids).')'; $monitor_ids_sql = ' IN (' . implode(',',$selected_monitor_ids).')';
$eventsSql .= ' AND E.MonitorId '.$monitor_ids_sql; $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. // Parse input parameters -- note for future, validate/clean up better in case we don't get called from self.
@ -195,18 +207,17 @@ $minTimeSecs = $maxTimeSecs = 0;
if ( isset($minTime) && isset($maxTime) ) { if ( isset($minTime) && isset($maxTime) ) {
$minTimeSecs = strtotime($minTime); $minTimeSecs = strtotime($minTime);
$maxTimeSecs = strtotime($maxTime); $maxTimeSecs = strtotime($maxTime);
Logger::Debug("Min/max time secs: $minTimeSecs $maxTimeSecs");
$eventsSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'"; $eventsSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'";
$frameSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'"; $framesSql .= " AND EndTime > '" . $minTime . "' AND StartTime < '" . $maxTime . "'";
$frameSql .= ") AND TimeStamp > '" . $minTime . "' AND TimeStamp < '" . $maxTime . "'"; $framesSql .= ") AND TimeStamp > '" . $minTime . "' AND TimeStamp < '" . $maxTime . "'";
} else { } else {
$frameSql .= ')'; $framesSql .= ')';
} }
#$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';
#$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';
$eventsSql .= ' ORDER BY E.Id 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. // 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(); $monitors = array();
foreach( $displayMonitors as $row ) { foreach( $displayMonitors as $row ) {
@ -225,7 +236,7 @@ xhtmlHeaders(__FILE__, translate('MontageReview') );
<?php echo getNavBarHTML() ?> <?php echo getNavBarHTML() ?>
<form id="montagereview_form" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get"> <form id="montagereview_form" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="get">
<input type="hidden" name="view" value="montagereview"/> <input type="hidden" name="view" value="montagereview"/>
<div id="header">&nbsp&nbsp <div id="header">&nbsp;&nbsp;
<a href="#"><span id="hdrbutton" class="glyphicon glyphicon-menu-up pull-right"></span></a> <a href="#"><span id="hdrbutton" class="glyphicon glyphicon-menu-up pull-right"></span></a>
<div id="flipMontageHeader"> <div id="flipMontageHeader">
<?php echo $filter_bar ?> <?php echo $filter_bar ?>
@ -261,6 +272,23 @@ if ( (!$liveMode) and (count($displayMonitors) != 0) ) {
} }
?> ?>
</div> </div>
<?php if ( !$liveMode ) { ?>
<div id="eventfilterdiv" class="input-group">
<label>Archive Status
<?php echo htmlSelect(
'archive_status',
array(
'' => translate('All'),
'Archived' => translate('Archived'),
'Unarchived' => translate('UnArchived'),
),
( isset($_SESSION['archive_status']) ? $_SESSION['archive_status'] : ''),
array('onchange'=>'this.form.submit();')
);
?>
</label>
</div>
<?php } // end if !live ?>
<div id="timelinediv"> <div id="timelinediv">
<canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas> <canvas id="timeline" onmousemove="mmove(event);" ontouchmove="tmove(event);" onmousedown="mdown(event);" onmouseup="mup(event);" onmouseout="mout(event);"></canvas>
<span id="scrubleft"></span> <span id="scrubleft"></span>