array(
"terms" => array(
array( "attr" => "Archived", "op" => "=", "val" => "0" ),
array( "cnj" => "and", "attr" => "DateTime", "op" => ">=", "val" => "-1 hour" ),
)
),
),
// Today
array(
"filter" => array(
"terms" => array(
array( "attr" => "Archived", "op" => "=", "val" => "0" ),
array( "cnj" => "and", "attr" => "DateTime", "op" => ">=", "val" => "today" ),
)
),
),
);
$running = daemonCheck();
$status = $running?$zmSlangRunning:$zmSlangStopped;
if ( $group = dbFetchOne( "select * from Groups where Name = 'Mobile'" ) )
$group_ids = array_flip(split( ',', $group['MonitorIds'] ));
$db_now = strftime( STRF_FMT_DATETIME_DB );
$monitors = array();
$max_width = 0;
$max_height = 0;
$cycle_count = 0;
$monitors = dbFetchAll( "select * from Monitors order by Sequence asc" );
for ( $i = 0; $i < count($monitors); $i++ )
{
if ( !visibleMonitor( $monitors[$i]['Id'] ) )
{
continue;
}
if ( $group && !empty($group_ids) && !array_key_exists( $monitors[$i]['Id'], $group_ids ) )
{
continue;
}
$monitors[$i]['Show'] = true;
$monitors[$i]['zmc'] = zmcStatus( $monitors[$i] );
$monitors[$i]['zma'] = zmaStatus( $monitors[$i] );
//$monitors[$i]['ZoneCount'] = dbFetchOne( "select count(Id) as ZoneCount from Zones where MonitorId = '".$monitors[$i]['Id']."'", "ZoneCount" );
$counts = array();
for ( $j = 0; $j < count($event_counts); $j++ )
{
$filter = addFilterTerm( $event_counts[$j]['filter'], count($event_counts[$j]['filter']['terms']), array( "cnj" => "and", "attr" => "MonitorId", "op" => "=", "val" => $monitors[$i]['Id'] ) );
parseFilter( $filter, false, '&' );
$counts[] = "count(if(1".$filter['sql'].",1,NULL)) as EventCount$j";
$monitors[$i]['event_counts'][$j]['filter'] = $filter;
}
$sql = "select ".join($counts,", ")." from Events as E where MonitorId = '".$monitors[$i]['Id']."'";
$counts = dbFetchOne( $sql );
if ( $monitors[$i]['Function'] != 'None' )
{
$cycle_count++;
if ( $max_width < $monitors[$i]['Width'] ) $max_width = $monitors[$i]['Width'];
if ( $max_height < $monitors[$i]['Height'] ) $max_height = $monitors[$i]['Height'];
}
$monitors[$i] = array_merge( $monitors[$i], $counts );
}
noCacheHeaders();
header("Content-type: application/xhtml+xml" );
echo( ''."\n" );
?>
= ZM_WEB_TITLE_PREFIX ?> - = $zmSlangConsole ?>
= makeLink( "$PHP_SELF?view=watch&mid=".$monitor['Id'], substr( $monitor['Name'], 0, 8 ), $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?> |
= makeLink( "$PHP_SELF?view=function&mid=".$monitor['Id'], "".substr( $monitor['Function'], 0, 4 )."", canEdit( 'Monitors' ) ) ?> |
= makeLink( "$PHP_SELF?view=events&page=1&".$monitor['event_counts'][$i]['filter']['query'], $monitor['EventCount'.$i], canView( 'Events' ) ) ?> |
= makeLink( "$PHP_SELF?view=devices", $zmSlangDevices, canView('Devices' ) ) ?> |
|
1 )
{
?>
= makeLink( "$PHP_SELF?view=montage", $zmSlangMontage, $running && canView( 'Stream' ) ) ?> |
|
= makeLink( "$PHP_SELF?view=events&page=1&".$event_counts[$i]['filter']['query'], $event_counts[$i]['total'], canView( 'Events' ) ) ?> |