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
|
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
|
|
|
//
|
|
|
|
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( !canView( 'Stream' ) ) {
|
2017-05-30 23:52:48 +08:00
|
|
|
$view = 'error';
|
2016-07-14 23:55:27 +08:00
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( empty($_REQUEST['mode']) ) {
|
|
|
|
if ( canStream() )
|
2017-05-30 23:52:48 +08:00
|
|
|
$mode = 'stream';
|
2016-07-14 23:55:27 +08:00
|
|
|
else
|
2017-05-30 23:52:48 +08:00
|
|
|
$mode = 'still';
|
2016-07-14 23:55:27 +08:00
|
|
|
} else {
|
|
|
|
$mode = validHtmlStr($_REQUEST['mode']);
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-10-01 02:19:32 +08:00
|
|
|
$group_id = 0;
|
|
|
|
if ( isset($_REQUEST['group']) ) {
|
|
|
|
$group_id = $_REQUEST['group'];
|
|
|
|
} else if ( isset($_COOKIE['zmGroup'] ) ) {
|
|
|
|
$group_id = $_COOKIE['zmGroup'];
|
|
|
|
}
|
|
|
|
|
|
|
|
$subgroup_id = 0;
|
|
|
|
if ( isset($_REQUEST['subgroup']) ) {
|
|
|
|
$subgroup_id = $_REQUEST['subgroup'];
|
|
|
|
} else if ( isset($_COOKIE['zmSubGroup'] ) ) {
|
|
|
|
$subgroup_id = $_COOKIE['zmSubGroup'];
|
|
|
|
}
|
|
|
|
$groupIds = null;
|
|
|
|
if ( $group_id ) {
|
|
|
|
$groupIds = array();
|
|
|
|
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($group_id) ) )
|
|
|
|
if ( $group['MonitorIds'] )
|
|
|
|
$groupIds = explode( ',', $group['MonitorIds'] );
|
|
|
|
if ( $subgroup_id ) {
|
|
|
|
if ( $group = dbFetchOne( 'SELECT MonitorIds FROM Groups WHERE Id = ?', NULL, array($subgroup_id) ) )
|
|
|
|
if ( $group['MonitorIds'] )
|
|
|
|
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
|
|
|
|
} else {
|
|
|
|
foreach ( dbFetchAll( 'SELECT MonitorIds FROM Groups WHERE ParentId = ?', NULL, array($group_id) ) as $group )
|
|
|
|
if ( $group['MonitorIds'] )
|
|
|
|
$groupIds = array_merge( $groupIds, explode( ',', $group['MonitorIds'] ) );
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-10-01 02:19:32 +08:00
|
|
|
$groupSql = '';
|
|
|
|
if ( $groupIds )
|
|
|
|
$groupSql = " and find_in_set( Id, '".implode( ',', $groupIds )."' )";
|
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
|
|
|
}
|
|
|
|
|
2017-10-01 02:19:32 +08:00
|
|
|
if ( $monitors ) {
|
|
|
|
$monitor = $monitors[$monIdx];
|
|
|
|
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
|
|
|
|
$montageWidth = $monitor->ScaledWidth();
|
|
|
|
$montageHeight = $monitor->ScaledHeight();
|
|
|
|
$widthScale = ($montageWidth*SCALE_BASE)/$monitor->Width();
|
|
|
|
$heightScale = ($montageHeight*SCALE_BASE)/$monitor->Height();
|
|
|
|
$scale = (int)(($widthScale<$heightScale)?$widthScale:$heightScale);
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
noCacheHeaders();
|
2015-05-10 21:10:30 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('CycleWatch') );
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
2017-10-01 02:19:32 +08:00
|
|
|
<?php echo $navbar = getNavBarHTML(); ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="header">
|
|
|
|
<div id="headerButtons">
|
2008-09-26 17:47:20 +08:00
|
|
|
<?php if ( $mode == "stream" ) { ?>
|
2017-10-01 02:19:32 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&mode=still&mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stills') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } else { ?>
|
2017-10-01 02:19:32 +08:00
|
|
|
<a href="?view=<?php echo $view ?>&mode=stream&mid=<?php echo $monitor ? $monitor->Id() : '' ?>"><?php echo translate('Stream') ?></a>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php } ?>
|
|
|
|
</div>
|
2017-10-01 02:19:32 +08:00
|
|
|
<div class="controlHeader">
|
|
|
|
<span id="groupControl"><label><?php echo translate('Group') ?>:</label>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$groups = array(0=>'All');
|
|
|
|
foreach ( Group::find_all( array('ParentId'=>null) ) as $Group ) {
|
|
|
|
$groups[$Group->Id()] = $Group->Name();
|
|
|
|
}
|
|
|
|
echo htmlSelect( 'group', $groups, $group_id, 'changeGroup(this);' );
|
|
|
|
$groups = array(0=>'All');
|
|
|
|
if ( $group_id ) {
|
|
|
|
foreach ( Group::find_all( array('ParentId'=>$group_id) ) as $Group ) {
|
|
|
|
$groups[$Group->Id()] = $Group->Name();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo htmlSelect( 'subgroup', $groups, $subgroup_id, 'changeSubGroup(this);' );
|
|
|
|
?>
|
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<div id="imageFeed">
|
2017-10-01 02:19:32 +08:00
|
|
|
<?php
|
|
|
|
if ( $monitor ) {
|
|
|
|
echo getStreamHTML( $monitor, array( 'scale'=>$scale, 'mode'=>$mode ) );
|
|
|
|
} else {
|
|
|
|
echo "There are no monitors to view.";
|
|
|
|
}
|
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-10-02 23:55:52 +08:00
|
|
|
<?php xhtmlFooter() ?>
|