'$db_now' - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 DAY && E.Archived = 0,1,NULL)) as DayEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 7 DAY && E.Archived = 0,1,NULL)) as WeekEventCount, count(if(E.StartTime>'$db_now' - INTERVAL 1 MONTH && E.Archived = 0,1,NULL)) as MonthEventCount from Monitors as M left join Events as E on E.MonitorId = M.Id group by M.Id order by M.Id";
$result = mysql_query( $sql );
if ( !$result )
echo mysql_error();
$monitors = array();
$max_width = 0;
$max_height = 0;
$cycle_count = 0;
while( $row = mysql_fetch_assoc( $result ) )
{
$row['zmc'] = zmcCheck( $row );
$row['zma'] = zmaCheck( $row );
//$sql = "select count(Id) as ZoneCount, count(if(Type='Active',1,NULL)) as ActZoneCount, count(if(Type='Inclusive',1,NULL)) as IncZoneCount, count(if(Type='Exclusive',1,NULL)) as ExcZoneCount, count(if(Type='Inactive',1,NULL)) as InactZoneCount from Zones where MonitorId = '$row[Id]'";
$sql = "select count(Id) as ZoneCount from Zones where MonitorId = '$row[Id]'";
$result2 = mysql_query( $sql );
if ( !$result2 )
echo mysql_error();
$row2 = mysql_fetch_assoc( $result2 );
$monitors[] = array_merge( $row, $row2 );
if ( $row['Function'] != 'None' )
{
$cycle_count++;
if ( $max_width < $row[Width] ) $max_width = $row[Width];
if ( $max_height < $row[Height] ) $max_height = $row[Height];
}
}
$montage_rows = intval(ceil($cycle_count/ZM_WEB_MONTAGE_MAX_COLS));
$montage_cols = $cycle_count>=ZM_WEB_MONTAGE_MAX_COLS?ZM_WEB_MONTAGE_MAX_COLS:$cycle_count;
?>
ZM - Console
ZM - Cycle Watch
=ZM_WEB_MONTAGE_MAX_COLS?ZM_WEB_MONTAGE_MAX_COLS:count($monitors);
$widths = array();
$heights = array();
for ( $i = 0; $i < count($monitors); $i++ )
{
$monitor = $monitors[$i];
$frame_height = $monitor[Height]+16;
$row = $i/ZM_WEB_MONTAGE_MAX_COLS;
$col = $i%ZM_WEB_MONTAGE_MAX_COLS;
if ( $frame_height > $heights[$row] )
$heights[$row] = $frame_height;
if ( $monitor[Width] > $widths[$col] )
$widths[$col] = $monitor[Width];
}
$row_spec = join( ',', $heights );
$col_spec = join( ',', $widths );
?>
ZM - Montage
ZM - Montage Header
ZM - = $monitor[Name] ?> - MontageFeed
0 && $last_status == 0 );
$old_alarm = ( $status == 0 && $last_status > 0 );
$refresh = (isset($force)||$forced||$status)?1:REFRESH_STATUS;
$url = "$PHP_SELF?view=montagestatus&mid=$mid&last_status=$status";
header("Refresh: $refresh; URL='$url'" );
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
|
Status: = $status_string ?> - = $fps_string ?> fps |
|
ZM - = $monitor[Name] ?> - Watch
ZM - = $monitor[Name] ?> - WatchFeed
0 && $last_status == 0 );
$old_alarm = ( $status == 0 && $last_status > 0 );
$refresh = (isset($force)||$forced||$status)?1:REFRESH_STATUS;
$url = "$PHP_SELF?view=watchstatus&mid=$mid&last_status=$status".(($force||$forced)?"&forced=1":"");
header("Refresh: $refresh; URL='$url'" );
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
ZM - = $monitor ?> - Events
'."\n";
}
for ( $i = 1; $i <= $trms; $i++ )
{
$conjunction_name = "cnj$i";
$obracket_name = "obr$i";
$cbracket_name = "cbr$i";
$attr_name = "attr$i";
$op_name = "op$i";
$value_name = "val$i";
if ( $$conjunction_name )
{
$filter_query .= "&$conjunction_name=".$$conjunction_name;
$filter_sql .= " ".$$conjunction_name." ";
$filter_fields .= ''."\n";
}
if ( $$obracket_name )
{
$filter_query .= "&$obracket_name=".$$obracket_name;
$filter_sql .= str_repeat( "(", $$obracket_name );
$filter_fields .= ''."\n";
}
if ( $$attr_name )
{
$filter_query .= "&$attr_name=".$$attr_name;
$filter_fields .= ''."\n";
switch ( $$attr_name )
{
case 'DateTime':
$dt_val = strtotime( $$value_name );
$filter_sql .= "E.StartTime ".$$op_name." from_unixtime( $dt_val )";
$filter_query .= "&$op_name=".urlencode($$op_name);
$filter_fields .= ''."\n";
break;
case 'Date':
$dt_val = strtotime( $$value_name );
$filter_sql .= "to_days( E.StartTime ) ".$$op_name." to_days( from_unixtime( $dt_val ) )";
$filter_query .= "&$op_name=".urlencode($$op_name);
$filter_fields .= ''."\n";
break;
case 'Time':
$dt_val = strtotime( $$value_name );
$filter_sql .= "extract( hour_second from E.StartTime ) ".$$op_name." extract( hour_second from from_unixtime( $dt_val ) )";
$filter_query .= "&$op_name=".urlencode($$op_name);
$filter_fields .= ''."\n";
break;
case 'Weekday':
$dt_val = strtotime( $$value_name );
$filter_sql .= "weekday( E.StartTime ) ".$$op_name." weekday( from_unixtime( $dt_val ) )";
$filter_query .= "&$op_name=".urlencode($$op_name);
$filter_fields .= ''."\n";
break;
case 'Length':
case 'Frames':
case 'AlarmFrames':
case 'TotScore':
case 'AvgScore':
case 'MaxScore':
$filter_sql .= "E.".$$attr_name." ".$$op_name." ".$$value_name;
$filter_query .= "&$op_name=".urlencode($$op_name);
$filter_fields .= ''."\n";
break;
case 'Archived':
$filter_sql .= "E.Archived = ".$$value_name;
break;
}
$filter_query .= "&$value_name=".urlencode($$value_name);
$filter_fields .= ''."\n";
}
if ( $$cbracket_name )
{
$filter_query .= "&$cbracket_name=".$$cbracket_name;
$filter_sql .= str_repeat( ")", $$cbracket_name );
$filter_fields .= ''."\n";
}
}
if ( $filter_sql )
{
$sql .= " and ( $filter_sql )";
}
$sql .= " order by $sort_column $sort_order";
//echo $sql;
$result = mysql_query( $sql );
if ( !$result )
{
die( mysql_error() );
}
$n_rows = mysql_num_rows( $result );
//echo $filter_query;
?>
ZM - = $monitor[Name] ?> - Events
'Choose Filter' );
$result = mysql_query( "select * from Filters where MonitorId = '$mid' order by Name" );
if ( !$result )
die( mysql_error() );
while ( $row = mysql_fetch_assoc( $result ) )
{
$filter_names[$row[Name]] = $row[Name];
if ( $filter_name == $row[Name] )
{
$filter_data = $row;
}
}
if ( $filter_data )
{
//$filter_query = unserialize( $filter_data[Query] );
//if ( is_array($filter_query) )
//{
//while( list( $key, $value ) = each( $filter_query ) )
//{
//$$key = $value;
//}
//}
foreach( split( '&', $filter_data[Query] ) as $filter_parm )
{
list( $key, $value ) = split( '=', $filter_parm, 2 );
if ( $key )
{
$$key = $value;
}
}
}
$conjunction_types = array( 'and'=>'and', 'or'=>'or' );
$obracket_types = array( ''=>'' );
$cbracket_types = array( ''=>'' );
for ( $i = 1; $i <= ceil(($trms-1)/2); $i++ )
{
$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'=>'Duration', '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' );
?>
ZM - = $monitor[Name] ?> - Event Filter