2009-12-18 12:56:12 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @copyright 2009 City of Bloomington, Indiana
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
|
|
|
|
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
|
|
|
*/
|
2009-12-18 16:54:06 +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();
|
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
header('Location: '.BASE_URL.'/interments');
|
2009-12-18 12:56:12 +00:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
catch(Exception $e) {
|
|
|
|
$_SESSION['errorMessages'][] = $e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = new Template();
|
2009-12-18 17:40:05 +00:00
|
|
|
$template->blocks[] = new Block('interments/addIntermentForm.inc');
|
2009-12-18 12:56:12 +00:00
|
|
|
echo $template->render();
|