diff --git a/blocks/html/interments/intermentList.inc b/blocks/html/interments/intermentList.inc index 900369d..372009f 100644 --- a/blocks/html/interments/intermentList.inc +++ b/blocks/html/interments/intermentList.inc @@ -62,6 +62,14 @@ $return_url = $url->__toString(); Edit "; + $url = new URL(BASE_URL.'/interments/deleteInterment.php'); + $url->interment_id = $interment->getId(); + $url->return_url = "http://$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI]"; + $deleteButton = " + + "; } $last = View::escape($interment->getLastname()); $middle = View::escape($interment->getMiddleInitial()); @@ -79,7 +87,7 @@ $return_url = $url->__toString(); $section_lot = View::escape(implode(', ',$section_lot)); echo " - $editButton + $editButton $deleteButton getURL()}\">$last $middle $first diff --git a/classes/Interment.php b/classes/Interment.php index fd4e1d2..2b433c3 100644 --- a/classes/Interment.php +++ b/classes/Interment.php @@ -126,6 +126,14 @@ class Interment $this->id = $zend_db->lastInsertId('interments','id'); } + public function delete() + { + if ($this->id) { + $zend_db = Database::getConnection(); + $zend_db->delete('interments','id='.$this->id); + } + } + //---------------------------------------------------------------- // Generic Getters //---------------------------------------------------------------- diff --git a/html/interments/deleteInterment.php b/html/interments/deleteInterment.php new file mode 100644 index 0000000..2ccce84 --- /dev/null +++ b/html/interments/deleteInterment.php @@ -0,0 +1,18 @@ + + * @param GET interment_id + * @param GET return_url + */ +if (!userIsAllowed('Interments')) { + $_SESSION['errorMessages'][] = new Exception('noAccessAllowed'); + header('Location: '.BASE_URL); + exit(); +} + +$interment = new Interment($_GET['interment_id']); +$interment->delete(); + +header('Location: '.$_GET['return_url']);