2004-12-29 02:20:11 +08:00
< ? php
//
// ZoneMinder web console file, $Date$, $Revision$
2005-02-24 22:40:14 +08:00
// Copyright (C) 2003, 2004, 2005 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.
//
$running = daemonCheck ();
$status = $running ? $zmSlangRunning : $zmSlangStopped ;
2005-01-27 04:57:08 +08:00
$sql = " select * from Groups where Name = 'Mobile' " ;
$result = mysql_query ( $sql );
if ( ! $result )
echo mysql_error ();
$group = mysql_fetch_assoc ( $result );
2004-12-29 02:20:11 +08:00
$db_now = strftime ( " %Y-%m-%d %H:%M:%S " );
$sql = " select M.*, count(if(E.StartTime>' $db_now ' - INTERVAL 1 HOUR && E.Archived = 0,1,NULL)) as HourEventCount, count(if((to_days(E.StartTime)=to_days(' $db_now ')) && E.Archived = 0,1,NULL)) as TodayEventCount 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 ) )
{
if ( ! visibleMonitor ( $row [ 'Id' ] ) )
{
continue ;
}
2005-01-27 04:57:08 +08:00
if ( $group && $group [ 'MonitorIds' ] && ! in_array ( $row [ 'Id' ], split ( ',' , $group [ 'MonitorIds' ] ) ) )
{
continue ;
}
2005-11-06 00:19:19 +08:00
$row [ 'zmc' ] = zmcStatus ( $row );
$row [ 'zma' ] = zmaStatus ( $row );
2004-12-29 02:20:11 +08:00
$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' ];
}
}
?>
< html >
< 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 >
< td align = " left " >< a href = " <?= $PHP_SELF ?>?view=<?= $view ?> " >< ? = date ( " H:i " ) ?> </a></td><td align="center"><?= makeLink( "$PHP_SELF?view=state", $status, canEdit( 'System' ) ) ?></td><td align="right"><?= getLoad() ?>/<?= getDiskPercent() ?>%</td>
</ tr >
</ table >
2004-12-29 02:20:11 +08:00
< table >
< ? php
$hour_event_count = 0 ;
$today_event_count = 0 ;
foreach ( $monitors as $monitor )
{
$hour_event_count += $monitor [ 'HourEventCount' ];
$today_event_count += $monitor [ 'TodayEventCount' ];
?>
< 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 " ;
}
if ( $monitor [ 'RunMode' ] == 'Triggered' )
{
$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>
2005-11-06 00:19:19 +08:00
< td align = " right " style = " width: 3em " >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=3&attr1=MonitorId&op1=%3d&val1= " . $monitor [ 'Id' ] . " &cnj2=and&attr2=Archived&op2=%3d&val2=0&cnj3=and&attr3=DateTime&op3=%3e%3d&val3=-1%20hour " , $monitor [ 'HourEventCount' ], canView ( 'Events' ) ) ?> </td>
< td align = " right " style = " width: 3em " >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=3&attr1=MonitorId&op1=%3d&val1= " . $monitor [ 'Id' ] . " &cnj2=and&attr2=Archived&op2=%3d&val2=0&cnj3=and&attr3=Date&op3=%3e%3d&val3=today " , $monitor [ 'TodayEventCount' ], canView ( 'Events' ) ) ?> </td>
2004-12-29 02:20:11 +08:00
</ tr >
< ? php
}
?>
< tr >
< td align = " left " >& nbsp ; </ td >
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>
2005-11-06 00:19:19 +08:00
< td align = " right " class = " text " >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=2&attr1=Archived&op1=%3d&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=-1%20hour " , $hour_event_count , canView ( 'Events' ) ) ?> </td>
< td align = " right " class = " text " >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=2&attr1=Archived&op1=%3d&val1=0&cnj2=and&attr2=Date&op2=%3e%3d&val2=today " , $today_event_count , canView ( 'Events' ) ) ?> </td>
2004-12-29 02:20:11 +08:00
</ tr >
</ table >
</ body >
</ html >