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?$SLANG['Running']:$SLANG['Stopped'];
if ( $group = dbFetchOne( "select * from Groups where Name = 'Mobile'" ) )
$groupIds = array_flip(explode( ',', $group['MonitorIds'] ));
$maxWidth = 0;
$maxHeight = 0;
$cycleCount = 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($groupIds) && !array_key_exists( $monitors[$i]['Id'], $groupIds ) )
{
continue;
}
$monitors[$i]['Show'] = true;
$monitors[$i]['zmc'] = zmcStatus( $monitors[$i] );
$monitors[$i]['zma'] = zmaStatus( $monitors[$i] );
$counts = array();
for ( $j = 0; $j < count($eventCounts); $j++ )
{
$filter = addFilterTerm( $eventCounts[$j]['filter'], count($eventCounts[$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]['eventCounts'][$j]['filter'] = $filter;
}
$sql = "select ".join($counts,", ")." from Events as E where MonitorId = '".$monitors[$i]['Id']."'";
$counts = dbFetchOne( $sql );
if ( $monitors[$i]['Function'] != 'None' )
{
$cycleCount++;
if ( $maxWidth < $monitors[$i]['Width'] ) $maxWidth = $monitors[$i]['Width'];
if ( $maxHeight < $monitors[$i]['Height'] ) $maxHeight = $monitors[$i]['Height'];
}
$monitors[$i] = array_merge( $monitors[$i], $counts );
}
xhtmlHeaders( __FILE__, $SLANG['Console'] );
?>
= makeLink( "?view=watch&mid=".$monitor['Id'], substr( $monitor['Name'], 0, 8 ), $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?> |
= makeLink( "?view=function&mid=".$monitor['Id'], "".substr( $monitor['Function'], 0, 4 )."", canEdit( 'Monitors' ) ) ?> |
= makeLink( "?view=events&page=1".$monitor['eventCounts'][$i]['filter']['query'], $monitor['EventCount'.$i], canView( 'Events' ) ) ?> |
= makeLink( "?view=devices", $SLANG['Devices'], canView('Devices' ) ) ?> |
|
1 ) {
?>
= makeLink( "?view=montage", $SLANG['Montage'], $running && canView( 'Stream' ) ) ?> |
|
= makeLink( "?view=events&page=1".$eventCounts[$i]['filter']['query'], $eventCounts[$i]['total'], canView( 'Events' ) ) ?> |