103 lines
3.6 KiB
PHP
103 lines
3.6 KiB
PHP
|
<?php
|
||
|
//
|
||
|
// ZoneMinder web watch view file, $Date$, $Revision$
|
||
|
// Copyright (C) 2003, 2004, 2005, 2006 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( 'Stream' ) )
|
||
|
{
|
||
|
$_REQUEST['view'] = "error";
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
$monitor = dbFetchMonitor( $_REQUEST['mid'] );
|
||
|
|
||
|
$zmuCommand = getZmuCommand( " -m ".$_REQUEST['mid']." -s -f" );
|
||
|
$zmuOutput = exec( escapeshellcmd( $zmuCommand ) );
|
||
|
list( $status, $fps ) = split( ' ', $zmuOutput );
|
||
|
$statusString = $SLANG['Unknown'];
|
||
|
$fpsString = "--.--";
|
||
|
$class = "infoText";
|
||
|
if ( $status <= STATE_PREALARM )
|
||
|
{
|
||
|
$statusString = $SLANG['Idle'];
|
||
|
}
|
||
|
elseif ( $status == STATE_ALARM )
|
||
|
{
|
||
|
$statusString = $SLANG['Alarm'];
|
||
|
$class = "errorText";
|
||
|
}
|
||
|
elseif ( $status == STATE_ALERT )
|
||
|
{
|
||
|
$statusString = $SLANG['Alert'];
|
||
|
$class = "warnText";
|
||
|
}
|
||
|
elseif ( $status == STATE_TAPE )
|
||
|
{
|
||
|
$statusString = $SLANG['Record'];
|
||
|
}
|
||
|
$fpsString = sprintf( "%.2f", $fps );
|
||
|
|
||
|
$sql = "select * from Monitors where Function != 'None' order by Sequence";
|
||
|
$monitors = array();
|
||
|
$monIdx = 0;
|
||
|
$maxWidth = 0;
|
||
|
$maxHeight = 0;
|
||
|
foreach( dbFetchAll( $sql ) as $row )
|
||
|
{
|
||
|
if ( !visibleMonitor( $row['Id'] ) )
|
||
|
{
|
||
|
continue;
|
||
|
}
|
||
|
if ( isset($monitor['Id']) && $row['Id'] == $monitor['Id'] )
|
||
|
$monIdx = count($monitors);
|
||
|
if ( $maxWidth < $row['Width'] ) $maxWidth = $row['Width'];
|
||
|
if ( $maxHeight < $row['Height'] ) $maxHeight = $row['Height'];
|
||
|
$monitors[] = $row;
|
||
|
}
|
||
|
|
||
|
//$monitor = $monitors[$monIdx];
|
||
|
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]['Id']:$monitors[$monIdx+1]['Id'];
|
||
|
$prevMid = $monIdx==0?$monitors[(count($monitors)-1)]['Id']:$monitors[$monIdx-1]['Id'];
|
||
|
|
||
|
$scale = getDeviceScale( $monitor['Width'], $monitor['Height'] );
|
||
|
$imageSrc = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ), '&' );
|
||
|
|
||
|
xhtmlHeaders( __FILE__, $monitor['Name'].' - '.$SLANG['Watch'] );
|
||
|
?>
|
||
|
<body>
|
||
|
<div id="page">
|
||
|
<div id="content">
|
||
|
<p class="<?= $class ?>"><?= makeLink( "?view=events&page=1&view=events&page=1&filter%5Bterms%5D%5B0%5D%5Battr%5D%3DMonitorId&filter%5Bterms%5D%5B0%5D%5Bop%5D%3D%3D&filter%5Bterms%5D%5B0%5D%5Bval%5D%3D".$monitor['Id']."&sort_field=Id&sort_desc=1", $monitor['Name'], canView( 'Events' ) ) ?>: <?= $statusString ?> - <?= $fpsString ?> fps</p>
|
||
|
<p><a href="?view=<?= $_REQUEST['view'] ?>&mid=<?= $monitor['Id'] ?>"><img src="<?= $imageSrc ?>" alt="<?= $monitor['Name'] ?>" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"/></a></p>
|
||
|
<?php
|
||
|
if ( $nextMid != $monitor['Id'] || $prevMid != $monitor['Id'] )
|
||
|
{
|
||
|
?>
|
||
|
<div id="contentButtons">
|
||
|
<a href="?view=<?= $_REQUEST['view'] ?>&mid=<?= $prevMid ?>"><?= $SLANG['Prev'] ?></a>
|
||
|
<a href="?view=console"><?= $SLANG['Console'] ?></a>
|
||
|
<a href="?view=<?= $_REQUEST['view'] ?>&mid=<?= $nextMid ?>"><?= $SLANG['Next'] ?></a>
|
||
|
</div>
|
||
|
<?php
|
||
|
}
|
||
|
?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|