2008-07-14 21:54:50 +08:00
< ? php
//
// ZoneMinder web stats view file, $Date$, $Revision$
2008-07-25 17:48:16 +08:00
// Copyright (C) 2001-2008 Philip Coombes
2008-07-14 21:54:50 +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
2016-12-26 23:23:16 +08:00
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2008-07-14 21:54:50 +08:00
//
if ( ! canView ( 'Events' ) )
{
2008-09-26 17:47:20 +08:00
$view = " error " ;
2008-07-14 21:54:50 +08:00
return ;
}
2008-09-26 17:47:20 +08:00
$eid = validInt ( $_REQUEST [ 'eid' ]);
$fid = validInt ( $_REQUEST [ 'fid' ]);
2013-12-18 01:53:15 +08:00
$sql = 'SELECT S.*,E.*,Z.Name AS ZoneName,Z.Units,Z.Area,M.Name AS MonitorName 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 = ? AND S.FrameId = ? ORDER BY S.ZoneId' ;
$stats = dbFetchAll ( $sql , NULL , array ( $eid , $fid ) );
2008-07-14 21:54:50 +08:00
$focusWindow = true ;
2015-05-10 21:10:30 +08:00
xhtmlHeaders ( __FILE__ , translate ( 'Stats' ) . " - " . $eid . " - " . $fid );
2008-07-14 21:54:50 +08:00
?>
< body >
< div id = " page " >
< div id = " header " >
< div id = " headerButtons " >
2015-05-10 21:10:30 +08:00
< a href = " # " onclick = " closeWindow(); return( false ); " >< ? php echo translate ( 'Close' ) ?> </a>
2008-07-14 21:54:50 +08:00
</ div >
2015-05-10 21:10:30 +08:00
< h2 >< ? php echo translate ( 'Stats' ) ?> - <?php echo $eid ?> - <?php echo $fid ?></h2>
2008-07-14 21:54:50 +08:00
</ div >
< div id = " content " >
2019-02-10 13:39:19 +08:00
< form name = " contentForm " id = " contentForm " method = " get " action = " ? " >
2008-07-14 21:54:50 +08:00
< input type = " hidden " name = " view " value = " none " />
< table id = " contentTable " class = " major " cellspacing = " 0 " >
< thead >
< tr >
2015-05-10 21:10:30 +08:00
< th class = " colZone " >< ? php echo translate ( 'Zone' ) ?> </th>
< th class = " colPixelDiff " >< ? php echo translate ( 'PixelDiff' ) ?> </th>
< th class = " colAlarmPx " >< ? php echo translate ( 'AlarmPx' ) ?> </th>
< th class = " colFilterPx " >< ? php echo translate ( 'FilterPx' ) ?> </th>
< th class = " colBlobPx " >< ? php echo translate ( 'BlobPx' ) ?> </th>
< th class = " colBlobs " >< ? php echo translate ( 'Blobs' ) ?> </th>
< th class = " colBlobSizes " >< ? php echo translate ( 'BlobSizes' ) ?> </th>
< th class = " colAlarmLimits " >< ? php echo translate ( 'AlarmLimits' ) ?> </th>
< th class = " colScore " >< ? php echo translate ( 'Score' ) ?> </th>
2008-07-14 21:54:50 +08:00
</ tr >
</ thead >
< tbody >
< ? php
if ( count ( $stats ) )
{
foreach ( $stats as $stat )
{
?>
< tr >
2014-12-05 07:44:23 +08:00
< td class = " colZone " >< ? php echo validHtmlStr ( $stat [ 'ZoneName' ]) ?> </td>
< td class = " colPixelDiff " >< ? php echo validHtmlStr ( $stat [ 'PixelDiff' ]) ?> </td>
< td class = " colAlarmPx " >< ? php echo sprintf ( " %d (%d%%) " , $stat [ 'AlarmPixels' ], ( 100 * $stat [ 'AlarmPixels' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " colFilterPx " >< ? php echo sprintf ( " %d (%d%%) " , $stat [ 'FilterPixels' ], ( 100 * $stat [ 'FilterPixels' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " colBlobPx " >< ? php echo sprintf ( " %d (%d%%) " , $stat [ 'BlobPixels' ], ( 100 * $stat [ 'BlobPixels' ] / $stat [ 'Area' ]) ) ?> </td>
< td class = " colBlobs " >< ? php echo validHtmlStr ( $stat [ 'Blobs' ]) ?> </td>
2008-07-14 21:54:50 +08:00
< ? php
if ( $stat [ 'Blobs' ] > 1 )
{
?>
2014-12-05 07:44:23 +08:00
< td class = " colBlobSizes " >< ? php echo sprintf ( " %d-%d (%d%%-%d%%) " , $stat [ 'MinBlobSize' ], $stat [ 'MaxBlobSize' ], ( 100 * $stat [ 'MinBlobSize' ] / $stat [ 'Area' ]), ( 100 * $stat [ 'MaxBlobSize' ] / $stat [ 'Area' ]) ) ?> </td>
2008-07-14 21:54:50 +08:00
< ? php
}
else
{
?>
2014-12-05 07:44:23 +08:00
< td class = " colBlobSizes " >< ? php echo sprintf ( " %d (%d%%) " , $stat [ 'MinBlobSize' ], 100 * $stat [ 'MinBlobSize' ] / $stat [ 'Area' ] ) ?> </td>
2008-07-14 21:54:50 +08:00
< ? php
}
?>
2014-12-05 07:44:23 +08:00
< td class = " colAlarmLimits " >< ? php echo validHtmlStr ( $stat [ 'MinX' ] . " , " . $stat [ 'MinY' ] . " - " . $stat [ 'MaxX' ] . " , " . $stat [ 'MaxY' ]) ?> </td>
< td class = " colScore " >< ? php echo $stat [ 'Score' ] ?> </td>
2008-07-14 21:54:50 +08:00
</ tr >
< ? php
}
}
else
{
?>
< tr >
2015-05-10 21:10:30 +08:00
< td class = " rowNoStats " colspan = " 9 " >< ? php echo translate ( 'NoStatisticsRecorded' ) ?> </td>
2008-07-14 21:54:50 +08:00
</ tr >
< ? php
}
?>
</ tbody >
</ table >
</ form >
</ div >
</ div >
</ body >
</ html >