2009-12-18 12:56:12 +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 12:56:12 +00:00
|
|
|
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
2010-01-06 16:16:21 +00:00
|
|
|
* @param REQUEST return_url
|
2009-12-18 12:56:12 +00:00
|
|
|
*/
|
2009-12-18 17:40:05 +00:00
|
|
|
if (!userIsAllowed('Interments')) {
|
2009-12-18 12:56:12 +00:00
|
|
|
$_SESSION['errorMessages'][] = new Exception('noAccessAllowed');
|
2009-12-18 17:40:05 +00:00
|
|
|
header('Location: '.BASE_URL.'/interments');
|
2009-12-18 12:56:12 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2010-01-06 16:16:21 +00:00
|
|
|
$return_url = isset($_REQUEST['return_url']) ? $_REQUEST['return_url'] : BASE_URL.'/interments';
|
|
|
|
|
2009-12-18 17:40:05 +00:00
|
|
|
if (isset($_POST['interment'])) {
|
|
|
|
$interment = new Interment();
|
|
|
|
foreach ($_POST['interment'] as $field=>$value) {
|
2009-12-18 12:56:12 +00:00
|
|
|
$set = 'set'.ucfirst($field);
|
2009-12-18 17:40:05 +00:00
|
|
|
$interment->$set($value);
|
2009-12-18 12:56:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2009-12-18 17:40:05 +00:00
|
|
|
$interment->save();
|
2010-01-06 16:16:21 +00:00
|
|
|
header("Location: $return_url");
|
2009-12-18 12:56:12 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
catch(Exception $e) {
|
|
|
|
$_SESSION['errorMessages'][] = $e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = new Template();
|
2010-01-06 16:16:21 +00:00
|
|
|
$template->blocks[] = new Block('interments/addIntermentForm.inc',
|
|
|
|
array('return_url'=>$return_url));
|
2009-12-18 12:56:12 +00:00
|
|
|
echo $template->render();
|