Deeds can now be deleted
git-svn-id: https://rosehill.googlecode.com/svn/trunk@65 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
parent
8fd7dd0210
commit
021a1cb1c3
|
@ -41,6 +41,15 @@
|
||||||
Edit
|
Edit
|
||||||
</button>
|
</button>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
$url = new URL(BASE_URL.'/deeds/deleteDeed.php');
|
||||||
|
$url->deed_id = $deed->getId();
|
||||||
|
$url->return_url = "http://$_SERVER[SERVER_NAME]$_SERVER[REQUEST_URI]";
|
||||||
|
$deleteButton = "
|
||||||
|
<button type=\"button\" class=\"delete\" onclick=\"COB.deleteConfirmation('$url');\">
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
";
|
||||||
}
|
}
|
||||||
$section = View::escape($deed->getSection());
|
$section = View::escape($deed->getSection());
|
||||||
$lot = View::escape($deed->getLot());
|
$lot = View::escape($deed->getLot());
|
||||||
|
@ -49,7 +58,7 @@
|
||||||
$date = $deed->getIssueDate('n/j/Y');
|
$date = $deed->getIssueDate('n/j/Y');
|
||||||
$cemetery = $deed->getCemetery() ? View::escape($deed->getCemetery()->getName()) : '';
|
$cemetery = $deed->getCemetery() ? View::escape($deed->getCemetery()->getName()) : '';
|
||||||
echo "
|
echo "
|
||||||
<tr><td>$editButton</td>
|
<tr><td>$editButton $deleteButton</td>
|
||||||
<td>{$deed->getSection()}, {$deed->getLot()}</td>
|
<td>{$deed->getSection()}, {$deed->getLot()}</td>
|
||||||
<td>$owner1</td>
|
<td>$owner1</td>
|
||||||
<td>$owner2</td>
|
<td>$owner2</td>
|
||||||
|
|
|
@ -119,6 +119,14 @@ class Deed
|
||||||
$this->id = $zend_db->lastInsertId('deeds','id');
|
$this->id = $zend_db->lastInsertId('deeds','id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
if ($this->id) {
|
||||||
|
$zend_db = Database::getConnection();
|
||||||
|
$zend_db->delete('deeds','id='.$this->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// Generic Getters
|
// Generic Getters
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|
|
@ -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 deed_id
|
||||||
|
* @param GET return_url
|
||||||
|
*/
|
||||||
|
if (!userIsAllowed('Deeds')) {
|
||||||
|
$_SESSION['errorMessages'][] = new Exception('noAccessAllowed');
|
||||||
|
header('Location: '.BASE_URL);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$deed = new Deed($_GET['deed_id']);
|
||||||
|
$deed->delete();
|
||||||
|
|
||||||
|
header('Location: '.$_GET['return_url']);
|
|
@ -27,3 +27,14 @@ COB.populateSections = function(cemetery_id,select_id,BASE_URL) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A handy function for doing pop-up confirmations when deleting something */
|
||||||
|
COB.deleteConfirmation = function (url) {
|
||||||
|
if (confirm("Are you really sure you want to delete this?\n\nOnce deleted it will be gone forever.")) {
|
||||||
|
document.location.href = url;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue