2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web event detail 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
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
|
|
|
if ( !canEdit( 'Events' ) )
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
$view = "error";
|
2008-07-14 21:54:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2013-12-18 01:53:15 +08:00
|
|
|
if ( isset($_REQUEST['eid']) ) {
|
2008-09-26 17:47:20 +08:00
|
|
|
$mode = 'single';
|
|
|
|
$eid = validInt($_REQUEST['eid']);
|
2014-03-22 05:16:56 +08:00
|
|
|
$newEvent = dbFetchOne( 'SELECT E.* FROM Events AS E WHERE E.Id = ?', NULL, array($eid) );
|
2013-12-18 01:53:15 +08:00
|
|
|
} elseif ( isset($_REQUEST['eids']) ) {
|
2008-09-26 17:47:20 +08:00
|
|
|
$mode = 'multi';
|
2013-12-18 01:53:15 +08:00
|
|
|
$sql = 'SELECT E.* FROM Events AS E WHERE ';
|
2008-07-14 21:54:50 +08:00
|
|
|
$sqlWhere = array();
|
2013-12-18 01:53:15 +08:00
|
|
|
$sqlValues = array();
|
|
|
|
foreach ( $_REQUEST['eids'] as $eid ) {
|
|
|
|
$sqlWhere[] = 'E.Id = ?';
|
|
|
|
$sqlValues[] = $eid;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2008-09-26 17:47:20 +08:00
|
|
|
unset( $eid );
|
2008-07-14 21:54:50 +08:00
|
|
|
$sql .= join( " or ", $sqlWhere );
|
2013-12-18 01:53:15 +08:00
|
|
|
foreach( dbFetchAll( $sql, NULL, $sqlValues ) as $row )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
if ( !isset($newEvent) )
|
|
|
|
{
|
|
|
|
$newEvent = $row;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( $newEvent['Cause'] && $newEvent['Cause'] != $row['Cause'] )
|
|
|
|
$newEvent['Cause'] = "";
|
|
|
|
if ( $newEvent['Notes'] && $newEvent['Notes'] != $row['Notes'] )
|
|
|
|
$newEvent['Notes'] = "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-09-26 17:47:20 +08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$mode = '';
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $mode == 'single' )
|
|
|
|
xhtmlHeaders(__FILE__, $SLANG['Event']." - ".$eid );
|
2008-07-14 21:54:50 +08:00
|
|
|
else
|
|
|
|
xhtmlHeaders(__FILE__, $SLANG['Events'] );
|
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
|
|
|
<?php
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $mode == 'single' )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
2008-09-26 17:47:20 +08:00
|
|
|
<h2><?= $SLANG['Event'] ?> <?= $eid ?></h2>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<h2><?= $SLANG['Events'] ?></h2>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<form name="contentForm" id="contentForm" method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
|
|
|
|
<input type="hidden" name="view" value="none"/>
|
|
|
|
<?php
|
2008-09-26 17:47:20 +08:00
|
|
|
if ( $mode == 'single' )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="view" value="<?= $view ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="eventdetail"/>
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="eid" value="<?= $eid ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
2008-09-26 17:47:20 +08:00
|
|
|
elseif ( $mode = 'multi' )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
?>
|
|
|
|
<input type="hidden" name="view" value="none"/>
|
|
|
|
<input type="hidden" name="action" value="eventdetail"/>
|
|
|
|
<?php
|
|
|
|
foreach ( $_REQUEST['eids'] as $eid )
|
|
|
|
{
|
|
|
|
?>
|
2008-09-26 17:47:20 +08:00
|
|
|
<input type="hidden" name="markEids[]" value="<?= validHtmlStr($eid) ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<table id="contentTable" class="major" cellspacing="0">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
2009-10-17 01:09:16 +08:00
|
|
|
<th scope="row"><?= $SLANG['Cause'] ?></th>
|
2008-09-26 17:47:20 +08:00
|
|
|
<td><input type="text" name="newEvent[Cause]" value="<?= validHtmlStr($newEvent['Cause']) ?>" size="32"/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2009-10-17 01:09:16 +08:00
|
|
|
<th scope="row"><?= $SLANG['Notes'] ?></th>
|
2008-09-26 17:47:20 +08:00
|
|
|
<td><textarea name="newEvent[Notes]" rows="6" cols="50"><?= validHtmlStr($newEvent['Notes']) ?></textarea></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
|
|
|
<input type="submit" value="<?= $SLANG['Save'] ?>"<?php if ( !canEdit( 'Events' ) ) { ?> disabled="disabled"<?php } ?>/><input type="button" value="<?= $SLANG['Cancel'] ?>" onclick="closeWindow()"/>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|