Added Internments Add/Edit/Search
git-svn-id: https://rosehill.googlecode.com/svn/branches/php@8 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
parent
80d1bade5a
commit
b0fbc4bb44
|
@ -0,0 +1,92 @@
|
|||
<?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>
|
||||
*/
|
||||
?>
|
||||
<h1>Add Internment</h1>
|
||||
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
|
||||
<fieldset><legend>Internment Info</legend>
|
||||
<table>
|
||||
|
||||
<tr><td><label for="internment-section">Section</label></td>
|
||||
<td><input name="internment[section]" id="internment-section"
|
||||
size="5" maxlength="5" />
|
||||
<label for="internment-lot">Lot</label>
|
||||
<input name="internment[lot]" id="internment-lot"
|
||||
size="5" maxlength="5" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-book">Book</label></td>
|
||||
<td><input name="internment[book]" id="internment-book"
|
||||
size="4" maxlength="4" />
|
||||
<label for="internment-pageNumber">Page</label>
|
||||
<input name="internment[pageNumber]" id="internment-pageNumber"
|
||||
size="5" maxlength="5" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><label for="internment-firstname">Name</label></td>
|
||||
<td><label for="internment-firstname">First</label>
|
||||
<input name="internment[firstname]" id="internment-firstname" />
|
||||
<label for="internment-middleInitial">MI</label>
|
||||
<input name="internment[middleInitial]" id="internment-middleInitial" />
|
||||
<label for="internment-lastname">Last</label>
|
||||
<input name="internment[lastname]" id="internment-lastname" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr><td><label for="internment-birthPlace">Place of Birth</label></td>
|
||||
<td><input name="internment[birthPlace]" id="internment-birthPlace" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-lastResidence">Last Residence</label></td>
|
||||
<td><input name="internment[lastResidence]" id="internment-lastResidence" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-deceasedDate">Date of Death</label></td>
|
||||
<td><input name="internment[deceasedDate]" id="internment-deceasedDate" size="10" />
|
||||
<label for="internment-age">Age</label>
|
||||
<input name="internment[age]" id="internment-age" size="3" maxlength="3" />
|
||||
<label for="internment-sex">Gender</label>
|
||||
<select name="internment[sex]" id="internment-sex">
|
||||
<option></option>
|
||||
<option>M</option>
|
||||
<option>F</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-cemetery_id">Cemetery</label></td>
|
||||
<td><select name="internment[cemetery_id]" id="internment-cemetery_id">
|
||||
<option></option>
|
||||
<?php
|
||||
$list = new CemeteryList();
|
||||
$list->find();
|
||||
foreach ($list as $cemetery) {
|
||||
$name = View::escape($cemetery->getName());
|
||||
echo "<option value=\"{$cemetery->getId()}\">$name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-notes">Notes</label></td>
|
||||
<td><textarea name="internment[notes]" id="internment-notes" rows="3" cols="60"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<button type="submit" class="submit">Submit</button>
|
||||
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/internments';">
|
||||
Cancel
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -0,0 +1,49 @@
|
|||
<?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>
|
||||
*/
|
||||
?>
|
||||
<h1>Search Burial Records</h1>
|
||||
<form method="get" action="<?php echo BASE_URL; ?>/internments">
|
||||
<table>
|
||||
<tr><td><label for="lastname">Last Name</label></td>
|
||||
<td><input name="lastname" id="lastname"
|
||||
value="<?php echo isset($_GET['lastname']) ? View::escape($_GET['lastname']) : ''; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><label for="firstname">First Name</label></td>
|
||||
<td><input name="firstname" id="firstname"
|
||||
value="<?php echo isset($_GET['firstname']) ? View::escape($_GET['firstname']) : ''; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
$cemeteries = new CemeteryList();
|
||||
$cemeteries->find();
|
||||
foreach ($cemeteries as $cemetery) {
|
||||
$name = View::escape($cemetery->getName());
|
||||
echo "
|
||||
<tr><td><label for=\"\">$name Sections</label></td>
|
||||
<td><select name=\"sections_{$cemetery->getId()}\">
|
||||
<option value=\"\">All</option>
|
||||
";
|
||||
foreach ($cemetery->getSections() as $section) {
|
||||
$section = View::escape($section);
|
||||
$selected = (isset($_GET['section']) && $_GET['section']==$section)
|
||||
? 'selected="selected"'
|
||||
: '';
|
||||
echo "<option $selected>$section</option>";
|
||||
}
|
||||
echo "
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<div>
|
||||
<button type="submit" class="search">Search</button>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,79 @@
|
|||
<?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>
|
||||
* @param InternmentList $this->internmentList
|
||||
*/
|
||||
?>
|
||||
<div class="interfaceBox">
|
||||
<h1>
|
||||
<?php
|
||||
if (userIsAllowed('Internments')) {
|
||||
echo "
|
||||
<button type=\"button\" class=\"add\" onclick=\"document.location.href='".BASE_URL."/internments/addInternment.php';\">
|
||||
Add
|
||||
</button>
|
||||
";
|
||||
}
|
||||
?>
|
||||
Internments
|
||||
</h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr><th></th>
|
||||
<th>Last Name</th>
|
||||
<th>First Name</th>
|
||||
<th>Date of Death</th>
|
||||
<th>Cemetery</th>
|
||||
<th>Section & Lot</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($this->internmentList as $internment) {
|
||||
$editButton = '';
|
||||
if (userIsAllowed('Internments')) {
|
||||
$url = new URL(BASE_URL.'/internments/updateInternment.php');
|
||||
$url->internment_id = $internment->getId();
|
||||
$editButton = "
|
||||
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$url';\">
|
||||
Edit
|
||||
</button>
|
||||
";
|
||||
}
|
||||
$last = View::escape($internment->getLastname());
|
||||
$first = View::escape($internment->getFirstname());
|
||||
$date = $internment->getDeceasedDate('n/j/Y');
|
||||
$cemetery = View::escape($internment->getCemetery());
|
||||
|
||||
$section_lot = array();
|
||||
if ($internment->getSection()) {
|
||||
$section_lot[] = $internment->getSection();
|
||||
}
|
||||
if ($internment->getLot()) {
|
||||
$section_lot[] = $internment->getLot();
|
||||
}
|
||||
$section_lot = View::escape(implode(', ',$section_lot));
|
||||
|
||||
echo "
|
||||
<tr><td>$editButton</td>
|
||||
<td>$last</td>
|
||||
<td>$first</td>
|
||||
<td>$date</td>
|
||||
<td>$cemetery</td>
|
||||
<td>$section_lot</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
if ($this->internmentList->getPaginator()) {
|
||||
$pageNavigation = new Block('pageNavigation.inc',
|
||||
array('pages'=>$this->internmentList->getPaginator()->getPages()));
|
||||
echo $pageNavigation->render('html');
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,112 @@
|
|||
<?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>
|
||||
* @param Internment $this->internment
|
||||
*/
|
||||
?>
|
||||
<h1>Update Internment</h1>
|
||||
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
|
||||
<fieldset><legend>Internment Info</legend>
|
||||
<input name="internment_id" type="hidden" value="<?php echo $this->internment->getId(); ?>" />
|
||||
<table>
|
||||
|
||||
<tr><td><label for="internment-section">Section</label></td>
|
||||
<td><input name="internment[section]" id="internment-section"
|
||||
size="5" maxlength="5"
|
||||
value="<?php echo View::escape($this->internment->getSection()); ?>" />
|
||||
<label for="internment-lot">Lot</label>
|
||||
<input name="internment[lot]" id="internment-lot"
|
||||
size="5" maxlength="5"
|
||||
value="<?php echo View::escape($this->internment->getLot()); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-book">Book</label></td>
|
||||
<td><input name="internment[book]" id="internment-book"
|
||||
size="4" maxlength="4"
|
||||
value="<?php echo View::escape($this->internment->getBook()); ?>" />
|
||||
<label for="internment-pageNumber">Page</label>
|
||||
<input name="internment[pageNumber]" id="internment-pageNumber"
|
||||
size="5" maxlength="5"
|
||||
value="<?php echo View::escape($this->internment->getPageNumber()); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><label for="internment-firstname">Name</label></td>
|
||||
<td><label for="internment-firstname">First</label>
|
||||
<input name="internment[firstname]" id="internment-firstname"
|
||||
value="<?php echo View::escape($this->internment->getFirstname()); ?>" />
|
||||
<label for="internment-middleInitial">MI</label>
|
||||
<input name="internment[middleInitial]" id="internment-middleInitial"
|
||||
value="<?php echo View::escape($this->internment->getMiddleInitial()); ?>" />
|
||||
<label for="internment-lastname">Last</label>
|
||||
<input name="internment[lastname]" id="internment-lastname"
|
||||
value="<?php echo View::escape($this->internment->getLastname()); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr><td><label for="internment-birthPlace">Place of Birth</label></td>
|
||||
<td><input name="internment[birthPlace]" id="internment-birthPlace"
|
||||
value="<?php echo View::escape($this->internment->getBirthPlace()); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-lastResidence">Last Residence</label></td>
|
||||
<td><input name="internment[lastResidence]" id="internment-lastResidence"
|
||||
value="<?php echo View::escape($this->internment->getLastResidence()); ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-deceasedDate">Date of Death</label></td>
|
||||
<td><input name="internment[deceasedDate]" id="internment-deceasedDate"
|
||||
size="10" value="<?php echo $this->internment->getDeceasedDate('n/j/Y'); ?>" />
|
||||
<label for="internment-age">Age</label>
|
||||
<input name="internment[age]" id="internment-age"
|
||||
size="3" maxlength="3"
|
||||
value="<?php echo View::escape($this->internment->getAge()); ?>" />
|
||||
<label for="internment-sex">Gender</label>
|
||||
<select name="internment[sex]" id="internment-sex">
|
||||
<option></option>
|
||||
<option value="M" <?php echo $this->internment->getSex()=='M' ? 'selected="selected"' : ''; ?>>
|
||||
M
|
||||
</option>
|
||||
<option value="F" <?php echo $this->internment->getSex()=='F' ? 'selected="selected"' : ''; ?>>
|
||||
F
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-cemetery_id">Cemetery</label></td>
|
||||
<td><select name="internment[cemetery_id]" id="internment-cemetery_id">
|
||||
<option></option>
|
||||
<?php
|
||||
$list = new CemeteryList();
|
||||
$list->find();
|
||||
foreach ($list as $cemetery) {
|
||||
$name = View::escape($cemetery->getName());
|
||||
$selected = $this->internment->getCemetery_id()==$cemetery->getId()
|
||||
? 'selected="selected"'
|
||||
: '';
|
||||
echo "<option value=\"{$cemetery->getId()}\" $selected>$name</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr><td><label for="internment-notes">Notes</label></td>
|
||||
<td><textarea name="internment[notes]" id="internment-notes" rows="3" cols="60"><?php echo View::escape($this->internment->getNotes()); ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<button type="submit" class="submit">Submit</button>
|
||||
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/internments';">
|
||||
Cancel
|
||||
</button>
|
||||
</fieldset>
|
||||
</form>
|
|
@ -139,4 +139,14 @@ class Cemetery
|
|||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the available sections for this cemetery
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSections()
|
||||
{
|
||||
return Internment::getSections($this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -432,4 +432,21 @@ class Internment
|
|||
// Custom Functions
|
||||
// We recommend adding all your custom code down here at the bottom
|
||||
//----------------------------------------------------------------
|
||||
/**
|
||||
* Returns the list of available sections
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getSections(Cemetery $cemetery=null)
|
||||
{
|
||||
$zend_db = Database::getConnection();
|
||||
$select = new Zend_Db_Select($zend_db);
|
||||
$select->distinct()->from('internments','section');
|
||||
$select->where('section is not null');
|
||||
if ($cemetery) {
|
||||
$select->where('cemetery_id=?',$cemetery->getId());
|
||||
}
|
||||
$select->order(array('section'));
|
||||
return $zend_db->fetchCol($select);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
*
|
||||
* Beyond the basic $fields handled, you will need to write your own handling
|
||||
* of whatever extra $fields you need
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @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>
|
||||
|
@ -52,7 +51,14 @@ class InternmentList extends ZendDbResultIterator
|
|||
// Finding on fields from the internments table is handled here
|
||||
if (count($fields)) {
|
||||
foreach ($fields as $key=>$value) {
|
||||
$this->select->where("$key=?",$value);
|
||||
switch ($key) {
|
||||
case 'lastname':
|
||||
case 'firstname':
|
||||
$this->select->where("$key like ?","$value%");
|
||||
break;
|
||||
default:
|
||||
$this->select->where("$key=?",$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
|
||||
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
||||
*/
|
||||
|
||||
if (!userIsAllowed('Internments')) {
|
||||
$_SESSION['errorMessages'][] = new Exception('noAccessAllowed');
|
||||
header('Location: '.BASE_URL.'/internments');
|
||||
|
|
|
@ -4,11 +4,39 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
|
||||
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
||||
*/
|
||||
$currentPage = isset($_GET['page']) ? (int)$_GET['page'] : 1;
|
||||
|
||||
$knownFields = array('lastname','firstname');
|
||||
$cemeteries = new CemeteryList();
|
||||
$cemeteries->find();
|
||||
foreach ($cemeteries as $cemetery) {
|
||||
$knownFields[] = 'section_'.$cemetery->getId();
|
||||
}
|
||||
|
||||
|
||||
$search = array();
|
||||
foreach ($_GET as $field=>$value) {
|
||||
if ($value) {
|
||||
if (false !== strpos($field,'section')) {
|
||||
$search['section'] = $value;
|
||||
}
|
||||
else {
|
||||
if (in_array($field,$knownFields)) {
|
||||
$search[$field] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($search)) {
|
||||
$internmentList = new InternmentList($search,20,$currentPage);
|
||||
}
|
||||
|
||||
$internmentList = new InternmentList();
|
||||
$internmentList->find();
|
||||
|
||||
$template = new Template();
|
||||
$template->blocks[] = new Block('internments/internmentList.inc',
|
||||
array('internmentList'=>$internmentList));
|
||||
$template->blocks[] = new Block('internments/findForm.inc');
|
||||
if (isset($internmentList)) {
|
||||
$template->blocks[] = new Block('internments/internmentList.inc',
|
||||
array('internmentList'=>$internmentList));
|
||||
}
|
||||
echo $template->render();
|
|
@ -4,7 +4,6 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
|
||||
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
||||
*/
|
||||
|
||||
if (!userIsAllowed('Internments')) {
|
||||
$_SESSION['errorMessages'][] = new Exception('noAccessAllowed');
|
||||
header('Location: '.BASE_URL.'/internments');
|
||||
|
@ -29,6 +28,5 @@ if (isset($_POST['internment'])) {
|
|||
}
|
||||
|
||||
$template = new Template();
|
||||
$template->blocks[] = new Block('internments/updateInternmentForm.inc',
|
||||
array('internment'=>$internment));
|
||||
$template->blocks[] = new Block('internments/updateInternmentForm.inc',array('internment'=>$internment));
|
||||
echo $template->render();
|
|
@ -4,3 +4,13 @@ select r.ID,r.SEC,r.LOT,r.LNAME1,r.FNAME1,r.MI1,
|
|||
r.LNAME2,r.FNAME2,r.MI2,r.DATE_ISSUE,r.NOTES,r.lot2,c.id
|
||||
from rosehill.DEED r
|
||||
left join cemeteries c on r.whiteoak=substr(c.name,1,1);
|
||||
|
||||
|
||||
insert internments(id,section,lot,book,pageNumber,deceasedDate,
|
||||
lastname,firstname,middleInitial,
|
||||
birthPlace,lastResidence,age,sex,cemetery_id,notes,lot2)
|
||||
select r.ID,r.SEC,r.LOT,r.BOOK,r.PAGENUM,r.DEATH,
|
||||
r.LNAME,r.FNAME,r.MI,
|
||||
r.POB,r.LATE_RES,r.AGE,r.SEX,c.id,r.NOTES,r.lot2
|
||||
from rosehill.ROSEHILL r
|
||||
left join cemeteries c on r.whiteoak=substr(c.name,1,1);
|
Loading…
Reference in New Issue