*/ if (!userIsAllowed('Cemeteries')) { $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); header('Location: '.BASE_URL.'/cemeteries'); exit(); } if (isset($_POST['cemetery'])) { $cemetery = new Cemetery(); foreach ($_POST['cemetery'] as $field=>$value) { $set = 'set'.ucfirst($field); $cemetery->$set($value); } try { $cemetery->save(); header('Location: '.BASE_URL.'/cemeteries'); exit(); } catch(Exception $e) { $_SESSION['errorMessages'][] = $e; } } $template = new Template(); $template->blocks[] = new Block('cemeteries/addCemeteryForm.inc'); echo $template->render();