Added Total Score for events.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@259 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
parent
c643b518e9
commit
efe78749c3
|
@ -20,6 +20,8 @@ alter table Monitors modify column Function enum('None','Passive','Active','X10'
|
|||
update Monitors set LabelFormat = '%%s - %y/%m/%d %H:%M:%S';
|
||||
update Monitors set LabelX = 0;
|
||||
update Monitors set LabelY = Height-8;
|
||||
alter table Events add column TotScore int unsigned not null default 0 after AlarmFrames;
|
||||
update Events set TotScore = AlarmFrames * AvgScore where TotScore = 0;
|
||||
alter table Events modify column Archived tinyint unsigned not null default 0;
|
||||
alter table Events add column Uploaded tinyint unsigned not null default 0 after Archived;
|
||||
alter table Events add column LearnState char(1) default '' after Uploaded;
|
||||
|
|
|
@ -25,6 +25,7 @@ CREATE TABLE Events (
|
|||
Length int(10) unsigned default NULL,
|
||||
Frames int(10) unsigned default NULL,
|
||||
AlarmFrames int(10) unsigned default NULL,
|
||||
TotScore int(10) unsigned NOT NULL default '0',
|
||||
AvgScore tinyint(3) unsigned default '0',
|
||||
MaxScore tinyint(3) unsigned default '0',
|
||||
Archived tinyint(3) unsigned NOT NULL default '0',
|
||||
|
|
|
@ -299,7 +299,7 @@ sub GetFilters
|
|||
}
|
||||
}
|
||||
#print( Dumper( %filter_terms ) );
|
||||
my $sql = "select E.Id, E.Name,unix_timestamp(E.StartTime) as Time,E.Length,E.Frames,E.AlarmFrames,E.AvgScore,E.MaxScore,E.Archived,E.Uploaded,E.LearnState from Events as E inner join Monitors as M on M.Id = E.MonitorId where M.Id = '$monitor'";
|
||||
my $sql = "select E.Id, E.Name,unix_timestamp(E.StartTime) as Time,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived,E.Uploaded,E.LearnState from Events as E inner join Monitors as M on M.Id = E.MonitorId where M.Id = '$monitor'";
|
||||
my $filter_sql = '';
|
||||
for ( my $i = 1; $i <= $filter_terms{trms}; $i++ )
|
||||
{
|
||||
|
|
|
@ -1332,7 +1332,7 @@ Event::~Event()
|
|||
static char end_time_str[32];
|
||||
|
||||
strftime( end_time_str, sizeof(end_time_str), "%Y-%m-%d %H:%M:%S", localtime( &end_time ) );
|
||||
sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %d, Frames = %d, AlarmFrames = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, (end_time-start_time), frames, alarm_frames, (int)(tot_score/alarm_frames), max_score, id );
|
||||
sprintf( sql, "update Events set Name='Event-%d', EndTime = '%s', Length = %d, Frames = %d, AlarmFrames = %d, TotScore = %d, AvgScore = %d, MaxScore = %d where Id = %d", id, end_time_str, (end_time-start_time), frames, alarm_frames, tot_score, (int)(tot_score/alarm_frames), max_score, id );
|
||||
if ( mysql_query( &dbconn, sql ) )
|
||||
{
|
||||
Error(( "Can't update event: %s\n", mysql_error( &dbconn ) ));
|
||||
|
|
|
@ -652,6 +652,9 @@ function configureButton(form,name)
|
|||
case 'AlarmFrames' :
|
||||
$sort_column = "E.AlarmFrames";
|
||||
break;
|
||||
case 'TotScore' :
|
||||
$sort_column = "E.TotScore";
|
||||
break;
|
||||
case 'AvgScore' :
|
||||
$sort_column = "E.AvgScore";
|
||||
break;
|
||||
|
@ -672,7 +675,7 @@ function configureButton(form,name)
|
|||
$monitor = mysql_fetch_assoc( $result );
|
||||
|
||||
// XXX
|
||||
$sql = "select E.Id, E.Name,unix_timestamp(E.StartTime) as Time,E.Length,E.Frames,E.AlarmFrames,E.AvgScore,E.MaxScore,E.Archived,E.LearnState from Monitors as M, Events as E where M.Id = '$mid' and M.Id = E.MonitorId";
|
||||
$sql = "select E.Id, E.Name,unix_timestamp(E.StartTime) as Time,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived,E.LearnState from Monitors as M, Events as E where M.Id = '$mid' and M.Id = E.MonitorId";
|
||||
$filter_query = '';
|
||||
$filter_sql = '';
|
||||
$filter_fields = '';
|
||||
|
@ -734,6 +737,7 @@ function configureButton(form,name)
|
|||
case 'Length':
|
||||
case 'Frames':
|
||||
case 'AlarmFrames':
|
||||
case 'TotScore':
|
||||
case 'AvgScore':
|
||||
case 'MaxScore':
|
||||
$filter_sql .= "E.".$$attr_name." ".$$op_name." ".$$value_name;
|
||||
|
@ -855,9 +859,10 @@ location.href = '<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php
|
|||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=Time&sort_asc=<?php echo $sort_field == 'Time'?!$sort_asc:0 ?>">Time<?php if ( $sort_field == "Time" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=Secs&sort_asc=<?php echo $sort_field == 'Secs'?!$sort_asc:0 ?>">Length<?php if ( $sort_field == "Secs" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=Frames&sort_asc=<?php echo $sort_field == 'Frames'?!$sort_asc:0 ?>">Frames<?php if ( $sort_field == "Frames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=AlarmFrames&sort_asc=<?php echo $sort_field == 'AlarmFrames'?!$sort_asc:0 ?>">Alarm Frames<?php if ( $sort_field == "AlarmFrames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=AvgScore&sort_asc=<?php echo $sort_field == 'AvgScore'?!$sort_asc:0 ?>">Avg. Score<?php if ( $sort_field == "AvgScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=MaxScore&sort_asc=<?php echo $sort_field == 'MaxScore'?!$sort_asc:0 ?>">Max. Score<?php if ( $sort_field == "MaxScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=AlarmFrames&sort_asc=<?php echo $sort_field == 'AlarmFrames'?!$sort_asc:0 ?>">Alarm<br>Frames<?php if ( $sort_field == "AlarmFrames" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=TotScore&sort_asc=<?php echo $sort_field == 'TotScore'?!$sort_asc:0 ?>">Total<br>Score<?php if ( $sort_field == "TotScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=AvgScore&sort_asc=<?php echo $sort_field == 'AvgScore'?!$sort_asc:0 ?>">Avg.<br>Score<?php if ( $sort_field == "AvgScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text"><a href="<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php echo $filter_query ?><?php echo $sort_parms ?>&sort_field=MaxScore&sort_asc=<?php echo $sort_field == 'MaxScore'?!$sort_asc:0 ?>">Max.<br>Score<?php if ( $sort_field == "MaxScore" ) if ( $sort_asc ) echo "(^)"; else echo "(v)"; ?></a></td>
|
||||
<td class="text">Mark</td>
|
||||
</tr>
|
||||
<?php
|
||||
|
@ -877,6 +882,7 @@ location.href = '<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php
|
|||
<td align="center" class="text"><?php echo $row[Length] ?></td>
|
||||
<td align="center" class="text"><?php echo $row[Frames] ?></td>
|
||||
<td align="center" class="text"><?php echo $row[AlarmFrames] ?></td>
|
||||
<td align="center" class="text"><?php echo $row[TotScore] ?></td>
|
||||
<td align="center" class="text"><?php echo $row[AvgScore] ?></td>
|
||||
<td align="center" class="text"><?php echo $row[MaxScore] ?></td>
|
||||
<td align="center" class="text"><input type="checkbox" name="mark_eids[]" value="<?php echo $row[Id] ?>" onClick="configureButton( event_form, 'mark_eids' );"></td>
|
||||
|
@ -944,7 +950,7 @@ location.href = '<?php echo $PHP_SELF ?>?view=events&mid=<?php echo $mid ?><?php
|
|||
$obracket_types[$i] = str_repeat( "(", $i );
|
||||
$cbracket_types[$i] = str_repeat( ")", $i );
|
||||
}
|
||||
$attr_types = array( 'DateTime'=>'Date/Time', 'Date'=>'Date', 'Time'=>'Time', 'Weekday'=>'Weekday', 'Length'=>'Length', 'Frames'=>'Frames', 'AlarmFrames'=>'Alarm Frames', 'AvgScore'=>'Avg. Score', 'MaxScore'=>'Max. Score', 'Archived'=>'Archive Status' );
|
||||
$attr_types = array( 'DateTime'=>'Date/Time', 'Date'=>'Date', 'Time'=>'Time', 'Weekday'=>'Weekday', 'Length'=>'Length', 'Frames'=>'Frames', 'AlarmFrames'=>'Alarm Frames', 'TotScore'=>'Total Score', 'AvgScore'=>'Avg. Score', 'MaxScore'=>'Max. Score', 'Archived'=>'Archive Status' );
|
||||
$op_types = array( '='=>'equal to', '!='=>'not equal to', '>='=>'greater than or equal to', '>'=>'greater than', '<'=>'less than', '<='=>'less than or equal to' );
|
||||
$archive_types = array( '0'=>'Unarchived Only', '1'=>'Archived Only' );
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue