2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
//
// ZoneMinder web console view file, $Date$, $Revision$
2005-02-24 22:40:14 +08:00
// Copyright (C) 2003, 2004, 2005 Philip Coombes
2004-01-08 19:45:57 +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.
//
2003-07-11 17:27:56 +08:00
2004-12-29 02:20:11 +08:00
$running = daemonCheck ();
$status = $running ? $zmSlangRunning : $zmSlangStopped ;
2003-07-11 17:27:56 +08:00
2004-01-08 19:45:57 +08:00
$db_now = strftime ( " %Y-%m-%d %H:%M:%S " );
2004-12-29 02:20:11 +08:00
$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 " ;
2004-01-08 19:45:57 +08:00
$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 ) )
{
2004-12-29 02:20:11 +08:00
if ( ! visibleMonitor ( $row [ 'Id' ] ) )
{
continue ;
}
$row [ 'zmc' ] = zmcCheck ( $row );
$row [ 'zma' ] = zmaCheck ( $row );
$sql = " select count(Id) as ZoneCount from Zones where MonitorId = ' " . $row [ 'Id' ] . " ' " ;
2004-01-08 19:45:57 +08:00
$result2 = mysql_query ( $sql );
if ( ! $result2 )
2003-07-11 17:27:56 +08:00
echo mysql_error ();
2004-01-08 19:45:57 +08:00
$row2 = mysql_fetch_assoc ( $result2 );
$monitors [] = array_merge ( $row , $row2 );
2004-12-29 02:20:11 +08:00
if ( $row [ 'Function' ] != 'None' )
2003-07-11 17:27:56 +08:00
{
2004-12-29 02:20:11 +08:00
$cycle_count ++ ;
if ( $max_width < $row [ 'Width' ] ) $max_width = $row [ 'Width' ];
if ( $max_height < $row [ 'Height' ] ) $max_height = $row [ 'Height' ];
2003-07-11 17:27:56 +08:00
}
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
< wml >
2004-01-07 20:57:07 +08:00
< card id = " zmConsole " title = " ZM - <?= $zmSlangConsole ?> " ontimer = " <?= $PHP_SELF ?>?view=<?= $view ?> " >
2004-12-29 02:20:11 +08:00
< timer value = " <?= REFRESH_MAIN*10 ?> " />
2003-07-11 17:27:56 +08:00
< p align = " center " >
2004-12-29 02:20:11 +08:00
< ? = date ( " H:i " ) ?> - <?= makeLink( "$PHP_SELF?view=state", $status, canEdit( 'System' ) ) ?> - <?= getLoad() ?> / <?= getDiskPercent() ?>%
< table columns = " 4 " align = " LLRR " >
< ? php
if ( false )
{
?>
2003-07-11 17:27:56 +08:00
< tr >
2004-12-29 02:20:11 +08:00
< td >< ? = substr ( $zmSlangName , 0 , 5 ) ?> </td>
< td >< ? = substr ( $zmSlangFunction , 0 , 4 ) ?> </td>
< td >< ? = $zmSlangHour ?> </td>
< td >< ? = $zmSlangToday ?> </td>
2003-07-11 17:27:56 +08:00
</ tr >
< ? php
2004-12-29 02:20:11 +08:00
}
$monitor_count = 0 ;
$hour_event_count = 0 ;
$today_event_count = 0 ;
2004-01-08 19:45:57 +08:00
foreach ( $monitors as $monitor )
{
2004-12-29 02:20:11 +08:00
$monitor_count ++ ;
$hour_event_count += $monitor [ 'HourEventCount' ];
$today_event_count += $monitor [ 'TodayEventCount' ];
2003-07-11 17:27:56 +08:00
?>
< tr >
2004-12-29 02:20:11 +08:00
< td >< ? = makeLink ( " $PHP_SELF ?view=watch&mid= " . $monitor [ 'Id' ], substr ( $monitor [ 'Name' ], 0 , 6 ), canView ( 'Stream' ), 'accesskey="' . $monitor_count . '"' ) ?> </td>
< td >< ? = makeLink ( " $PHP_SELF ?view=function&mid= " . $monitor [ 'Id' ], substr ( $monitor [ 'Function' ], 0 , 4 ), canEdit ( 'Monitors' ) ) ?> </td>
< td >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=3&attr1=MonitorId&op1=%3d&val1= " . $monitor [ 'Id' ] . " &cnj2=and&attr2=Archived&val2=0&cnj3=and&attr3=DateTime&op3=%3e%3d&val3=-1+hour " , $monitor [ 'HourEventCount' ], canView ( 'Events' ) ) ?> </td>
< td >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=3&attr1=MonitorId&op1=%3d&val1= " . $monitor [ 'Id' ] . " &cnj2=and&attr2=Archived&val2=0&cnj3=and&attr3=DateTime&op3=%3e%3d&val3=today " , $monitor [ 'TodayEventCount' ], canView ( 'Events' ) ) ?> </td>
2003-07-11 17:27:56 +08:00
</ tr >
< ? php
2004-01-08 19:45:57 +08:00
}
2003-07-11 17:27:56 +08:00
?>
2004-12-29 02:20:11 +08:00
< tr >
< td >& nbsp ; </ td >
< td >< ? = makeLink ( " $PHP_SELF ?view=cycle " , count ( $monitors ), ( canView ( 'Stream' ) && $cycle_count > 1 ) ) ?> </td>
< td >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=2&attr1=Archived&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=-1+hour " , $hour_event_count , canView ( 'Events' ) ) ?> </td>
< td >< ? = makeLink ( " $PHP_SELF ?view=events&page=1&filter=1&trms=2&attr1=Archived&val1=0&cnj2=and&attr2=DateTime&op2=%3e%3d&val2=today " , $today_event_count , canView ( 'Events' ) ) ?> </td>
</ tr >
2003-07-11 17:27:56 +08:00
</ table >
2004-12-29 02:20:11 +08:00
< do type = " accept " name = " Refresh " label = " <?= $zmSlangRefresh ?> " >
< go href = " <?= $PHP_SELF ?> " method = " post " >
< postfield name = " view " value = " <?= $view ?> " />
</ go >
</ do >
2003-07-11 17:27:56 +08:00
</ p >
</ card >
</ wml >