Interments can now be deleted

git-svn-id: https://rosehill.googlecode.com/svn/trunk@68 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
inghamn 2010-02-02 15:57:24 +00:00
parent 5d50a8125d
commit e96b604573
3 changed files with 35 additions and 1 deletions

View File

@ -62,6 +62,14 @@ $return_url = $url->__toString();
Edit Edit
</button> </button>
"; ";
$url = new URL(BASE_URL.'/interments/deleteInterment.php');
$url->interment_id = $interment->getId();
$url->return_url = "http://$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI]";
$deleteButton = "
<button type=\"button\" class=\"delete\" onclick=\"COB.deleteConfirmation('$url');\">
Delete
</button>
";
} }
$last = View::escape($interment->getLastname()); $last = View::escape($interment->getLastname());
$middle = View::escape($interment->getMiddleInitial()); $middle = View::escape($interment->getMiddleInitial());
@ -79,7 +87,7 @@ $return_url = $url->__toString();
$section_lot = View::escape(implode(', ',$section_lot)); $section_lot = View::escape(implode(', ',$section_lot));
echo " echo "
<tr><td>$editButton</td> <tr><td>$editButton $deleteButton</td>
<td><a href=\"{$interment->getURL()}\">$last</a></td> <td><a href=\"{$interment->getURL()}\">$last</a></td>
<td>$middle</td> <td>$middle</td>
<td>$first</td> <td>$first</td>

View File

@ -126,6 +126,14 @@ class Interment
$this->id = $zend_db->lastInsertId('interments','id'); $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 // Generic Getters
//---------------------------------------------------------------- //----------------------------------------------------------------

View File

@ -0,0 +1,18 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @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']);