Monitor();
# This is kinda weird.. so if we pass fid=0 or some other non-integer, then it loads max score
# perhaps we should consider being explicit, like fid = maxscore
if ( !empty($fid) ) {
$sql = 'SELECT * FROM Frames WHERE EventId = ? AND FrameId = ?';
if ( !($frame = dbFetchOne($sql, NULL, array($eid, $fid))) )
$frame = array('EventId'=>$eid, 'FrameId'=>$fid, 'Type'=>'Normal', 'Score'=>0);
} else {
$frame = dbFetchOne('SELECT * FROM Frames WHERE EventId = ? AND Score = ?', NULL, array($eid, $Event->MaxScore()));
}
$Frame = new ZM\Frame($frame);
$maxFid = $Event->Frames();
$firstFid = 1;
$prevFid = $fid-1;
$nextFid = $fid+1;
$lastFid = $maxFid;
$alarmFrame = $Frame->Type() == 'Alarm';
if ( isset($_REQUEST['scale']) ) {
$scale = validNum($_REQUEST['scale']);
} else if ( isset($_COOKIE['zmWatchScale'.$Monitor->Id()]) ) {
$scale = validNum($_COOKIE['zmWatchScale'.$Monitor->Id()]);
} else if ( isset($_COOKIE['zmWatchScale']) ) {
$scale = validNum($_COOKIE['zmWatchScale']);
} else {
$scale = max(reScale(SCALE_BASE, $Monitor->DefaultScale(), ZM_WEB_DEFAULT_SCALE), SCALE_BASE);
}
$scale = $scale ? $scale : 0;
$imageData = $Event->getImageSrc($frame, $scale, 0);
if ( !$imageData ) {
ZM\Error("No data found for Event $eid frame $fid");
$imageData = array();
}
$show = 'capt';
if (isset($_REQUEST['show']) && in_array($_REQUEST['show'], array('capt', 'anal'))) {
$show = $_REQUEST['show'];
} else if ( $imageData['hasAnalImage'] ) {
$show = 'anal';
}
$imagePath = $imageData['thumbPath'];
$eventPath = $imageData['eventPath'];
$dImagePath = sprintf('%s/%0'.ZM_EVENT_IMAGE_DIGITS.'d-diag-d.jpg', $eventPath, $Frame->FrameId());
$rImagePath = sprintf('%s/%0'.ZM_EVENT_IMAGE_DIGITS.'d-diag-r.jpg', $eventPath, $Frame->FrameId());
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Frame').' - '.$Event->Id().' - '.$Frame->FrameId());
?>
Id().'-'.$Frame->FrameId().' ('.$Frame->Score().')' ?>