2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web zones 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
|
|
|
//
|
|
|
|
|
2019-02-25 01:40:40 +08:00
|
|
|
if ( !canView('Monitors') ) {
|
2017-04-20 04:12:12 +08:00
|
|
|
$view = 'error';
|
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2008-09-26 17:47:20 +08:00
|
|
|
$mid = validInt($_REQUEST['mid']);
|
2019-02-25 01:40:40 +08:00
|
|
|
$monitor = new ZM\Monitor( $mid );
|
2017-04-20 04:12:12 +08:00
|
|
|
# Width() and Height() are already rotated
|
2017-10-04 22:48:37 +08:00
|
|
|
$minX = 0;
|
|
|
|
$maxX = $monitor->Width()-1;
|
|
|
|
$minY = 0;
|
|
|
|
$maxY = $monitor->Height()-1;
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$zones = array();
|
2017-04-20 04:12:12 +08:00
|
|
|
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;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2016-04-11 04:33:55 +08:00
|
|
|
$connkey = generateConnKey();
|
|
|
|
|
2015-05-10 21:10:30 +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>
|
2016-05-25 03:30:56 +08:00
|
|
|
<div id="content" style="width:<?php echo $monitor->Width() ?>px; height:<?php echo $monitor->Height() ?>px; position:relative; margin: 0 auto;">
|
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"/>
|
2014-12-05 07:44:23 +08:00
|
|
|
<input type="hidden" name="mid" value="<?php echo $mid ?>"/>
|
2017-03-02 04:26:40 +08:00
|
|
|
<div id="contentButtons">
|
2019-01-15 22:01:58 +08:00
|
|
|
<?php echo makePopupButton('?view=zone&mid=' . $mid . '&zid=0', 'zmZone', array('zone', $monitor->Width(), $monitor->Height()), translate('AddNewZone'), canEdit('Monitors')); ?>
|
2017-03-02 04:26:40 +08:00
|
|
|
<input type="submit" name="deleteBtn" value="<?php echo translate('Delete') ?>" disabled="disabled"/>
|
|
|
|
</div>
|
2008-07-14 21:54:50 +08:00
|
|
|
<table id="contentTable" class="major" cellspacing="0">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<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>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<?php
|
2017-10-04 22:48:37 +08:00
|
|
|
foreach( $zones as $zone ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2019-01-25 15:40:08 +08:00
|
|
|
<td class="colName"><?php echo makePopupLink('?view=zone&mid=' . $mid . '&zid=' . $zone['Id'], 'zmZone', array('zone', $monitor->Width(), $monitor->Height()), validHtmlStr($zone['Name']), true, 'onclick="streamCmdQuit( true ); return( false );"'); ?></td>
|
|
|
|
<td class="colType"><?php echo validHtmlStr($zone['Type']) ?></td>
|
2016-04-08 22:46:51 +08:00
|
|
|
<td class="colUnits"><?php echo $zone['Area'] ?> / <?php echo sprintf( "%.2f", ($zone['Area']*100)/($monitor->Width()*$monitor->Height()) ) ?></td>
|
2019-01-16 22:59:58 +08:00
|
|
|
<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>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2017-03-02 04:26:40 +08:00
|
|
|
<div class="ZonesImage" style="position:relative; clear:both;">
|
2017-10-04 22:48:37 +08:00
|
|
|
<?php echo getStreamHTML( $monitor ); ?>
|
|
|
|
<svg class="zones" width="<?php echo $monitor->Width() ?>" height="<?php echo $monitor->Height() ?>" style="position:absolute; top: 0; left: 0; background: none;">
|
2017-03-02 04:26:40 +08:00
|
|
|
<?php
|
|
|
|
foreach( array_reverse($zones) as $zone ) {
|
|
|
|
?>
|
2019-01-15 22:01:58 +08:00
|
|
|
<polygon points="<?php echo $zone['AreaCoords'] ?>" class="popup-link <?php echo $zone['Type']?>" onclick="streamCmdQuit( true ); return( false );"
|
|
|
|
data-url="?view=zone&mid=<?php echo $mid ?>&zid=<?php echo $zone['Id'] ?>"
|
|
|
|
data-window-name="zmZone"
|
|
|
|
data-window-tag="zone"
|
|
|
|
data-window-width="<?php echo $monitor->Width ?>"
|
|
|
|
data-window-height="<?php echo $monitor->Height ?>"/>
|
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>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|