2009-12-18 14:28:25 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright 2009 City of Bloomington, Indiana
|
2011-06-14 13:29:37 +00:00
|
|
|
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
|
2009-12-18 14:28:25 +00:00
|
|
|
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
|
|
|
*/
|
|
|
|
if (!userIsAllowed('Cemeteries')) {
|
|
|
|
$_SESSION['errorMessages'][] = new Exception('noAccessAllowed');
|
|
|
|
header('Location: '.BASE_URL.'/cemeteries');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$cemetery = new Cemetery($_REQUEST['cemetery_id']);
|
|
|
|
if (isset($_POST['cemetery'])) {
|
|
|
|
foreach ($_POST['cemetery'] as $field=>$value) {
|
|
|
|
$set = 'set'.ucfirst($field);
|
|
|
|
$cemetery->$set($value);
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
$cemetery->save();
|
2010-01-04 20:23:16 +00:00
|
|
|
if (isset($_FILES)) {
|
|
|
|
if (isset($_FILES['map']) && $_FILES['map']['tmp_name']) {
|
|
|
|
$cemetery->saveMap($_FILES['map'],'full');
|
|
|
|
}
|
|
|
|
if (isset($_FILES['thumbnail']) && $_FILES['thumbnail']['tmp_name']) {
|
|
|
|
$section->saveMap($_FILES['thumbnail'],'thumbnail');
|
|
|
|
}
|
|
|
|
}
|
2009-12-18 14:28:25 +00:00
|
|
|
header('Location: '.BASE_URL.'/cemeteries');
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
catch (Exception $e) {
|
|
|
|
$_SESSION['errorMessages'][] = $e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = new Template();
|
|
|
|
$template->blocks[] = new Block('cemeteries/updateCemeteryForm.inc',array('cemetery'=>$cemetery));
|
|
|
|
echo $template->render();
|