2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
2008-07-16 21:15:28 +08:00
|
|
|
// ZoneMinder web control function library, $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-05-16 23:14:11 +08:00
|
|
|
function getControlCommands( $monitor ) {
|
|
|
|
$cmds = array();
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['Wake'] = 'wake';
|
|
|
|
$cmds['Sleep'] = 'sleep';
|
|
|
|
$cmds['Reset'] = 'reset';
|
2019-03-19 02:49:05 +08:00
|
|
|
$cmds['Reboot'] = 'reboot';
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['PresetSet'] = 'presetSet';
|
|
|
|
$cmds['PresetGoto'] = 'presetGoto';
|
|
|
|
$cmds['PresetHome'] = 'presetHome';
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanZoom() ) {
|
|
|
|
if ( $monitor->CanZoomCon() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['ZoomRoot'] = 'zoomCon';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanZoomRel() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['ZoomRoot'] = 'zoomRel';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanZoomAbs() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['ZoomRoot'] = 'zoomAbs';
|
|
|
|
$cmds['ZoomTele'] = $cmds['ZoomRoot'].'Tele';
|
|
|
|
$cmds['ZoomWide'] = $cmds['ZoomRoot'].'Wide';
|
|
|
|
$cmds['ZoomStop'] = 'zoomStop';
|
|
|
|
$cmds['ZoomAuto'] = 'zoomAuto';
|
|
|
|
$cmds['ZoomMan'] = 'zoomMan';
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanFocus() ) {
|
|
|
|
if ( $monitor->CanFocusCon() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['FocusRoot'] = 'focusCon';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanFocusRel() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['FocusRoot'] = 'focusRel';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanFocusAbs() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['FocusRoot'] = 'focusAbs';
|
|
|
|
$cmds['FocusFar'] = $cmds['FocusRoot'].'Far';
|
|
|
|
$cmds['FocusNear'] = $cmds['FocusRoot'].'Near';
|
|
|
|
$cmds['FocusStop'] = 'focusStop';
|
|
|
|
$cmds['FocusAuto'] = 'focusAuto';
|
|
|
|
$cmds['FocusMan'] = 'focusMan';
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanIris() ) {
|
|
|
|
if ( $monitor->CanIrisCon() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['IrisRoot'] = 'irisCon';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanIrisRel() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['IrisRoot'] = 'irisRel';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanIrisAbs() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['IrisRoot'] = 'irisAbs';
|
|
|
|
$cmds['IrisOpen'] = $cmds['IrisRoot'].'Open';
|
|
|
|
$cmds['IrisClose'] = $cmds['IrisRoot'].'Close';
|
|
|
|
$cmds['IrisStop'] = 'irisStop';
|
|
|
|
$cmds['IrisAuto'] = 'irisAuto';
|
|
|
|
$cmds['IrisMan'] = 'irisMan';
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanWhite() ) {
|
|
|
|
if ( $monitor->CanWhiteCon() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['WhiteRoot'] = 'whiteCon';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanWhiteRel() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['WhiteRoot'] = 'whiteRel';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanWhiteAbs() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['WhiteRoot'] = 'whiteAbs';
|
|
|
|
$cmds['WhiteIn'] = $cmds['WhiteRoot'].'In';
|
|
|
|
$cmds['WhiteOut'] = $cmds['WhiteRoot'].'Out';
|
|
|
|
$cmds['WhiteAuto'] = 'whiteAuto';
|
|
|
|
$cmds['WhiteMan'] = 'whiteMan';
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanGain() ) {
|
|
|
|
if ( $monitor->CanGainCon() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['GainRoot'] = 'gainCon';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanGainRel() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['GainRoot'] = 'gainRel';
|
2018-05-16 23:14:11 +08:00
|
|
|
elseif ( $monitor->CanGainAbs() )
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['GainRoot'] = 'gainAbs';
|
|
|
|
$cmds['GainUp'] = $cmds['GainRoot'].'Up';
|
|
|
|
$cmds['GainDown'] = $cmds['GainRoot'].'Down';
|
|
|
|
$cmds['GainAuto'] = 'gainAuto';
|
|
|
|
$cmds['GainMan'] = 'gainMan';
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanMove() ) {
|
|
|
|
if ( $monitor->CanMoveCon() ) {
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['MoveRoot'] = 'moveCon';
|
|
|
|
$cmds['Center'] = 'moveStop';
|
2018-05-16 23:14:11 +08:00
|
|
|
} elseif ( $monitor->CanMoveRel() ) {
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['MoveRoot'] = 'moveRel';
|
2018-05-16 23:14:11 +08:00
|
|
|
$cmds['Center'] = $cmds['PresetHome'];
|
|
|
|
} elseif ( $monitor->CanMoveAbs() ) {
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['MoveRoot'] = 'moveAbs';
|
2018-05-16 23:14:11 +08:00
|
|
|
$cmds['Center'] = $cmds['PresetHome'];
|
|
|
|
} else {
|
|
|
|
$cmds['MoveRoot'] = '';
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2018-05-16 23:14:11 +08:00
|
|
|
|
2019-02-22 22:23:06 +08:00
|
|
|
$cmds['MoveUp'] = $cmds['MoveRoot'].'Up';
|
|
|
|
$cmds['MoveDown'] = $cmds['MoveRoot'].'Down';
|
|
|
|
$cmds['MoveLeft'] = $cmds['MoveRoot'].'Left';
|
|
|
|
$cmds['MoveRight'] = $cmds['MoveRoot'].'Right';
|
|
|
|
$cmds['MoveUpLeft'] = $cmds['MoveRoot'].'UpLeft';
|
|
|
|
$cmds['MoveUpRight'] = $cmds['MoveRoot'].'UpRight';
|
|
|
|
$cmds['MoveDownLeft'] = $cmds['MoveRoot'].'DownLeft';
|
|
|
|
$cmds['MoveDownRight'] = $cmds['MoveRoot'].'DownRight';
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
|
|
|
return( $cmds );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlFocus( $monitor, $cmds ) {
|
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="arrowControl focusControls">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Near') ?></div>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="longArrowBtn upBtn" onclick="controlCmd('<?php echo $cmds['FocusNear'] ?>',event,0,-1)"></button>
|
|
|
|
<button type="button" class="arrowCenter"<?php if ( $monitor->CanFocusCon() ) { ?> onclick="controlCmd('<?php echo $cmds['FocusStop'] ?>')"<?php } ?>><?php echo translate('Focus') ?></button>
|
|
|
|
<button type="button" class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['FocusFar'] ?>',event,0,1)"></button>
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Far') ?></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanAutoFocus() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="<?php echo $cmds['FocusAuto'] ?>" onclick="controlCmd('<?php echo $cmds['FocusAuto'] ?>')"><?php echo translate('Auto') ?></button>
|
|
|
|
<button type="button" class="ptzTextBtn" value="<?php echo $cmds['FocusMan'] ?>" onclick="controlCmd('<?php echo $cmds['FocusMan'] ?>')"><?php echo translate('Man') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlZoom( $monitor, $cmds ) {
|
|
|
|
global $SLANG;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="arrowControl zoomControls">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Tele') ?></div>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="longArrowBtn upBtn" onclick="controlCmd('<?php echo $cmds['ZoomTele'] ?>',event,0,-1)"></button>
|
|
|
|
<button type="button" class="arrowCenter"<?php if ( $monitor->CanZoomCon() ) { ?> onclick="controlCmd('<?php echo $cmds['ZoomStop'] ?>')"<?php } ?>><?php echo translate('Zoom') ?></button>
|
|
|
|
<button type="button" class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['ZoomWide'] ?>',event,0,1)"></button>
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Wide') ?></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanAutoZoom() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Auto" onclick="controlCmd('<?php echo $cmds['ZoomAuto'] ?>')"><?php echo translate('Auto') ?></button>
|
|
|
|
<button type="button" class="ptzTextBtn" value="Man" onclick="controlCmd('<?php echo $cmds['ZoomMan'] ?>')"><?php echo translate('Man') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div><?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlIris( $monitor, $cmds ) {
|
|
|
|
global $SLANG;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="arrowControl irisControls">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Open') ?></div>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="longArrowBtn upBtn" onclick="controlCmd('<?php echo $cmds['IrisOpen'] ?>',event,0,-1)"></button>
|
|
|
|
<button type="button" class="arrowCenter"<?php if ( $monitor->CanIrisCon() ) { ?> onclick="controlCmd('<?php echo $cmds['IrisStop'] ?>')"<?php } ?>><?php echo translate('Iris') ?></button>
|
|
|
|
<button type="button" class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['IrisClose'] ?>',event,0,1)"></button>
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Close') ?></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanAutoIris() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Auto" onclick="controlCmd('<?php echo $cmds['IrisAuto'] ?>')"><?php echo translate('Auto') ?></button>
|
|
|
|
<button type="button" class="ptzTextBtn" value="Man" onclick="controlCmd('<?php echo $cmds['IrisMan'] ?>')"><?php echo translate('Man') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlWhite( $monitor, $cmds ) {
|
|
|
|
global $SLANG;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="arrowControl whiteControls">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('In') ?></div>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="longArrowBtn upBtn" onclick="controlCmd('<?php echo $cmds['WhiteIn'] ?>',event,0,-1)"></button>
|
|
|
|
<button type="button" class="arrowCenter"<?php if ( $monitor->CanWhiteCon() ) { ?> onclick="controlCmd('<?php echo $cmds['WhiteStop'] ?>')"<?php } ?>><?php echo translate('White') ?></button>
|
|
|
|
<button type="button" class="longArrowBtn downBtn" onclick="controlCmd('<?php echo $cmds['WhiteOut'] ?>',event,0,1)"></button>
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="arrowLabel"><?php echo translate('Out') ?></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanAutoWhite() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Auto" onclick="controlCmd('<?php echo $cmds['WhiteAuto'] ?>')"><?php echo translate('Auto') ?></button>
|
|
|
|
<button type="button" class="ptzTextBtn" value="Man" onclick="controlCmd('<?php echo $cmds['WhiteMan'] ?>')"><?php echo translate('Man') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlPanTilt( $monitor, $cmds ) {
|
|
|
|
global $SLANG;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="pantiltControls">
|
2016-04-04 23:38:16 +08:00
|
|
|
<div class="pantiltLabel"><?php echo translate('PanTilt') ?></div>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="pantiltButtons">
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
$hasPan = $monitor->CanPan();
|
|
|
|
$hasTilt = $monitor->CanTilt();
|
|
|
|
$hasDiag = $hasPan && $hasTilt && $monitor->CanMoveDiag();
|
2008-07-16 21:15:28 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="arrowBtn upLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpLeft'] ?>',event,-1,-1)"></button>
|
|
|
|
<button type="button" class="arrowBtn upBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUp'] ?>',event,0,-1)"></button>
|
|
|
|
<button type="button" class="arrowBtn upRightBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveUpRight'] ?>',event,1,-1)"></button>
|
|
|
|
<button type="button" class="arrowBtn leftBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveLeft'] ?>',event,1,0)"></button>
|
2016-05-07 00:51:03 +08:00
|
|
|
<?php if ( isset($cmds['Center']) ) { ?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="arrowBtn centerBtn" onclick="controlCmd('<?php echo $cmds['Center'] ?>')"></button>
|
2016-05-07 00:51:03 +08:00
|
|
|
<?php } else { ?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="arrowBtn NocenterBtn"></button>
|
2016-05-07 00:51:03 +08:00
|
|
|
<?php } ?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="arrowBtn rightBtn<?php echo $hasPan?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveRight'] ?>',event,1,0)"></button>
|
|
|
|
<button type="button" class="arrowBtn downLeftBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDownLeft'] ?>',event,-1,1)"></button>
|
|
|
|
<button type="button" class="arrowBtn downBtn<?php echo $hasTilt?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDown'] ?>',event,0,1)"></button>
|
|
|
|
<button type="button" class="arrowBtn downRightBtn<?php echo $hasDiag?'':' invisible' ?>" onclick="controlCmd('<?php echo $cmds['MoveDownRight'] ?>',event,1,1)"></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlPresets( $monitor, $cmds ) {
|
|
|
|
global $SLANG;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
// MAX_PRESETS IS PER LINE
|
2019-03-02 02:37:34 +08:00
|
|
|
define( 'MAX_PRESETS', '12' );
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
$sql = 'SELECT * FROM ControlPresets WHERE MonitorId = ?';
|
|
|
|
$labels = array();
|
|
|
|
foreach( dbFetchAll( $sql, NULL, array( $monitor->Id() ) ) as $row ) {
|
|
|
|
$labels[$row['Preset']] = $row['Label'];
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
$presetBreak = (int)(($monitor->NumPresets()+1)/((int)(($monitor->NumPresets()-1)/MAX_PRESETS)+1));
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="presetControls">
|
2015-05-10 21:10:30 +08:00
|
|
|
<!--<div><?php echo translate('Presets') ?></div>-->
|
2008-07-14 21:54:50 +08:00
|
|
|
<div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
for ( $i = 1; $i <= $monitor->NumPresets(); $i++ ) {
|
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzNumBtn" title="<?php echo isset($labels[$i])?htmlentities($labels[$i]):'' ?>" value="<?php echo $i ?>" onclick="controlCmd('<?php echo $cmds['PresetGoto'] ?><?php echo $i ?>');"/><?php echo $i ?></button>
|
2018-05-16 23:14:11 +08:00
|
|
|
<?php
|
|
|
|
if ( $i && (($i%$presetBreak) == 0) ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?><br/><?php
|
|
|
|
}
|
2018-05-16 23:14:11 +08:00
|
|
|
} // end foreach preset
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->HasHomePreset() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-03-02 02:37:34 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Home" onclick="controlCmd('<?php echo $cmds['PresetHome'] ?>');"><?php echo translate('Home') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
|
|
|
if ( canEdit('Monitors') && $monitor->CanSetPresets() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-03-02 02:37:34 +08:00
|
|
|
<button type="button" class="ptzTextBtn popup-link" value="Set" data-url="?view=controlpreset&mid=<?php echo $monitor->Id() ?>" data-window-name="zmPreset" data-window-tag="preset"><?php echo translate('Set') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function controlPower( $monitor, $cmds ) {
|
|
|
|
global $SLANG;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
ob_start();
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2008-07-16 21:15:28 +08:00
|
|
|
<div class="powerControls">
|
2015-05-10 21:10:30 +08:00
|
|
|
<div class="powerLabel"><?php echo translate('Control') ?></div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanWake() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Wake" onclick="controlCmd('<?php echo $cmds['Wake'] ?>')"><?php echo translate('Wake') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
|
|
|
if ( $monitor->CanSleep() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Sleep" onclick="controlCmd('<?php echo $cmds['Sleep'] ?>')"><?php echo translate('Sleep') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
|
|
|
if ( $monitor->CanReset() ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-02-22 22:23:06 +08:00
|
|
|
<button type="button" class="ptzTextBtn" value="Reset" onclick="controlCmd('<?php echo $cmds['Reset'] ?>')"><?php echo translate('Reset') ?></button>
|
2019-03-19 02:49:05 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
if ( $monitor->CanReboot() ) {
|
|
|
|
?>
|
|
|
|
<button type="button" class="ptzTextBtn" value="Reboot" onclick="controlCmd('<?php echo $cmds['Reboot'] ?>')"><?php echo translate('Reboot') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2018-05-16 23:14:11 +08:00
|
|
|
function ptzControls( $monitor ) {
|
|
|
|
$cmds = getControlCommands($monitor);
|
|
|
|
ob_start();
|
2008-07-16 21:15:28 +08:00
|
|
|
?>
|
2018-05-16 23:14:11 +08:00
|
|
|
<div class="controlsPanel">
|
2008-07-16 21:15:28 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
if ( $monitor->CanFocus() )
|
|
|
|
echo controlFocus($monitor, $cmds);
|
|
|
|
if ( $monitor->CanZoom() )
|
|
|
|
echo controlZoom($monitor, $cmds);
|
|
|
|
if ( $monitor->CanIris() )
|
|
|
|
echo controlIris($monitor, $cmds);
|
|
|
|
if ( $monitor->CanWhite() )
|
|
|
|
echo controlWhite($monitor, $cmds);
|
|
|
|
if ( $monitor->CanMove() ) {
|
2008-07-16 21:15:28 +08:00
|
|
|
?>
|
2018-05-16 23:14:11 +08:00
|
|
|
<div class="pantiltPanel">
|
|
|
|
<?php echo controlPanTilt($monitor, $cmds); ?>
|
|
|
|
</div>
|
2008-07-16 21:15:28 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
}
|
|
|
|
if ( $monitor->CanWake() || $monitor->CanSleep() || $monitor->CanReset() )
|
|
|
|
echo controlPower($monitor, $cmds);
|
|
|
|
if ( $monitor->HasPresets() )
|
|
|
|
echo controlPresets($monitor, $cmds);
|
2008-07-16 21:15:28 +08:00
|
|
|
?>
|
2018-05-16 23:14:11 +08:00
|
|
|
</div>
|
2008-07-16 21:15:28 +08:00
|
|
|
<?php
|
2018-05-16 23:14:11 +08:00
|
|
|
return ob_get_clean();
|
2008-07-16 21:15:28 +08:00
|
|
|
}
|
|
|
|
?>
|