Editing Deeds should be working now

git-svn-id: https://rosehill.googlecode.com/svn/trunk@53 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
inghamn 2010-01-26 18:42:34 +00:00
parent 2db2e54062
commit c6651e9260
5 changed files with 176 additions and 106 deletions

View File

@ -1,6 +1,6 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @copyright 2009-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>
*/
@ -9,41 +9,9 @@
<form method="post" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>">
<fieldset><legend>Deed Info</legend>
<table>
<tr><td><label for="deed-section">Section</label></td>
<td><input name="deed[section]" id="deed-section" size="3" />
<label for="deed-lot">Lot</label>
<input name="deed[lot]" id="deed-lot" />
</td>
</tr>
<tr><td><label for="deed-firstname1">Owner 1</label></td>
<td><label for="deed-firstname1">First</label>
<input name="deed[firstname1]" id="deed-firstname1" />
<label for="deed-middleInitial1">MI</label>
<input name="deed[middleInitial1]" id="deed-middleInitial1" size="1" maxlength="1" />
<label for="deed-lastname1">Last</label>
<input name="deed[lastname1]" id="deed-lastname1" />
</td>
</tr>
<tr><td><label for="deed-firstname2">Owner 2</label></td>
<td><label for="deed-firstname2">First</label>
<input name="deed[firstname2]" id="deed-firstname2" />
<label for="deed-middleInitial2">MI</label>
<input name="deed[middleInitial2]" id="deed-middleInitial2" size="1" maxlength="1" />
<label for="deed-lastname2">Last</label>
<input name="deed[lastname2]" id="deed-lastname2" />
</td>
</tr>
<tr><td><label for="deed-issueDate">Date Issued</label></td>
<td><input name="deed[issueDate]" size="10" /></td>
</tr>
<tr><td><label for="deed-cemetery_id">Cemetery</label></td>
<td><select name="deed[cemetery_id]" id="deed-cemetery_id">
<td><select name="deed[cemetery_id]" id="deed-cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'deed-section_id','<?php echo BASE_URL; ?>')">
<option></option>
<?php
$list = new CemeteryList();
@ -56,14 +24,49 @@
</select>
</td>
</tr>
<tr><td><label for="deed-section_id">Section</label></td>
<td><select name="deed[section_id]" id="deed-section_id">
<option></option>
</select>
<label for="deed-lot">Lot</label>
<input name="deed[lot]" id="deed-lot" />
</td>
</tr>
<tr><td><label for="deed-issueDate">Date Issued</label></td>
<td><input name="deed[issueDate]" size="10" /></td>
</tr>
<tr><td><label for="deed-notes">notes</label></td>
<td><textarea name="deed[notes]" id="deed-notes" rows="3" cols="60"></textarea>
</td>
</tr>
</table>
</fieldset>
<fieldset><legend>Owner 1</legend>
<table>
<tr><td><label for="deed-firstname1">First</label></td>
<td><input name="deed[firstname1]" id="deed-firstname1" /></td>
</tr>
<tr><td><label for="deed-middleInitial1">MI</label></td>
<td><input name="deed[middleInitial1]" id="deed-middleInitial1" size="1" maxlength="1" />
</td>
</tr>
<tr><td><label for="deed-lastname1">Last</label></td>
<td><input name="deed[lastname1]" id="deed-lastname1" /></td>
</tr>
</table>
</fieldset>
<fieldset><legend>Owner 2</legend>
<table>
<tr><td><label for="deed-firstname2">First</label></td>
<td><input name="deed[firstname2]" id="deed-firstname2" /></td>
</tr>
<tr><td><label for="deed-middleInitial2">MI</label></td>
<td><input name="deed[middleInitial2]" id="deed-middleInitial2" size="1" maxlength="1" />
</td>
</tr>
<tr><td><label for="deed-lastname2">Last</label></td>
<td><input name="deed[lastname2]" id="deed-lastname2" /></td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>

View File

@ -1,6 +1,6 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @copyright 2009-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>
*/
@ -8,15 +8,6 @@
<form method="get" action="<?php echo BASE_URL; ?>/deeds">
<fieldset><legend>Search Deeds</legend>
<table>
<tr><td><label for="section">Section</label></td>
<td><input name="section" id="section" size="3"
value="<?php echo isset($_GET['section']) ? View::escape($_GET['section']) : ''; ?>" />
<label for="lot">Lot</label>
<input name="lot" id="lot" size="3"
value="<?php echo isset($_GET['lot']) ? View::escape($_GET['lot']) : ''; ?>" />
</td>
</tr>
<tr><td><label for="firstname">Owner</label></td>
<td><label for="firstname">Firstname</label>
<input name="firstname" id="firstname"
@ -28,8 +19,9 @@
</tr>
<tr><td><label for="cemetery_id">Cemetery</label></td>
<td><select name="cemetery_id" id="cemetery_id">
<option></option>
<td><select name="cemetery_id" id="cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'section_id','<?php echo BASE_URL; ?>')">
<option value="">Any Cemetery</option>
<?php
$list = new CemeteryList();
$list->find();
@ -44,6 +36,37 @@
</select>
</td>
</tr>
<tr><td><label for="section_id">Section</label></td>
<td><select name="section_id" id="section_id">
<option value="">Any Section</option>
<?php
if (isset($_GET['cemetery_id'])) {
try {
$cemetery = new Cemetery($_GET['cemetery_id']);
foreach ($cemetery->getSections() as $section) {
$name = $section->getName()
? View::escape($section->getName())
: View::escape($section->getCode());
$selected = (isset($_GET['section_id']) && $_GET['section_id']==$section->getId())
? 'selected="selected"'
: '';
echo "<option value=\"{$section->getId()}\" $selected>$name</option>";
}
}
catch (Exception $e) {
}
}
else {
$id = View::escape($_GET['section_id']);
echo "<option value=\"$id\" selected=\"selected\">$id</option>";
}
?>
</select>
<label for="lot">Lot</label>
<input name="lot" id="lot" size="3"
value="<?php echo isset($_GET['lot']) ? View::escape($_GET['lot']) : ''; ?>" />
</td>
</tr>
</table>
<button type="submit" class="search">Search</button>

View File

@ -1,6 +1,6 @@
<?php
/**
* @copyright 2009 City of Bloomington, Indiana
* @copyright 2009-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 Deed $this->deed
@ -11,51 +11,9 @@
<fieldset><legend>Deed Info</legend>
<input name="deed_id" type="hidden" value="<?php echo $this->deed->getId(); ?>" />
<table>
<tr><td><label for="deed-section">Section</label></td>
<td><input name="deed[section]" id="deed-section" size="3"
value="<?php echo View::escape($this->deed->getSection()); ?>" />
<label for="deed-lot">Lot</label>
<input name="deed[lot]" id="deed-lot" size="3"
value="<?php echo View::escape($this->deed->getLot()); ?>" />
</td>
</tr>
<tr><td><label for="deed-firstname1">Owner 1</label></td>
<td><label for="deed-firstname1">First</label>
<input name="deed[firstname1]" id="deed-firstname1"
value="<?php echo View::escape($this->deed->getFirstname1()); ?>" />
<label for="deed-middleInitial1">MI</label>
<input name="deed[middleInitial1]" id="deed-middleInitial1"
size="1" maxlength="1"
value="<?php echo View::escape($this->deed->getMiddleInitial1()); ?>" />
<label for="deed-lastname1">Last</label>
<input name="deed[lastname1]" id="deed-lastname1"
value="<?php echo View::escape($this->deed->getLastname1()); ?>" />
</td>
</tr>
<tr><td><label for="deed-firstname2">Owner 2</label></td>
<td><label for="deed-firstname2">First</label>
<input name="deed[firstname2]" id="deed-firstname2"
value="<?php echo View::escape($this->deed->getFirstname2()); ?>" />
<label for="deed-middleInitial2">MI</label>
<input name="deed[middleInitial2]" id="deed-middleInitial2"
size="1" maxlength="1"
value="<?php echo View::escape($this->deed->getMiddleInitial2()); ?>" />
<label for="deed-lastname2">Last</label>
<input name="deed[lastname2]" id="deed-lastname2"
value="<?php echo View::escape($this->deed->getLastname2()); ?>" />
</td>
</tr>
<tr><td><label for="deed-issueDate">Date Issued</label></td>
<td><input name="deed[issueDate]" size="10" value="<?php echo $this->deed->getIssueDate('n/j/Y'); ?>" /></td>
</tr>
<tr><td><label for="deed-cemetery_id">Cemetery</label></td>
<td><select name="deed[cemetery_id]" id="deed-cemetery_id">
<td><select name="deed[cemetery_id]" id="deed-cemetery_id"
onchange="COB.populateSections(this.options[this.selectedIndex].value,'deed-section_id','<?php echo BASE_URL; ?>')">
<option></option>
<?php
$list = new CemeteryList();
@ -71,12 +29,73 @@
</select>
</td>
</tr>
<tr><td><label for="deed-section_id">Section</label></td>
<td><select name="deed[section_id]" id="deed-section_id">
<option></option>
<?php
if ($this->deed->getSection_id()) {
foreach ($this->deed->getCemetery()->getSections() as $section) {
$name = View::escape($section->getCode());
$selected = $section->getId()==$this->deed->getSection_id()
? 'selected="selected"'
: '';
echo "<option value=\"{$section->getId()}\" $selected>$name</option>";
}
}
?>
</select>
<label for="deed-lot">Lot</label>
<input name="deed[lot]" id="deed-lot" size="3"
value="<?php echo View::escape($this->deed->getLot()); ?>" />
</td>
</tr>
<tr><td><label for="deed-issueDate">Date Issued</label></td>
<td><input name="deed[issueDate]" size="10" value="<?php echo $this->deed->getIssueDate('n/j/Y'); ?>" /></td>
</tr>
<tr><td><label for="deed-notes">notes</label></td>
<td><textarea name="deed[notes]" id="deed-notes" rows="3" cols="60"><?php echo View::escape($this->deed->getNotes()); ?></textarea>
</td>
</tr>
</table>
</fieldset>
<fieldset><legend>Owner 1</legend>
<table>
<tr><td><label for="deed-firstname1">First</label></td>
<td><input name="deed[firstname1]" id="deed-firstname1"
value="<?php echo View::escape($this->deed->getFirstname1()); ?>" />
</td>
</tr>
<tr><td><label for="deed-middleInitial1">MI</label></td>
<td><input name="deed[middleInitial1]" id="deed-middleInitial1"
size="1" maxlength="1"
value="<?php echo View::escape($this->deed->getMiddleInitial1()); ?>" />
</td>
</tr>
<tr><td><label for="deed-lastname1">Last</label></td>
<td><input name="deed[lastname1]" id="deed-lastname1"
value="<?php echo View::escape($this->deed->getLastname1()); ?>" />
</td>
</tr>
</table>
</fieldset>
<fieldset><legend>Owner 2</legend>
<table>
<tr><td><label for="deed-firstname2">First</label></td>
<td><input name="deed[firstname2]" id="deed-firstname2"
value="<?php echo View::escape($this->deed->getFirstname2()); ?>" />
</td>
</tr>
<tr><td><label for="deed-middleInitial2">MI</label></td>
<td><input name="deed[middleInitial2]" id="deed-middleInitial2"
size="1" maxlength="1"
value="<?php echo View::escape($this->deed->getMiddleInitial2()); ?>" />
</td>
</tr>
<tr><td><label for="deed-lastname2">Last</label></td>
<td><input name="deed[lastname2]" id="deed-lastname2"
value="<?php echo View::escape($this->deed->getLastname2()); ?>" />
</td>
</tr>
</table>
<button type="submit" class="submit">Submit</button>

View File

@ -7,7 +7,7 @@
class Deed
{
private $id;
private $section;
private $section_id;
private $lot;
private $lastname1;
private $firstname1;
@ -20,6 +20,7 @@ class Deed
private $lot2;
private $cemetery_id;
private $section;
private $cemetery;
/**
@ -84,7 +85,7 @@ class Deed
$this->validate();
$data = array();
$data['section'] = $this->section ? $this->section : null;
$data['section_id'] = $this->section_id ? $this->section_id : null;
$data['lot'] = $this->lot ? $this->lot : null;
$data['lastname1'] = $this->lastname1 ? $this->lastname1 : null;
$data['firstname1'] = $this->firstname1 ? $this->firstname1 : null;
@ -131,11 +132,25 @@ class Deed
}
/**
* @return string
* @return int
*/
public function getSection_id()
{
return $this->section_id;
}
/**
* @return Section
*/
public function getSection()
{
return $this->section;
if ($this->section_id) {
if (!$this->section) {
$this->section = new Section($this->section_id);
}
return $this->section;
}
return null;
}
/**
@ -257,11 +272,21 @@ class Deed
//----------------------------------------------------------------
/**
* @param string $string
* @param int $int
*/
public function setSection($string)
public function setSection_id($int)
{
$this->section = trim($string);
$this->section = new Section($int);
$this->section_id = $int;
}
/**
* @param Section $section
*/
public function setSection($section)
{
$this->section_id = $section->getId();
$this->section = $section;
}
/**

View File

@ -9,7 +9,7 @@ $currentPage = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$deedList = new DeedList(null,20,$currentPage);
$knownFields = array('section','lot','cemetery_id','firstname','lastname','middleInitial');
$knownFields = array('section_id','lot','cemetery_id','firstname','lastname','middleInitial');
if (count(array_intersect(array_keys($_GET),$knownFields))) {
$deedList->find($_GET);
}