2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web cycle 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
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( !canView( 'Stream' ) ) {
|
|
|
|
$view = "error";
|
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( empty($_REQUEST['mode']) ) {
|
|
|
|
if ( canStream() )
|
|
|
|
$mode = "stream";
|
|
|
|
else
|
|
|
|
$mode = "still";
|
|
|
|
} else {
|
|
|
|
$mode = validHtmlStr($_REQUEST['mode']);
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2008-10-06 04:07:22 +08:00
|
|
|
$group = '';
|
|
|
|
$groupSql = '';
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( !empty($_REQUEST['group']) ) {
|
|
|
|
$group = validInt($_REQUEST['group']);
|
|
|
|
$row = dbFetchOne( 'SELECT * FROM Groups WHERE Id = ?', NULL, array($group) );
|
|
|
|
$groupSql = " and find_in_set( Id, '".$row['MonitorIds']."' )";
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2014-03-22 05:16:56 +08:00
|
|
|
$sql = "SELECT * FROM Monitors WHERE Function != 'None'$groupSql ORDER BY Sequence";
|
2008-07-14 21:54:50 +08:00
|
|
|
$monitors = array();
|
|
|
|
$monIdx = 0;
|
2016-07-14 23:55:27 +08:00
|
|
|
foreach( dbFetchAll( $sql ) as $row ) {
|
|
|
|
if ( !visibleMonitor( $row['Id'] ) )
|
|
|
|
continue;
|
|
|
|
if ( isset($_REQUEST['mid']) && $row['Id'] == $_REQUEST['mid'] )
|
|
|
|
$monIdx = count($monitors);
|
|
|
|
$row['ScaledWidth'] = reScale( $row['Width'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
|
|
|
$row['ScaledHeight'] = reScale( $row['Height'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE );
|
|
|
|
$monitors[] = new Monitor( $row );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$monitor = $monitors[$monIdx];
|
2016-07-14 23:57:06 +08:00
|
|
|
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
|
2016-07-14 23:55:27 +08:00
|
|
|
$montageWidth = $monitor->ScaledWidth();
|
|
|
|
$montageHeight = $monitor->ScaledHeight();
|
|
|
|
$widthScale = ($montageWidth*SCALE_BASE)/$monitor->Width();
|
|
|
|
$heightScale = ($montageHeight*SCALE_BASE)/$monitor->Height();
|
2008-07-14 21:54:50 +08:00
|
|
|
$scale = (int)(($widthScale<$heightScale)?$widthScale:$heightScale);
|
|
|
|
|
|
|
|
noCacheHeaders();
|
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2015-05-10 21:10:30 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('CycleWatch') );
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
|
|
|
<div id="headerButtons">
|
2008-09-26 17:47:20 +08:00
|
|
|
<?php if ( $mode == "stream" ) { ?>
|
2016-07-14 23:55:27 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&mode=still&group=<?php echo $group ?>&mid=<?php echo $monitor->Id() ?>"><?php echo translate('Stills') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } else { ?>
|
2016-07-14 23:55:27 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&mode=stream&group=<?php echo $group ?>&mid=<?php echo $monitor->Id() ?>"><?php echo translate('Stream') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } ?>
|
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>
|
2016-07-14 23:55:27 +08:00
|
|
|
<h2><?php echo translate('Cycle') ?> - <?php echo validHtmlStr($monitor->Name()) ?></h2>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<div id="imageFeed">
|
2016-07-14 23:55:27 +08:00
|
|
|
<?php echo getStreamHTML( $monitor, $scale, $mode ); ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|