2003-07-11 17:27:56 +08:00
< ? php
2004-01-08 19:45:57 +08:00
//
// ZoneMinder web stats view file, $Date$, $Revision$
// Copyright (C) 2003 Philip Coombes
//
// 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.
//
if ( ! canView ( 'Events' ) )
{
$view = " error " ;
return ;
}
2004-05-06 00:22:04 +08:00
$result = mysql_query ( " select S.*,E.*,Z.Name as ZoneName,Z.Units,Z.LoX,Z.LoY,Z.HiX,Z.HiY,M.Name as MonitorName,M.Width,M.Height from Stats as S left join Events as E on S.EventId = E.Id left join Zones as Z on S.ZoneId = Z.Id left join Monitors as M on E.MonitorId = M.Id where S.EventId = ' $eid ' and S.FrameId = ' $fid ' order by S.ZoneId " );
2004-01-08 19:45:57 +08:00
if ( ! $result )
die ( mysql_error () );
while ( $row = mysql_fetch_assoc ( $result ) )
{
2004-05-06 00:22:04 +08:00
if ( $row [ 'Units' ] == 'Percent' )
{
$row [ 'LoX' ] = round (( $row [ 'LoX' ] * ( $row [ 'Width' ] - 1 )) / 100 );
$row [ 'LoY' ] = round (( $row [ 'LoY' ] * ( $row [ 'Height' ] - 1 )) / 100 );
$row [ 'HiX' ] = round (( $row [ 'HiX' ] * ( $row [ 'Width' ] - 1 )) / 100 );
$row [ 'HiY' ] = round (( $row [ 'HiY' ] * ( $row [ 'Height' ] - 1 )) / 100 );
}
$row [ 'Area' ] = (( $row [ 'HiX' ] - $row [ 'LoX' ]) + 1 ) * (( $row [ 'HiY' ] - $row [ 'LoY' ]) + 1 );
2004-01-08 19:45:57 +08:00
$stats [] = $row ;
}
2003-07-11 17:27:56 +08:00
?>
2004-12-29 03:22:23 +08:00
<! DOCTYPE HTML PUBLIC " -//W3C//DTD HTML 4.01 Transitional//EN " >
2003-07-11 17:27:56 +08:00
< html >
< head >
2004-01-07 20:57:07 +08:00
< title > ZM - < ? = $zmSlangStats ?> <?= $eid."-".$fid ?></title>
2004-12-29 02:20:11 +08:00
< link rel = " stylesheet " href = " zm_html_styles.css " type = " text/css " >
2003-07-11 17:27:56 +08:00
< script language = " JavaScript " >
window . focus ();
function closeWindow ()
{
window . close ();
}
</ script >
</ head >
2004-05-06 00:22:04 +08:00
< body scroll = " auto " >
< table align = " center " width = " 96% " border = " 0 " >
2003-07-11 17:27:56 +08:00
< tr >
2004-01-07 20:57:07 +08:00
< td align = " left " class = " smallhead " >< b >< ? = $zmSlangFrame ?> <?= $eid."-".$fid ?></b></td>
< td align = " right " class = " text " >< a href = " javascript: closeWindow(); " >< ? = $zmSlangClose ?> </a></td>
2003-07-11 17:27:56 +08:00
</ tr >
< tr >< td colspan = " 2 " >< table width = " 100% " border = " 0 " bgcolor = " #7F7FB2 " cellpadding = " 3 " cellspacing = " 1 " >< tr bgcolor = " #FFFFFF " >
2004-01-07 20:57:07 +08:00
< td class = " smallhead " >< ? = $zmSlangZone ?> </td>
2004-05-06 00:22:04 +08:00
< td class = " smallhead " align = " center " >< ? = $zmSlangAlarmPx ?> </td>
< td class = " smallhead " align = " center " >< ? = $zmSlangFilterPx ?> </td>
< td class = " smallhead " align = " center " >< ? = $zmSlangBlobPx ?> </td>
< td class = " smallhead " align = " center " >< ? = $zmSlangBlobs ?> </td>
< td class = " smallhead " align = " center " >< ? = $zmSlangBlobSizes ?> </td>
< td class = " smallhead " align = " center " >< ? = $zmSlangAlarmLimits ?> </td>
< td class = " smallhead " align = " center " >< ? = $zmSlangScore ?> </td>
2003-07-11 17:27:56 +08:00
</ tr >
< ? php
2004-01-08 19:45:57 +08:00
if ( count ( $stats ) )
{
foreach ( $stats as $stat )
2003-07-11 17:27:56 +08:00
{
?>
< tr bgcolor = " #FFFFFF " >
2004-01-08 18:09:35 +08:00
< td class = " text " >< ? = $stat [ 'ZoneName' ] ?> </td>
2004-05-06 00:22:04 +08:00
< td class = " text " align = " center " >< ? = sprintf ( " %d (%d%%) " , $stat [ 'AlarmPixels' ], ( 100 * $stat [ 'AlarmPixels' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " text " align = " center " >< ? = sprintf ( " %d (%d%%) " , $stat [ 'FilterPixels' ], ( 100 * $stat [ 'FilterPixels' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " text " align = " center " >< ? = sprintf ( " %d (%d%%) " , $stat [ 'BlobPixels' ], ( 100 * $stat [ 'BlobPixels' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " text " align = " center " >< ? = $stat [ 'Blobs' ] ?> </td>
< td class = " text " align = " center " >< ? = sprintf ( " %d-%d (%d%%-%d%%) " , $stat [ 'MinBlobSize' ], $stat [ 'MaxBlobSize' ], ( 100 * $stat [ 'MinBlobSize' ] / $stat [ 'Area' ]), ( 100 * $stat [ 'MaxBlobSize' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " text " align = " center " >< ? = $stat [ 'MinX' ] . " , " . $stat [ 'MinY' ] . " - " . $stat [ 'MaxX' ] . " , " . $stat [ 'MaxY' ] ?> </td>
< td class = " text " align = " center " >< ? = $stat [ 'Score' ] ?> </td>
2003-07-11 17:27:56 +08:00
</ tr >
< ? php
}
2004-01-08 19:45:57 +08:00
}
else
{
2003-07-11 17:27:56 +08:00
?>
< tr bgcolor = " #FFFFFF " >
2004-01-07 20:57:07 +08:00
< td class = " text " colspan = " 8 " align = " center " >< br >< ? = $zmSlangNoStatisticsRecorded ?> <br><br></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
?>
</ table ></ td >
</ tr >
</ table >
</ body >
</ html >