Updated Cemeteries CRUD

This commit is contained in:
Cliff Ingham 2014-08-19 10:58:42 -04:00
parent d52a8c277f
commit 9cef7f867d
31 changed files with 413 additions and 503 deletions

View File

@ -0,0 +1,79 @@
<?php
/**
* @copyright 2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
namespace Application\Controllers;
use Application\Models\Cemetery;
use Application\Models\CemeteriesTable;
use Blossom\Classes\Controller;
use Blossom\Classes\Block;
class CemeteriesController extends Controller
{
private function loadCemetery($id)
{
if (!empty($id)) {
try {
$cemetery = new Cemetery($id);
return $cemetery;
}
catch (\Exception $e) {
$_SESSION['errorMessages'][] = $e;
}
}
else {
$_SESSION['errorMessages'][] = new \Exception('cemeteries/unknownCemetery');
}
header('Location: '.BASE_URL.'/cemeteries');
exit();
}
public function index()
{
$table = new CemeteriesTable();
$list = $table->find();
$this->template->blocks[] = new Block('cemeteries/list.inc', ['cemeteries'=>$list]);
}
public function view()
{
$cemetery = $this->loadCemetery($_GET['cemetery_id']);
$this->template->blocks[] = new Block('cemeteries/info.inc', ['cemetery'=>$cemetery]);
}
public function update()
{
if (!empty($_REQUEST['cemetery_id'])) {
$cemetery = $this->loadCemetery($_REQUEST['cemetery_id']);
}
else {
$cemetery = new Cemetery();
}
if (isset($_POST['name'])) {
$cemetery->handleUpdate($_POST);
try {
$cemetery->save();
if (isset($_FILES)) {
if (isset($_FILES['map']) && $_FILES['map']['tmp_name']) {
$cemetery->saveMap($_FILES['map'],'full');
}
if (isset($_FILES['thumbnail']) && $_FILES['thumbnail']['tmp_name']) {
$section->saveMap($_FILES['thumbnail'],'thumbnail');
}
}
header('Location: '.BASE_URL.'/cemeteries/view?cemetery_id='.$cemetery->getId());
exit();
}
catch (\Exception $e) {
$_SESSION['errorMessages'][] = $e;
}
}
$this->template->blocks[] = new Block('/cemeteries/updateForm.inc', ['cemetery'=>$cemetery]);
}
}

View File

@ -0,0 +1,15 @@
<?php
/**
* @copyright 2009-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
namespace Application\Models;
use Blossom\Classes\TableGateway;
use Zend\Db\Sql\Select;
class CemeteriesTable extends TableGateway
{
public function __construct() { parent::__construct('cemeteries', __namespace__.'\Cemetery'); }
}

143
Models/Cemetery.php Normal file
View File

@ -0,0 +1,143 @@
<?php
/**
* @copyright 2009-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
namespace Application\Models;
use Blossom\Classes\ActiveRecord;
use Blossom\Classes\Database;
use Blossom\Classes\ExternalIdentity;
class Cemetery extends ActiveRecord
{
protected $tablename = 'cemeteries';
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|string|array $id (ID, email, username)
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$this->exchangeArray($id);
}
else {
$zend_db = Database::getConnection();
if (ActiveRecord::isId($id)) {
$sql = 'select * from cemeteries where id=?';
}
else {
$sql = 'select * from cemeteries where name=?';
}
$result = $zend_db->createStatement($sql)->execute([$id]);
if (count($result)) {
$this->exchangeArray($result->current());
}
else {
throw new \Exception('cemeteries/unknownCemetery');
}
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
public function validate()
{
if (!$this->getName()) { throw new \Exception('missingName'); }
}
public function save() { parent::save(); }
//----------------------------------------------------------------
// Generic Getters & Setters
//----------------------------------------------------------------
public function getId() { return parent::get('id'); }
public function getName() { return parent::get('name'); }
public function getGoogleMapUrl() { return parent::get('googleMapUrl'); }
public function setName ($s) { parent::set('name', $s); }
public function setGoogleMapUrl($s) { parent::set('googleMapUrl', $s); }
public function handleUpdate($post)
{
$this->setName($post['name']);
$this->setGoogleMapUrl($post['googleMapUrl']);
}
//----------------------------------------------------------------
// Custom functions
//----------------------------------------------------------------
public function __toString() { return $this->getName(); }
/**
* @return string
*/
public function getUrl() { return BASE_URL.'/cemeteries/view?cemetery_id='.$this->getId(); }
public function getUri() { return BASE_URI.'/cemeteries/view?cemetery_id='.$this->getId(); }
/**
* @return Zend\Db\Result
*/
public function getSections()
{
if ($this->getId()) {
$table = new SectionsTable();
return $table->find(['cemetery_id'=>$this->getId()]);
}
}
/**
* @return string
*/
private function getMapDirectory()
{
return 'images/cemeteries/'.$this->getId();
}
/**
* Returns the URL to the map image for this cemetery
*
* Available map types are:
* full, thumb - for the main map
*
* @param string $type
* @return string
*/
public function getMap($type="full")
{
$imageDir = $this->getMapDirectory();
$filename = $type=='full' ? 'map' : 'map_thumb';
$glob = glob(APPLICATION_HOME."/public/$imageDir/$filename.*");
if (count($glob)) {
$filename = basename($glob[0]);
return BASE_URL."/$imageDir/$filename";
}
}
/**
* @param array|string $file Either an entry from $_FILES or a path to a file
*/
public function saveMap($file, $type)
{
$imageDir = $this->getMapDirectory();
$name = $type=='full' ? 'map' : 'map_thumb';
$directory = APPLICATION_HOME."/public/$imageDir";
Map::saveFile($directory, $file, $name);
}
}

View File

@ -1,38 +0,0 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<h2>Add Cemetery</h2>
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" enctype="multipart/form-data">
<fieldset><legend>Cemetery Info</legend>
<table>
<tr><td><label for="cemetery-name" class="required">Name</label></td>
<td><input name="cemetery[name]" id="cemetery-name" />
</td>
</tr>
<tr><td><label for="cemetery-googleMapURL">Google Map URL</label></td>
<td><input name="cemetery[googleMapURL]" id="cemetery-googleMapURL" /></td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>
<button type="button" class="cancel" onclick="document.location.href='<?php echo BASE_URL; ?>/cemeteries';">
Cancel
</button>
</fieldset>
<fieldset><legend>Maps</legend>
<div>
<label for="map">Map</lable>
<input type="file" name="map" id="map" />
</div>
<div>
<label for="thumbnail">Thumbnail</lable>
<input type="file" name="thumbnail" id="thumbnail" />
</div>
</fieldset>
</form>

View File

@ -1,55 +0,0 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
$addButton = '';
if (userIsAllowed('Sections')) {
$url = BASE_URL.'/sections/addSection.php?cemetery_id='.$this->cemetery->getId();
$addButton = "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='$url';\">
Add a section
</button>
";
}
$name = View::escape($this->cemetery->getName());
echo "
<h1>$name</h1>
<h2>$addButton Sections</h2>
<table>
<thead>
<tr><th></th>
<th>Code</th>
<th>Name</th>
</tr>
</thead>
<tbody>
";
foreach ($this->cemetery->getSections() as $section) {
$editButton = '';
if (userIsAllowed('Sections')) {
$url = BASE_URL.'/sections/updateSection.php?section_id='.$section->getId();
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$url';\">
Edit
</button>
";
}
$code = View::escape($section->getCode());
$name = View::escape($section->getName());
echo "
<tr><td>$editButton</td>
<td>$code</td>
<td>$name</td>
<td></td>
</tr>
";
}
echo "
</tbody>
</table>
";
include APPLICATION_HOME.'/blocks/html/serviceButtons.inc';

View File

@ -1,43 +0,0 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
?>
<div class="interfaceBox">
<h2>
<?php
if (userIsAllowed('Cemeteries')) {
echo "
<button type=\"button\" class=\"add\" onclick=\"document.location.href='".BASE_URL."/cemeteries/addCemetery.php';\">
Add
</button>
";
}
?>
Cemeteries
</h2>
<ul><?php
foreach ($this->cemeteryList as $cemetery) {
$editButton = '';
if (userIsAllowed('Cemeteries')) {
$url = new URL(BASE_URL.'/cemeteries/updateCemetery.php');
$url->cemetery_id = $cemetery->getId();
$editButton = "
<button type=\"button\" class=\"edit\" onclick=\"document.location.href='$url';\">
Edit
</button>
";
}
$name = View::escape($cemetery->getName());
echo "
<li>$editButton
<a href=\"{$cemetery->getURL()}\">$name</a>
</li>
";
}
?>
</ul>
</div>
<?php include APPLICATION_HOME.'/blocks/html/serviceButtons.inc'; ?>

View File

@ -0,0 +1,57 @@
<?php
/**
* @copyright 2010-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
use Application\Models\Person;
use Blossom\Classes\View;
$addButton = '';
if (Person::isAllowed('sections', 'edit')) {
$helper = $this->template->getHelper('buttonLink');
$addButton = $helper->buttonLink(
BASE_URI.'/sections/update?cemetery_id='.$this->cemetery->getId(),
$this->translate('add_section'),
'add'
);
}
$name = View::escape($this->cemetery->getName());
echo "
<h2>$name</h2>
<h3>{$this->translate(['section', 'sections', 2])} $addButton</h3>
<table>
<thead>
<tr><th></th>
<th>{$this->translate('code')}</th>
<th>{$this->translate('name')}</th>
</tr>
</thead>
<tbody>
";
foreach ($this->cemetery->getSections() as $section) {
$editButton = '';
if (Person::isAllowed('sections', 'edit')) {
$editButton = $helper->buttonLink(
BASE_URI.'/sections/update?section_id='.$section->getId(),
$this->translate('edit'),
'edit'
);
}
$code = View::escape($section->getCode());
$name = View::escape($section->getName());
echo "
<tr><td>$editButton</td>
<td>$code</td>
<td>$name</td>
<td></td>
</tr>
";
}
echo "
</tbody>
</table>
";
include APPLICATION_HOME.'/blocks/html/serviceButtons.inc';

View File

@ -0,0 +1,44 @@
<?php
/**
* @copyright 2009-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Zend\Db\Result $this->cemeteries
*/
use Application\Models\Person;
use Blossom\Classes\View;
?>
<div>
<h2><?php
echo $this->translate(['cemetery', 'cemeteries', 2]);
if (Person::isAllowed('cemeteries', 'edit')) {
$helper = $this->template->getHelper('buttonLink');
echo $helper->buttonLink(
BASE_URI.'/cemeteries/update',
$this->translate('add'),
'add'
);
}
?>
</h2>
<ul><?php
foreach ($this->cemeteries as $cemetery) {
$editButton = '';
if (Person::isAllowed('cemeteries', 'edit')) {
$editButton = $helper->buttonLink(
BASE_URI.'/cemeteries/update?cemetery_id='.$cemetery->getId(),
$this->translate('edit'),
'edit'
);
}
$name = View::escape($cemetery->getName());
echo "
<li>$editButton
<a href=\"{$cemetery->getUri()}\">$name</a>
</li>
";
}
?>
</ul>
</div>
<?php include APPLICATION_HOME.'/blocks/html/serviceButtons.inc'; ?>

View File

@ -2,11 +2,12 @@
/** /**
* Renders buttons for each of the known output formats, pointing to the current URL * Renders buttons for each of the known output formats, pointing to the current URL
* *
* @copyright 2010 City of Bloomington, Indiana * @copyright 2010-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov> * @author Cliff Ingham <inghamn@bloomington.in.gov>
*/ */
$serviceURL = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); use Blossom\Classes\Url;
$serviceURL = new Url($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
$serviceURL->purgeEmptyParameters(); $serviceURL->purgeEmptyParameters();
$serviceURL->format = 'xml'; $serviceURL->format = 'xml';
echo " echo "

View File

@ -1,22 +0,0 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
$sections = array();
foreach ($this->cemetery->getSections() as $section) {
$code = addslashes($section->getCode());
$name = addslashes($section->getName());
$sections[] = "{\"id\":{$section->getId()},\"code\":\"$code\",\"name\":\"$name\"}";
}
$sections = implode(',',$sections);
$name = addslashes($this->cemetery->getName());
echo "
{ \"id\":{$this->cemetery->getId()},
\"name\":\"$name\",
\"sections\":[$sections]
}
";

View File

@ -1,21 +0,0 @@
<?php
/**
* @copyright 2010 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
$cemeteries = array();
foreach ($this->cemeteryList as $cemetery) {
$name = addslashes($cemetery->getName());
$url = addslashes($cemetery->getURL());
$googleMapUrl = addslashes($cemetery->getGoogleMapURL());
$cemeteries[] = "
{ \"id\":\"{$cemetery->getId()}\",
\"name\":\"$name\",
\"url\":\"$url\",
\"googleMapUrl\":\"$googleMapUrl\"
}
";
}
$cemeteries = implode(',',$cemeteries);
echo "[$cemeteries]";

View File

@ -0,0 +1,23 @@
<?php
/**
* @copyright 2010-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Cemetery $this->cemetery
*/
$sections = [];
foreach ($this->cemetery->getSections() as $section) {
$sections[] = [
'id' => $section->getId(),
'code' => $section->getCode(),
'name' => $section->getName()
];
}
$cemetery = [
'id' => $this->cemetery->getId(),
'name' => $this->cemetery->getName(),
'sections'=> $sections
];
echo json_encode($cemetery);

View File

@ -0,0 +1,17 @@
<?php
/**
* @copyright 2010-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Zend\Db\Result $this->cemeteries
*/
$cemeteries = [];
foreach ($this->cemeteries as $c) {
$cemeteries[] = [
'id' => $c->getId(),
'name' => $c->getName(),
'url' => $c->getUrl(),
'googleMapUrl' => $c->getGoogleMapURL()
];
}
echo json_encode($cemeteries);

View File

@ -1,11 +1,14 @@
<cemeteries>
<?php <?php
/** /**
* @copyright 2010 City of Bloomington, Indiana * @copyright 2010-2014 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt * @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov> * @author Cliff Ingham <inghamn@bloomington.in.gov>
* @param Zend\Db\Result $this->cemeteries
*/ */
foreach ($this->cemeteryList as $cemetery) { use Blossom\Classes\View;
echo '<cemeteries>';
foreach ($this->cemeteries as $cemetery) {
$name = View::escape($cemetery->getName()); $name = View::escape($cemetery->getName());
$url = View::escape($cemetery->getURL()); $url = View::escape($cemetery->getURL());
$googleMapUrl = View::escape($cemetery->getGoogleMapURL()); $googleMapUrl = View::escape($cemetery->getGoogleMapURL());
@ -17,5 +20,4 @@ foreach ($this->cemeteryList as $cemetery) {
</cemetery> </cemetery>
"; ";
} }
?> echo '</cemeteries>';
</cemeteries>

View File

@ -1,213 +0,0 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class Cemetery
{
private $id;
private $name;
private $googleMapURL;
/**
* Populates the object with data
*
* Passing in an associative array of data will populate this object without
* hitting the database.
*
* Passing in a scalar will load the data from the database.
* This will load all fields in the table as properties of this class.
* You may want to replace this with, or add your own extra, custom loading
*
* @param int|array $id
*/
public function __construct($id=null)
{
if ($id) {
if (is_array($id)) {
$result = $id;
}
else {
$zend_db = Database::getConnection();
if (ctype_digit($id)) {
$sql = 'select * from cemeteries where id=?';
}
else {
$sql = 'select * from cemeteries where name=?';
}
$result = $zend_db->fetchRow($sql,array($id));
}
if ($result) {
foreach ($result as $field=>$value) {
if ($value) {
$this->$field = $value;
}
}
}
else {
throw new Exception('cemeteries/unknownCemetery');
}
}
else {
// This is where the code goes to generate a new, empty instance.
// Set any default values for properties that need it here
}
}
/**
* Throws an exception if anything's wrong
* @throws Exception $e
*/
public function validate()
{
// Check for required fields here. Throw an exception if anything is missing.
if (!$this->name) {
throw new Exception('missingName');
}
}
/**
* Saves this record back to the database
*/
public function save()
{
$this->validate();
$data = array();
$data['name'] = $this->name;
$data['googleMapURL'] = $this->googleMapURL ? $this->googleMapURL : null;
if ($this->id) {
$this->update($data);
}
else {
$this->insert($data);
}
}
private function update($data)
{
$zend_db = Database::getConnection();
$zend_db->update('cemeteries',$data,"id='{$this->id}'");
}
private function insert($data)
{
$zend_db = Database::getConnection();
$zend_db->insert('cemeteries',$data);
$this->id = $zend_db->lastInsertId('cemeteries','id');
}
//----------------------------------------------------------------
// Generic Getters
//----------------------------------------------------------------
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return string
*/
public function getGoogleMapURL()
{
return $this->googleMapURL;
}
//----------------------------------------------------------------
// Generic Setters
//----------------------------------------------------------------
/**
* @param string $string
*/
public function setName($string)
{
$this->name = trim($string);
}
/**
* @param string $string
*/
public function setGoogleMapURL($string)
{
$this->googleMapURL = trim($string);
}
//----------------------------------------------------------------
// Custom Functions
// We recommend adding all your custom code down here at the bottom
//----------------------------------------------------------------
public function __toString()
{
return $this->name;
}
/**
* Returns all the available sections for this cemetery
*
* @return array
*/
public function getSections()
{
return new SectionList(array('cemetery_id'=>$this->id));
}
/**
* @return URL
*/
public function getURL()
{
return new URL(BASE_URL.'/cemeteries/viewCemetery.php?cemetery_id='.$this->id);
}
private function getMapDirectory()
{
return 'images/cemeteries/'.$this->id;
}
/**
* Returns the URL to the map image for this cemetery
*
* Available map types are:
* full, thumb - for the main map
*
* @return string
*/
public function getMap($type="full")
{
$imageDir = "images/cemeteries/{$this->id}";
$filename = $type=='full' ? 'map' : 'map_thumb';
$glob = glob(APPLICATION_HOME."/html/$imageDir/$filename.*");
if (count($glob)) {
$filename = basename($glob[0]);
return BASE_URL."/$imageDir/$filename";
}
}
/**
* @param array|string $file Either an entry from $_FILES or a path to a file
*/
public function saveMap($file,$type)
{
$imageDir = $this->getMapDirectory();
$name = $type=='full' ? 'map' : 'map_thumb';
$directory = APPLICATION_HOME."/html/$imageDir";
Map::saveFile($directory,$file,$name);
}
}

View File

@ -1,87 +0,0 @@
<?php
/**
* A collection class for Cemetery objects
*
* This class creates a zend_db select statement.
* ZendDbResultIterator handles iterating and paginating those results.
* As the results are iterated over, ZendDbResultIterator will pass each desired
* row back to this class's loadResult() which will be responsible for hydrating
* each Cemetery object
*
* 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/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
class CemeteryList extends ZendDbResultIterator
{
/**
* Creates a basic select statement for the collection.
*
* Populates the collection if you pass in $fields
* Setting itemsPerPage turns on pagination mode
* In pagination mode, this will only load the results for one page
*
* @param array $fields
* @param int $itemsPerPage Turns on Pagination
* @param int $currentPage
*/
public function __construct($fields=null,$itemsPerPage=null,$currentPage=null)
{
parent::__construct($itemsPerPage,$currentPage);
if (is_array($fields)) {
$this->find($fields);
}
}
/**
* Populates the collection
*
* @param array $fields
* @param string|array $order Multi-column sort should be given as an array
* @param int $limit
* @param string|array $groupBy Multi-column group by should be given as an array
*/
public function find($fields=null,$order='name',$limit=null,$groupBy=null)
{
$this->select->from('cemeteries');
// Finding on fields from the cemeteries table is handled here
if (count($fields)) {
foreach ($fields as $key=>$value) {
$this->select->where("$key=?",$value);
}
}
// Finding on fields from other tables requires joining those tables.
// You can handle fields from other tables by adding the joins here
// If you add more joins you probably want to make sure that the
// above foreach only handles fields from the cemeteries table.
$this->select->order($order);
if ($limit) {
$this->select->limit($limit);
}
if ($groupBy) {
$this->select->group($groupBy);
}
$this->populateList();
}
/**
* Hydrates all the Cemetery objects from a database result set
*
* This is a callback function, called from ZendDbResultIterator. It is
* called once per row of the result.
*
* @param int $key The index of the result row to load
* @return Cemetery
*/
protected function loadResult($key)
{
return new Cemetery($this->result[$key]);
}
}

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -1,4 +1,4 @@
#panel-container { width:100%; overflow:auto; padding-left:10px; } #panel-container { overflow:auto; padding-left:10px; }
#panel-one { width:490px; float:right; padding-left:10px; } #panel-one { width:490px; float:right; padding-left:10px; }
#content-panel { margin-right:495px; border-right:1px solid #999999; width:470px; } #content-panel { margin-right:495px; border-right:1px solid #999999; width:470px; }
#panel-two { clear:right; width:100%; } #panel-two { clear:right; width:100%; }

View File

@ -3,10 +3,10 @@
*/ */
body { font-family:sans-serif; } body { font-family:sans-serif; }
h2 { font-size:131%; font-weight:bold; margin:.5em 0; color:#036; } h2 { font-size:131%; margin:15px 0; color:#036; border-bottom:1px solid #bdbdbd}
h3 { font-size:123.1%; font-weight:bold; margin:.5em 0 .25em 0; } h3 { font-size:123.1%; font-weight:bold; margin:.5em 0 .25em 0; }
h4 { font-size:100%; font-weight:bold; } h4 { font-size:100%; font-weight:bold; }
a { text-decoration:none; color:#00f; } a { text-decoration:none; color:#06c; }
p { margin:0 .5em .5em .5em; } p { margin:0 .5em .5em .5em; }
table { margin:0 .5em .5em .5em; } table { margin:0 .5em .5em .5em; }
@ -36,10 +36,19 @@ button, .button {
/** /**
* Banner * Banner
*/ */
header { color:#fff; background-color:#036; margin:0; } header {
color:#fff; background-color:#036; margin:0;
height:126px; background:url('images/banner.png') top left no-repeat;
}
header a { color:#fff; font-weight:bold; } header a { color:#fff; font-weight:bold; }
header h1 { margin:0 4px; font-size:174%; } header h1 { margin:0 16px; font-size:110%; padding-top:90px; }
header div { margin:4px; } header div { margin:4px; }
header #location_name {
position:absolute; top:20px; left:8px;
width:304px; height:68px;
background:url('images/logo_with_text.png') top left no-repeat;
}
header #location_name a { display:block; text-indent:-9999px; }
header nav { header nav {
margin-top:5px; padding:5px; margin-top:5px; padding:5px;
background-color:#fff; background-color:#fff;
@ -47,7 +56,9 @@ header nav {
} }
header nav a { font-weight:bold; color:black; margin-right:1em; } header nav a { font-weight:bold; color:black; margin-right:1em; }
#utilityBar { float:right; width:50%; text-align:right; } #utilityBar { float:right; width:50%; text-align:right; }
#utilityBar li { display:inline; margin-right:1em; color:white; } #utilityBar li { display:inline; margin-right:1em; color:black; }
#utilityBar a { color:black; }
/** /**
* Side Panel * Side Panel
@ -57,13 +68,7 @@ header nav a { font-weight:bold; color:black; margin-right:1em; }
border-radius:10px; border-radius:10px;
overflow:hidden; overflow:hidden;
} }
#panel-one h2 {
background-color:#36c; color:#fff;
border-bottom:2px solid #000;
margin:0; padding:.25em;
}
#panel-one ul { margin:.25em; padding:0; } #panel-one ul { margin:.25em; padding:0; }
#panel-one a { font-weight:bold; color:#000; }
/** /**
* Main Content * Main Content

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 184 KiB

After

Width:  |  Height:  |  Size: 184 KiB

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View File

@ -1,2 +1,4 @@
<?php <?php
echo $this->includeBlocks(); header('Content-type: text/json; charset=utf-8');
include BLOSSOM.'/errorMessages.php';
echo $this->includeBlocks();

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?php <?php
echo $this->includeBlocks(); header('Content-type: application/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo $this->includeBlocks();