2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
2019-10-30 06:06:32 +08:00
|
|
|
// ZoneMinder web zones view file
|
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
|
|
|
//
|
|
|
|
|
2020-08-31 22:14:53 +08:00
|
|
|
$mids = null;
|
|
|
|
if ( isset($_REQUEST['mid']) ) {
|
|
|
|
$mids = array();
|
|
|
|
$mids[] = validInt($_REQUEST['mid']);
|
|
|
|
} else if ( isset($_REQUEST['mids']) ) {
|
|
|
|
$mids = $_REQUEST['mids'];
|
|
|
|
} else {
|
|
|
|
$mids = dbFetchAll('SELECT Id FROM Monitors'.($user['MonitorIds'] ? 'WHERE Id IN ('.$user['MonitorIds'].')' : ''), 'Id');
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2020-08-31 22:14:53 +08:00
|
|
|
if ( !($mids and count($mids)) ) {
|
|
|
|
$view = 'error';
|
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2020-08-31 22:14:53 +08:00
|
|
|
$monitors = ZM\ZM_Object::Objects_Indexed_By_Id('ZM\Monitor', array('Id'=>$mids));
|
2016-04-11 04:33:55 +08:00
|
|
|
|
2019-02-26 04:24:25 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('Zones'));
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
2019-01-16 22:59:58 +08:00
|
|
|
<div id="headerButtons"><a href="#" data-on-click="closeWindow"><?php echo translate('Close') ?></a></div>
|
2015-05-10 21:10:30 +08:00
|
|
|
<h2><?php echo translate('Zones') ?></h2>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2019-10-30 06:06:32 +08:00
|
|
|
<div id="content">
|
2019-02-10 13:39:19 +08:00
|
|
|
<form name="contentForm" id="contentForm" method="get" action="?">
|
2014-12-05 07:44:23 +08:00
|
|
|
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="delete"/>
|
2020-08-31 22:14:53 +08:00
|
|
|
<?php
|
|
|
|
foreach ( $mids as $mid ) {
|
|
|
|
$monitor = $monitors[$mid];
|
2020-09-03 05:36:01 +08:00
|
|
|
$monitor->connKey();
|
2020-08-31 22:14:53 +08:00
|
|
|
# ViewWidth() and ViewHeight() are already rotated
|
|
|
|
$minX = 0;
|
|
|
|
$maxX = $monitor->ViewWidth()-1;
|
|
|
|
$minY = 0;
|
|
|
|
$maxY = $monitor->ViewHeight()-1;
|
|
|
|
|
|
|
|
$zones = array();
|
|
|
|
foreach ( dbFetchAll('SELECT * FROM Zones WHERE MonitorId=? ORDER BY Area DESC', NULL, array($mid)) as $row ) {
|
|
|
|
$row['Points'] = coordsToPoints($row['Coords']);
|
|
|
|
|
|
|
|
limitPoints($row['Points'], $minX, $minY, $maxX, $maxY);
|
|
|
|
$row['Coords'] = pointsToCoords($row['Points']);
|
|
|
|
$row['AreaCoords'] = preg_replace('/\s+/', ',', $row['Coords']);
|
|
|
|
$zones[] = $row;
|
|
|
|
}
|
|
|
|
|
|
|
|
$options = array('width'=>'100%', 'height'=>'auto');
|
|
|
|
?>
|
|
|
|
<div class="Monitor">
|
|
|
|
<input type="hidden" name="mids[]" value="<?php echo $mid ?>"/>
|
2020-07-14 02:51:07 +08:00
|
|
|
<div class="ZonesImage">
|
2020-08-31 22:14:53 +08:00
|
|
|
<?php echo getStreamHTML($monitor, $options); ?>
|
2020-09-03 05:36:01 +08:00
|
|
|
<svg class="zones" viewBox="0 0 <?php echo $monitor->ViewWidth().' '.$monitor->ViewHeight() ?>">
|
2017-03-02 04:26:40 +08:00
|
|
|
<?php
|
|
|
|
foreach( array_reverse($zones) as $zone ) {
|
|
|
|
?>
|
2020-08-31 22:14:53 +08:00
|
|
|
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="popup-link <?php echo $zone['Type']?>" data-on-click-true="streamCmdQuit"
|
2019-01-15 22:01:58 +08:00
|
|
|
data-url="?view=zone&mid=<?php echo $mid ?>&zid=<?php echo $zone['Id'] ?>"
|
2019-10-30 06:06:32 +08:00
|
|
|
data-window-name="zmZone<?php echo $zone['Id'] ?>"
|
2019-01-15 22:01:58 +08:00
|
|
|
data-window-tag="zone"
|
2019-10-30 06:06:32 +08:00
|
|
|
data-window-width="<?php echo $monitor->ViewWidth() ?>"
|
|
|
|
data-window-height="<?php echo $monitor->ViewHeight() ?>"
|
|
|
|
/>
|
2017-03-02 04:26:40 +08:00
|
|
|
<?php
|
|
|
|
} // end foreach zone
|
|
|
|
?>
|
|
|
|
Sorry, your browser does not support inline SVG
|
|
|
|
</svg>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
2020-08-31 22:14:53 +08:00
|
|
|
<div class="zones">
|
2019-10-30 06:06:32 +08:00
|
|
|
<table id="zonesTable" class="major">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="colName"><?php echo translate('Name') ?></th>
|
|
|
|
<th class="colType"><?php echo translate('Type') ?></th>
|
|
|
|
<th class="colUnits"><?php echo translate('AreaUnits') ?></th>
|
|
|
|
<th class="colMark"><?php echo translate('Mark') ?></th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
foreach( $zones as $zone ) {
|
|
|
|
?>
|
|
|
|
<tr>
|
2020-07-14 02:51:07 +08:00
|
|
|
<td class="colName"><?php echo makePopupLink('?view=zone&mid='.$mid.'&zid='.$zone['Id'], 'zmZone', array('zone', $monitor->ViewWidth(), $monitor->ViewHeight()), validHtmlStr($zone['Name']), true, 'data-on-click-true="streamCmdQuit"'); ?></td>
|
2019-10-30 06:06:32 +08:00
|
|
|
<td class="colType"><?php echo validHtmlStr($zone['Type']) ?></td>
|
|
|
|
<td class="colUnits"><?php echo $zone['Area'] ?> / <?php echo sprintf('%.2f', ($zone['Area']*100)/($monitor->ViewWidth()*$monitor->ViewHeight()) ) ?></td>
|
|
|
|
<td class="colMark"><input type="checkbox" name="markZids[]" value="<?php echo $zone['Id'] ?>" data-on-click-this="configureDeleteButton"<?php if ( !canEdit('Monitors') ) { ?> disabled="disabled"<?php } ?>/></td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
|
|
|
<?php echo makePopupButton('?view=zone&mid='.$mid.'&zid=0', 'zmZone', array('zone', $monitor->ViewWidth(), $monitor->ViewHeight()), translate('AddNewZone'), canEdit('Monitors')); ?>
|
2020-07-14 02:51:07 +08:00
|
|
|
<button type="submit" name="deleteBtn" value="Delete" disabled="disabled"><?php echo translate('Delete') ?></button>
|
2019-10-30 06:06:32 +08:00
|
|
|
</div>
|
|
|
|
</div><!--zones-->
|
2020-08-31 22:14:53 +08:00
|
|
|
<br class="clear"/>
|
|
|
|
</div><!--Monitor-->
|
|
|
|
<?php
|
|
|
|
} # end foreach monitor
|
|
|
|
?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-03 05:36:01 +08:00
|
|
|
<script src="<?php echo cache_bust('js/MonitorStream.js') ?>"></script>
|
2020-09-03 02:47:00 +08:00
|
|
|
<?php xhtmlFooter() ?>
|