XML Plugin: Modified event query to return frame scoring information along with the frame ID of the max. scoring frame

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3176 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
jaidhar 2010-11-05 17:50:39 +00:00
parent d6575d90e1
commit 1c7086dc39
1 changed files with 6 additions and 1 deletions

View File

@ -194,7 +194,7 @@ foreach( $displayMonitors as $monitor )
$offset = 0;
if (isset($_GET['numEvents'])) {
$numEvents = $_GET['numEvents'];
$eventsSql = "select E.Id,E.MonitorId,M.Name As MonitorName,E.Name,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived from Monitors as M inner join Events as E on (M.Id = E.MonitorId) where 1 and ( E.MonitorId = ".$monitor['Id']." ) order by E.StartTime desc";
$eventsSql = "select E.Id,E.MonitorId,M.Name As MonitorName,E.Name,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived,F.FrameId as MaxFrameId from Monitors as M inner join Events as E on (M.Id = E.MonitorId) and ( E.MonitorId = ".$monitor['Id']." ) inner join Frames as F on (E.Id = F.EventId) and (E.MaxScore = F.Score) and (F.Type = \"Alarm\") group by (E.Id) order by E.StartTime desc";
$eventsSql .= " limit ".$numEvents;
/* If there is an pageOff<x> tag for this monitor, then retrieve the offset. Otherwise, don't specify offset */
if (isset($_GET['pageOff'.$monitor['Id']])) {
@ -222,6 +222,11 @@ foreach( $displayMonitors as $monitor )
xml_tag_val("DURATION", $event['Length']);
xml_tag_val("FRAMES", $event['Frames']);
xml_tag_val("FPS", ($event['Length'] > 0)?ceil($event['Frames']/$event['Length']):0);
xml_tag_val("ALARMFRAMES", $event['AlarmFrames']);
xml_tag_val("TOTSCORE", $event['TotScore']);
xml_tag_val("AVGSCORE", $event['AvgScore']);
xml_tag_val("MAXSCORE", $event['MaxScore']);
xml_tag_val("MAXFRAMEID", $event['MaxFrameId']);
xml_tag_sec("EVENT",0);
}
}