2004-12-29 02:20:11 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web console file, $Date$, $Revision$
|
2006-01-17 19:32:47 +08:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006 Philip Coombes
|
2004-12-29 02:20:11 +08:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
2007-09-04 22:52:26 +08:00
|
|
|
$event_counts = array(
|
|
|
|
// Last Hour
|
|
|
|
array(
|
|
|
|
"filter" => 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" ),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2004-12-29 02:20:11 +08:00
|
|
|
$running = daemonCheck();
|
|
|
|
$status = $running?$zmSlangRunning:$zmSlangStopped;
|
|
|
|
|
2007-09-06 20:59:19 +08:00
|
|
|
if ( $group = dbFetchOne( "select * from Groups where Name = 'Mobile'" ) )
|
2007-09-04 22:52:26 +08:00
|
|
|
$group_ids = array_flip(split( ',', $group['MonitorIds'] ));
|
2005-01-27 04:57:08 +08:00
|
|
|
|
2006-03-28 06:01:33 +08:00
|
|
|
$db_now = strftime( STRF_FMT_DATETIME_DB );
|
2004-12-29 02:20:11 +08:00
|
|
|
$monitors = array();
|
|
|
|
$max_width = 0;
|
|
|
|
$max_height = 0;
|
|
|
|
$cycle_count = 0;
|
2007-09-04 22:52:26 +08:00
|
|
|
$monitors = dbFetchAll( "select * from Monitors order by Sequence asc" );
|
|
|
|
for ( $i = 0; $i < count($monitors); $i++ )
|
2004-12-29 02:20:11 +08:00
|
|
|
{
|
2007-09-04 22:52:26 +08:00
|
|
|
if ( !visibleMonitor( $monitors[$i]['Id'] ) )
|
2004-12-29 02:20:11 +08:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2007-09-04 22:52:26 +08:00
|
|
|
if ( $group && !empty($group_ids) && !array_key_exists( $monitors[$i]['Id'], $group_ids ) )
|
2005-01-27 04:57:08 +08:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2007-09-04 22:52:26 +08:00
|
|
|
$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' )
|
2004-12-29 02:20:11 +08:00
|
|
|
{
|
|
|
|
$cycle_count++;
|
2007-09-04 22:52:26 +08:00
|
|
|
if ( $max_width < $monitors[$i]['Width'] ) $max_width = $monitors[$i]['Width'];
|
|
|
|
if ( $max_height < $monitors[$i]['Height'] ) $max_height = $monitors[$i]['Height'];
|
2004-12-29 02:20:11 +08:00
|
|
|
}
|
2007-09-04 22:52:26 +08:00
|
|
|
$monitors[$i] = array_merge( $monitors[$i], $counts );
|
2004-12-29 02:20:11 +08:00
|
|
|
}
|
|
|
|
?>
|
2006-11-09 01:53:57 +08:00
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2004-12-29 02:20:11 +08:00
|
|
|
<head>
|
2005-05-06 20:24:57 +08:00
|
|
|
<title><?= ZM_WEB_TITLE_PREFIX ?> - <?= $zmSlangConsole ?></title>
|
2004-12-29 02:20:11 +08:00
|
|
|
<link rel="stylesheet" href="zm_xhtml_styles.css" type="text/css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
2005-11-07 03:06:58 +08:00
|
|
|
<table style="width: 100%">
|
|
|
|
<tr>
|
2006-05-05 18:53:04 +08:00
|
|
|
<td align="left"><a href="<?= $PHP_SELF ?>?view=<?= $view ?>"><?= preg_match( '/%/', DATE_FMT_CONSOLE_SHORT )?strftime( DATE_FMT_CONSOLE_SHORT ):date( DATE_FMT_CONSOLE_SHORT ) ?></a></td><td align="center"><?= makeLink( "$PHP_SELF?view=state", $status, canEdit( 'System' ) ) ?></td><td align="right"><?= getLoad() ?>/<?= getDiskPercent() ?>%</td>
|
2005-11-07 03:06:58 +08:00
|
|
|
</tr>
|
|
|
|
</table>
|
2006-11-13 20:05:09 +08:00
|
|
|
<table style="width: 100%">
|
2004-12-29 02:20:11 +08:00
|
|
|
<?php
|
2007-09-04 22:52:26 +08:00
|
|
|
for ( $i = 0; $i < count($event_counts); $i++ )
|
|
|
|
{
|
|
|
|
$event_counts[$i]['total'] = 0;
|
|
|
|
}
|
|
|
|
$zone_count = 0;
|
2004-12-29 02:20:11 +08:00
|
|
|
foreach( $monitors as $monitor )
|
|
|
|
{
|
2007-09-04 22:52:26 +08:00
|
|
|
if ( empty($monitor['Show']) )
|
|
|
|
continue;
|
|
|
|
for ( $i = 0; $i < count($event_counts); $i++ )
|
|
|
|
{
|
|
|
|
$event_counts[$i]['total'] += $monitor['EventCount'.$i];
|
|
|
|
}
|
|
|
|
//$zone_count += $monitor['ZoneCount'];
|
2004-12-29 02:20:11 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
|
|
|
<?php
|
|
|
|
if ( !$monitor['zmc'] )
|
|
|
|
{
|
|
|
|
$dclass = "redtext";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !$monitor['zma'] )
|
|
|
|
{
|
|
|
|
$dclass = "ambtext";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$dclass = "gretext";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( $monitor['Function'] == 'None' )
|
|
|
|
{
|
|
|
|
$fclass = "redtext";
|
|
|
|
}
|
|
|
|
elseif ( $monitor['Function'] == 'Monitor' )
|
|
|
|
{
|
|
|
|
$fclass = "ambtext";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$fclass = "gretext";
|
|
|
|
}
|
2005-12-23 00:47:19 +08:00
|
|
|
if ( !$monitor['Enabled'] )
|
2004-12-29 02:20:11 +08:00
|
|
|
{
|
|
|
|
$fclass .= "em";
|
|
|
|
}
|
|
|
|
?>
|
2005-11-22 23:18:57 +08:00
|
|
|
<td align="left" style="width: 6em"><?= makeLink( "$PHP_SELF?view=watch&mid=".$monitor['Id'], substr( $monitor['Name'], 0, 8 ), $running && ($monitor['Function'] != 'None') && canView( 'Stream' ) ) ?></td>
|
2004-12-29 02:20:11 +08:00
|
|
|
<td align="left" style="width: 4em"><?= makeLink( "$PHP_SELF?view=function&mid=".$monitor['Id'], "<span class=\"$fclass\">".substr( $monitor['Function'], 0, 4 )."</span>", canEdit( 'Monitors' ) ) ?></td>
|
2007-09-04 22:52:26 +08:00
|
|
|
<?php
|
|
|
|
for ( $i = 0; $i < count($event_counts); $i++ )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<td align="right" style="width: 3em"><?= makeLink( "$PHP_SELF?view=events&page=1&".$monitor['event_counts'][$i]['filter']['query'], $monitor['EventCount'.$i], canView( 'Events' ) ) ?></td>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2004-12-29 02:20:11 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr>
|
2006-11-09 18:54:19 +08:00
|
|
|
<?php
|
|
|
|
if ( ZM_OPT_X10 )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<td align="left"><?= makeLink( "$PHP_SELF?view=devices", $zmSlangDevices, canView('Devices' ) ) ?></td>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2004-12-29 02:20:11 +08:00
|
|
|
<td align="left"> </td>
|
2006-11-09 18:54:19 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2005-11-22 23:18:57 +08:00
|
|
|
<td align="center"><?= makeLink( "$PHP_SELF?view=montage", count($monitors), ( $running && canView( 'Stream' ) && $cycle_count > 1 ) ) ?></td>
|
2007-09-04 22:52:26 +08:00
|
|
|
<?php
|
|
|
|
for ( $i = 0; $i < count($event_counts); $i++ )
|
|
|
|
{
|
|
|
|
parseFilter( $event_counts[$i]['filter'], false, '&' );
|
|
|
|
?>
|
2007-09-18 16:42:33 +08:00
|
|
|
<td align="right"><?= makeLink( "$PHP_SELF?view=events&page=1&".$event_counts[$i]['filter']['query'], $event_counts[$i]['total'], canView( 'Events' ) ) ?></td>
|
2007-09-04 22:52:26 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
2004-12-29 02:20:11 +08:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|