Created the interment view, including links to the Maps. Still don't have the actual maps displaying quite yet

git-svn-id: https://rosehill.googlecode.com/svn/branches/php@16 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
inghamn 2009-12-18 20:57:41 +00:00
parent 0c54e7934e
commit 7dfa607734
12 changed files with 254 additions and 5 deletions

26
blocks/html/about.inc Normal file
View File

@ -0,0 +1,26 @@
<?php
/**
* @copyright Copyright (C) 2008-2009 City of Bloomington, Indiana. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
*/
?>
<div id="aboutCemeteries">
<h2>About the Cemeteries</h2>
<ul>
<li><a href="http://bloomington.in.gov/documents/viewDocument.php?document_id=1745">Rose Hill Cemetery</a></li>
<li><a href="http://bloomington.in.gov/documents/viewDocument.php?document_id=1747">White Oak Cemetery</a></li>
<li><a href="http://bloomington.in.gov/documents/viewDocument.php?document_id=1745">Notable Persons</a></li>
<li><a href="http://bloomington.in.gov/documents/viewDocument.php?document_id=1745">Rose Hill Historic Walking Tour</a></li>
</ul>
<h2>Website Support</h2>
<ul>
<li><a href="http://bloomington.in.gov/documents/viewDocument.php?document_id=4578">Help</a></li>
<li><a href="https://bloomington.in.gov/documents/viewDocument.php?document_id=4577">Cemetery Data Download and Service</a></li>
<li><a href="http://bloomington.in.gov">City of Bloomington</a></li>
</ul>
</div>
<div id="cemeteryImages">
<div><img alt="Rose Hill Cemetery" src="<?php echo BASE_URL."/images/rosehill.png"; ?>" /></div>
<div><img alt="White Oak Cemetery" src="<?php echo BASE_URL."/images/whiteoakweb.jpg"; ?>" /></div>
</div>

View File

@ -14,11 +14,14 @@
<td><input name="cemetery[name]" id="cemetery-name" /> <td><input name="cemetery[name]" id="cemetery-name" />
</td> </td>
</tr> </tr>
<tr><td><label for="cemetery-googleMapURL">Google Map URL</label></td>
<td><input name="cemetery[googleMapURL]" id="cemetery-googleMapURL" /></td>
</tr>
</table> </table>
<button type="submit" class="submit">Submit</button> <button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeterys';"> <button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeteries';">
Cancel Cancel
</button> </button>
</fieldset> </fieldset>

View File

@ -17,11 +17,16 @@
value="<?php echo View::escape($this->cemetery->getName()); ?>" /> value="<?php echo View::escape($this->cemetery->getName()); ?>" />
</td> </td>
</tr> </tr>
<tr><td><label for="cemetery-googleMapURL">Google Map URL</label></td>
<td><input name="cemetery[googleMapURL]" id="cemetery-googleMapURL"
value="<?php echo View::escape($this->cemetery->getGoogleMapURL()); ?>" />
</td>
</tr>
</table> </table>
<button type="submit" class="submit">Submit</button> <button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeterys';"> <button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeteries';">
Cancel Cancel
</button> </button>
</fieldset> </fieldset>

View File

@ -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>
* @param Interment $this->interment
*/
$fullname = View::escape($this->interment->getFullname());
echo "<h2>$fullname</h2>";
$date = $this->interment->getDeceasedDate('n/j/Y');
$birth = View::escape($this->interment->getBirthPlace());
$residence = View::escape($this->interment->getLastResidence());
$cemetery = View::escape($this->interment->getCemetery());
$age = View::escape($this->interment->getAge());
$gender = View::escape($this->interment->getSex());
$section_lot = array();
if ($this->interment->getSection()) {
$section_lot[] = $this->interment->getSection();
}
if ($this->interment->getLot()) {
$section_lot[] = $this->interment->getLot();
}
$section_lot = View::escape(implode(', ',$section_lot));
?>
<table>
<tr><th>Date of Death </th>
<td><?php echo $date; ?></td>
</tr>
<tr><th>Last Residence </th>
<td><?php echo $residence; ?></td>
</tr>
<tr><th>Place of Birth </th>
<td><?php echo $birth; ?></td>
</tr>
<tr><th>Age </th>
<td><?php echo $age; ?></td>
</tr>
<tr><th>Gender </th>
<td><?php echo $gender; ?></td>
</tr>
<tr><th>Cemetery </th>
<td><?php echo $cemetery; ?></td>
</tr>
<tr><th>Section and Lot </th>
<td><?php echo $section_lot; ?></td>
</tr>
</table>

View File

@ -58,7 +58,7 @@
echo " echo "
<tr><td>$editButton</td> <tr><td>$editButton</td>
<td>$last</td> <td><a href=\"{$interment->getURL()}\">$last</a></td>
<td>$first</td> <td>$first</td>
<td>$date</td> <td>$date</td>
<td>$cemetery</td> <td>$cemetery</td>

View File

@ -0,0 +1,34 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* @param Interment $this->interment
*/
$mapURL = BASE_URL.'/interments/map.php?interment_id='.$this->interment->getId();
$cemetery = $this->interment->getCemetery();
$name = View::escape($cemetery->getName());
?>
<div id="burialLinks">
<table>
<tr><td><a href="<?php echo $mapURL; ?>">
<img src="<?php echo $cemetery->getMap('thumb'); ?>"
alt="<?php echo $name; ?>" />
</a>
</td>
<td><a href="<?php echo $mapURL; ?>">
View Maps of Cemetery and Section
</a>
</td>
</tr>
<tr><td><a href="<?php echo $cemetery->getGoogleMapURL(); ?>">
<img src="<?php echo BASE_URL; ?>/images/car.png"
alt="Direction map to <?php echo $name ?>" />
</a>
</td>
<td><a href="<?php echo $cemetery->getGoogleMapURL(); ?>">
Get driving directions to <?php echo $name ?>
</a>
</td>
</tr>
</table>
</div>

View File

@ -8,6 +8,7 @@ class Cemetery
{ {
private $id; private $id;
private $name; private $name;
private $googleMapURL;
/** /**
* Populates the object with data * Populates the object with data
@ -76,6 +77,7 @@ class Cemetery
$data = array(); $data = array();
$data['name'] = $this->name; $data['name'] = $this->name;
$data['googleMapURL'] = $this->googleMapURL ? $this->googleMapURL : null;
if ($this->id) { if ($this->id) {
$this->update($data); $this->update($data);
@ -118,6 +120,13 @@ class Cemetery
return $this->name; return $this->name;
} }
/**
* @return string
*/
public function getGoogleMapURL()
{
return $this->googleMapURL;
}
//---------------------------------------------------------------- //----------------------------------------------------------------
// Generic Setters // Generic Setters
//---------------------------------------------------------------- //----------------------------------------------------------------
@ -130,7 +139,13 @@ class Cemetery
$this->name = trim($string); $this->name = trim($string);
} }
/**
* @param string $string
*/
public function setGoogleMapURL($string)
{
$this->googleMapURL = trim($string);
}
//---------------------------------------------------------------- //----------------------------------------------------------------
// Custom Functions // Custom Functions
// We recommend adding all your custom code down here at the bottom // We recommend adding all your custom code down here at the bottom
@ -149,4 +164,29 @@ class Cemetery
{ {
return Interment::getSections($this); return Interment::getSections($this);
} }
/**
* @return URL
*/
public function getURL()
{
return new URL(BASE_URL.'/cemeteries/viewCemetery.php?cemetery_id='.$this->id);
}
/**
* Returns the URL to the map image for this cemetery
*
* Available map types are:
* full, thumb - for the main map
* highlight, zoom - for the section maps
*
* @return string
*/
public function getMap($type="full")
{
$mapDirectory = "images/cemeteries/{$this->id}";
$filename = $type=='full' ? 'map.jpg' : 'map_thumb.jpg';
return BASE_URL."/$mapDirectory/$filename";
}
} }

View File

@ -432,6 +432,14 @@ class Interment
// Custom Functions // Custom Functions
// We recommend adding all your custom code down here at the bottom // We recommend adding all your custom code down here at the bottom
//---------------------------------------------------------------- //----------------------------------------------------------------
/**
* @return string
*/
public function getURL()
{
return BASE_URL.'/interments/viewInterment.php?interment_id='.$this->id;
}
/** /**
* Returns the list of available sections * Returns the list of available sections
* *
@ -449,4 +457,38 @@ class Interment
$select->order(array('section')); $select->order(array('section'));
return $zend_db->fetchCol($select); return $zend_db->fetchCol($select);
} }
/**
* @return string
*/
public function getFullname()
{
$name = array();
if ($this->firstname) {
$name[] = $this->firstname;
}
if ($this->middleInitial) {
$name[] = $this->middleInitial;
}
if ($this->lastname) {
$name[] = $this->lastname;
}
return implode(' ',$name);
}
/**
* @return string
*/
public function getSectionMapURL($section,$type='highlight')
{
$section = preg_replace('/[^a-z\-]/','',strtolower($section));
$type = $type=='highlight' ? 'highlight' : 'zoom';
$mapDirectory = "images/cemeteries/{$this->cemetery_id}";
$filename = "$type/$section.jpg";
if (file_exists(APPLICATION_HOME."/html/$mapDirectory/$filename")) {
return BASE_URL."$mapDirectory/$filename";
}
}
} }

View File

@ -0,0 +1,23 @@
<?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 $_GET cemetery_id
* @param $_GET section (optional)
*/
try {
if (!isset($_GET['cemetery_id']) || !$_GET['cemetery_id']) {
throw new Exception('cemeteries/unknownCemetery');
}
$cemetery = new Cemeter($_GET['cemetery_id']);
}
catch (Exception $e) {
$_SESSION['errorMessages'][] = $e;
header('Location: '.BASE_URL);
exit();
}
$template = new Template();
$template->blocks[] = new Block('cemeteries/cemeteryInfo.inc',array('cemetery'=>$cemetery));
echo $template->render();

View File

@ -39,4 +39,5 @@ if (isset($intermentList)) {
$template->blocks[] = new Block('interments/intermentList.inc', $template->blocks[] = new Block('interments/intermentList.inc',
array('intermentList'=>$intermentList)); array('intermentList'=>$intermentList));
} }
$template->blocks['panel-one'][] = new Block('about.inc');
echo $template->render(); echo $template->render();

View File

@ -0,0 +1,25 @@
<?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 GET interment_id
*/
try {
if (!isset($_GET['interment_id']) || !$_GET['interment_id']) {
throw new Exception('interments/unknownInterment');
}
$interment = new Interment($_GET['interment_id']);
}
catch (Exception $e) {
$_SESSION['errorMessages'][] = $e;
header('Location: '.BASE_URL.'/interments');
exit();
}
$template = new Template();
$template->blocks[] = new Block('interments/intermentInfo.inc',array('interment'=>$interment));
$template->blocks['panel-one'][] = new Block('interments/mapLinks.inc',
array('interment'=>$interment));
echo $template->render();

View File

@ -34,7 +34,8 @@ create table user_roles (
create table cemeteries ( create table cemeteries (
id int unsigned not null primary key auto_increment, id int unsigned not null primary key auto_increment,
name varchar(128) not null name varchar(128) not null,
googleMapURL varchar(255)
) engine=InnoDB; ) engine=InnoDB;
create table deeds ( create table deeds (