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
|
|
|
//
|
|
|
|
|
2018-07-10 00:50:57 +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
|
|
|
}
|
|
|
|
|
2019-03-05 02:35:40 +08:00
|
|
|
ob_start();
|
|
|
|
include('_monitor_filters.php');
|
|
|
|
$filterbar = ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
$options = array();
|
|
|
|
|
2016-07-14 23:55:27 +08:00
|
|
|
if ( empty($_REQUEST['mode']) ) {
|
|
|
|
if ( canStream() )
|
2019-03-05 02:35:40 +08:00
|
|
|
$options['mode'] = 'stream';
|
2016-07-14 23:55:27 +08:00
|
|
|
else
|
2019-03-05 02:35:40 +08:00
|
|
|
$options['mode'] = 'still';
|
2016-07-14 23:55:27 +08:00
|
|
|
} else {
|
2019-03-05 02:35:40 +08:00
|
|
|
$options['mode'] = validHtmlStr($_REQUEST['mode']);
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2019-03-05 02:35:40 +08:00
|
|
|
|
|
|
|
$widths = array(
|
2020-02-26 00:14:12 +08:00
|
|
|
'auto' => translate('auto'),
|
2019-03-05 02:35:40 +08:00
|
|
|
'100%' => '100%',
|
|
|
|
'160px' => '160px',
|
|
|
|
'320px' => '320px',
|
|
|
|
'352px' => '352px',
|
|
|
|
'640px' => '640px',
|
|
|
|
'1280px' => '1280px',
|
|
|
|
'1920px' => '1920px'
|
|
|
|
);
|
|
|
|
|
|
|
|
$heights = array(
|
|
|
|
'auto' => translate('auto'),
|
|
|
|
'240px' => '240px',
|
|
|
|
'480px' => '480px',
|
|
|
|
'720px' => '720px',
|
|
|
|
'1080px' => '1080px',
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2020-07-04 21:04:26 +08:00
|
|
|
$monIdx = 0;
|
|
|
|
$monitors = array();
|
|
|
|
$monitor = NULL;
|
2017-12-05 04:52:16 +08:00
|
|
|
foreach( $displayMonitors as &$row ) {
|
2020-07-04 21:04:26 +08:00
|
|
|
if ( $row['Function'] == 'None' )
|
|
|
|
continue;
|
|
|
|
if ( isset($_REQUEST['mid']) && ($row['Id'] == $_REQUEST['mid']) )
|
|
|
|
$monIdx = count($monitors);
|
|
|
|
|
2018-07-10 00:33:21 +08:00
|
|
|
$row['ScaledWidth'] = reScale($row['Width'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
|
|
|
|
$row['ScaledHeight'] = reScale($row['Height'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
|
|
|
|
$row['PopupScale'] = reScale(SCALE_BASE, $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE);
|
2019-03-05 02:35:40 +08:00
|
|
|
if ( !isset($widths[$row['Width'].'px']) ) {
|
2020-07-04 21:04:26 +08:00
|
|
|
$widths[$row['Width'].'px'] = $row['Width'].'px';
|
|
|
|
}
|
|
|
|
if ( ! isset($heights[$row['Height'].'px']) ) {
|
|
|
|
$heights[$row['Height'].'px'] = $row['Height'].'px';
|
|
|
|
}
|
|
|
|
|
|
|
|
$monitors[] = new ZM\Monitor($row);
|
|
|
|
unset($row);
|
|
|
|
} # end foreach Monitor
|
|
|
|
|
|
|
|
if ( $monitors ) {
|
|
|
|
$monitor = $monitors[$monIdx];
|
|
|
|
$nextMid = $monIdx==(count($monitors)-1)?$monitors[0]->Id():$monitors[$monIdx+1]->Id();
|
|
|
|
}
|
2020-07-04 07:17:11 +08:00
|
|
|
if ( !$monitor ) {
|
|
|
|
ZM\Error('There was no monitor to display.');
|
|
|
|
}
|
2020-07-04 21:04:26 +08:00
|
|
|
$options['connkey'] = generateConnKey();
|
|
|
|
|
2020-07-04 07:17:11 +08:00
|
|
|
session_start();
|
|
|
|
|
2019-03-05 02:35:40 +08:00
|
|
|
if ( isset($_REQUEST['scale']) ) {
|
|
|
|
$options['scale'] = validInt($_REQUEST['scale']);
|
|
|
|
} else if ( isset($_COOKIE['zmCycleScale']) ) {
|
|
|
|
$options['scale'] = $_COOKIE['zmCycleScale'];
|
2020-07-04 21:04:26 +08:00
|
|
|
} else if ( $monitor ) {
|
|
|
|
$options['scale'] = $monitor->DefaultScale();
|
2019-03-05 02:35:40 +08:00
|
|
|
}
|
|
|
|
|
2020-02-26 00:14:12 +08:00
|
|
|
if ( !isset($options['scale']) )
|
2019-03-05 02:35:40 +08:00
|
|
|
$options['scale'] = 100;
|
|
|
|
|
|
|
|
if ( isset($_COOKIE['zmCycleWidth']) and $_COOKIE['zmCycleWidth'] ) {
|
|
|
|
$_SESSION['zmCycleWidth'] = $options['width'] = $_COOKIE['zmCycleWidth'];
|
|
|
|
#} elseif ( isset($_SESSION['zmCycleWidth']) and $_SESSION['zmCycleWidth'] ) {
|
|
|
|
#$options['width'] = $_SESSION['zmCycleWidth'];
|
2020-07-04 07:17:11 +08:00
|
|
|
} else {
|
2019-03-05 02:35:40 +08:00
|
|
|
$options['width'] = '';
|
2020-07-04 07:17:11 +08:00
|
|
|
}
|
2019-03-05 02:35:40 +08:00
|
|
|
|
2020-07-04 07:17:11 +08:00
|
|
|
if ( isset($_COOKIE['zmCycleHeight']) and $_COOKIE['zmCycleHeight'] ) {
|
2019-03-05 02:35:40 +08:00
|
|
|
$_SESSION['zmCycleHeight'] = $options['height'] = $_COOKIE['zmCycleHeight'];
|
|
|
|
#else if ( isset($_SESSION['zmCycleHeight']) and $_SESSION['zmCycleHeight'] )
|
|
|
|
#$options['height'] = $_SESSION['zmCycleHeight'];
|
2020-07-04 07:17:11 +08:00
|
|
|
} else {
|
2019-03-05 02:35:40 +08:00
|
|
|
$options['height'] = '';
|
2020-07-04 07:17:11 +08:00
|
|
|
}
|
|
|
|
|
2019-03-05 02:35:40 +08:00
|
|
|
session_write_close();
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2019-03-05 02:35:40 +08:00
|
|
|
ZM\Logger::Debug(print_r($options,true));
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
noCacheHeaders();
|
2018-07-10 00:33:21 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('CycleWatch'));
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
2018-07-10 00:33:21 +08:00
|
|
|
<?php echo $navbar = getNavBarHTML(); ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="header">
|
|
|
|
<div id="headerButtons">
|
2019-03-05 02:35:40 +08:00
|
|
|
<?php if ( $options['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">
|
2018-07-10 00:50:57 +08:00
|
|
|
<form method="get">
|
|
|
|
<input type="hidden" name="view" value="cycle"/>
|
|
|
|
<?php echo $filterbar ?>
|
|
|
|
</form>
|
2017-10-01 02:19:32 +08:00
|
|
|
</div>
|
2019-03-05 02:35:40 +08:00
|
|
|
<div id="sizeControl">
|
|
|
|
<span id="widthControl">
|
|
|
|
<label><?php echo translate('Width') ?>:</label>
|
|
|
|
<?php echo htmlSelect('width', $widths, $options['width'], array('data-on-change-this'=>'changeSize') ); ?>
|
|
|
|
</span>
|
|
|
|
<span id="heightControl">
|
|
|
|
<label><?php echo translate('Height') ?>:</label>
|
|
|
|
<?php echo htmlSelect('height', $heights, $options['height'], array('data-on-change-this'=>'changeSize') ); ?>
|
|
|
|
</span>
|
|
|
|
<span id="scaleControl">
|
|
|
|
<label><?php echo translate('Scale') ?>:</label>
|
|
|
|
<?php echo htmlSelect('scale', $scales, $options['scale'], array('data-on-change-this'=>'changeScale') ); ?>
|
|
|
|
</span>
|
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2020-07-04 21:04:26 +08:00
|
|
|
<div class="container-fluid">
|
|
|
|
<div class="row" id="content">
|
|
|
|
<div class="col-sm-2 sidebar">
|
|
|
|
<ul class="nav nav-pills nav-stacked">
|
|
|
|
<?php
|
|
|
|
foreach ( $monitors as $m ) {
|
|
|
|
echo '<li'.( $m->Id() == $monitor->Id() ? ' class="active"' : '' ).'><a href="?view=cycle&mid='.$m->Id().'">'.$m->Name().'</a></li>';
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div class="col-sm-10 col-sm-offset-2">
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="imageFeed">
|
2017-10-01 02:19:32 +08:00
|
|
|
<?php
|
|
|
|
if ( $monitor ) {
|
2019-03-05 02:35:40 +08:00
|
|
|
echo getStreamHTML($monitor, $options);
|
2017-10-01 02:19:32 +08:00
|
|
|
} else {
|
2019-03-05 02:35:40 +08:00
|
|
|
echo 'There are no monitors to view.';
|
2017-10-01 02:19:32 +08:00
|
|
|
}
|
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2019-03-05 02:35:40 +08:00
|
|
|
|
|
|
|
<div class="buttons">
|
|
|
|
<button type="button" value="<" id="prevBtn" title="<?php echo translate('PreviousMonitor') ?>" class="active" data-on-click-true="cyclePrev"><<</button>
|
|
|
|
<button type="button" value="||" id="pauseBtn" title="<?php echo translate('PauseCycle') ?>" class="active" data-on-click-true="cyclePause">||</button>
|
2020-02-26 02:17:45 +08:00
|
|
|
<button type="button" value="|>" id="playBtn" title="<?php echo translate('PlayCycle') ?>" class="inactive" disabled="disabled" data-on-click-true="cycleStart">|></button>
|
2019-03-05 02:35:40 +08:00
|
|
|
<button type="button" value=">" id="nextBtn" title="<?php echo translate('NextMonitor') ?>" class="active" data-on-click-true="cycleNext">>></button>
|
|
|
|
</div>
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2020-07-04 21:04:26 +08:00
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2017-10-02 23:55:52 +08:00
|
|
|
<?php xhtmlFooter() ?>
|