The interment list is now sortable
git-svn-id: https://rosehill.googlecode.com/svn/branches/php@26 100bd78a-fc82-11de-b5bc-ffd2847a4b57
This commit is contained in:
parent
4f5971b522
commit
31dad3a967
|
@ -4,7 +4,10 @@
|
|||
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
|
||||
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
||||
* @param IntermentList $this->intermentList
|
||||
* @param GET sort
|
||||
*/
|
||||
$previousSort = isset($_GET['sort']) ? $_GET['sort'] : 'deceasedDate';
|
||||
$url = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
|
||||
?>
|
||||
<div class="interfaceBox">
|
||||
<h1>
|
||||
|
@ -22,9 +25,21 @@
|
|||
<table>
|
||||
<thead>
|
||||
<tr><th></th>
|
||||
<th>Last Name</th>
|
||||
<th>First Name</th>
|
||||
<th>Date of Death</th>
|
||||
<th><?php
|
||||
$url->sort = $previousSort=='lastname' ? 'lastname desc' : 'lastname';
|
||||
echo "<a href=\"$url\" class=\"sorting\">Last Name</a>";
|
||||
?>
|
||||
</th>
|
||||
<th><?php
|
||||
$url->sort = $previousSort=='firstname' ? 'firstname desc' : 'firstname';
|
||||
echo "<a href=\"$url\" class=\"sorting\">First Name</a>";
|
||||
?>
|
||||
</th>
|
||||
<th><?php
|
||||
$url->sort = $previousSort=='deceasedDate' ? 'deceasedDate desc' : 'deceasedDate';
|
||||
echo "<a href=\"$url\" class=\"sorting\">Date of Death</a>";
|
||||
?>
|
||||
</th>
|
||||
<th>Cemetery</th>
|
||||
<th>Section & Lot</th>
|
||||
</tr>
|
||||
|
|
|
@ -28,13 +28,18 @@ class IntermentList extends ZendDbResultIterator
|
|||
* @param int $itemsPerPage Turns on Pagination
|
||||
* @param int $currentPage
|
||||
*/
|
||||
public function __construct($fields=null,$itemsPerPage=null,$currentPage=null)
|
||||
public function __construct($fields=null,$order=null,$itemsPerPage=null,$currentPage=null)
|
||||
{
|
||||
parent::__construct($itemsPerPage,$currentPage);
|
||||
if (is_array($fields)) {
|
||||
if ($order) {
|
||||
$this->find($fields,$order);
|
||||
}
|
||||
else {
|
||||
$this->find($fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the collection
|
||||
|
@ -44,7 +49,7 @@ class IntermentList extends ZendDbResultIterator
|
|||
* @param int $limit
|
||||
* @param string|array $groupBy Multi-column group by should be given as an array
|
||||
*/
|
||||
public function find($fields=null,$order='id',$limit=null,$groupBy=null)
|
||||
public function find($fields=null,$order='deceasedDate',$limit=null,$groupBy=null)
|
||||
{
|
||||
$this->select->from('interments');
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ foreach ($_GET as $field=>$value) {
|
|||
}
|
||||
|
||||
if (count($search)) {
|
||||
$intermentList = new IntermentList($search,20,$currentPage);
|
||||
$order = isset($_GET['sort']) ? $_GET['sort'] : null;
|
||||
$intermentList = new IntermentList($search,$order,20,$currentPage);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
.pageNavigation ul{ display:inline; }
|
||||
.pageNavigation li { padding-left:5px; }
|
||||
|
||||
|
||||
.searchInterment th {text-align:left; width:75px; }
|
||||
.searchInterment th { text-align:left; width:75px; }
|
||||
|
||||
table { margin:8px 0; overflow:auto; }
|
||||
tr { }
|
||||
|
@ -31,3 +30,5 @@ tbody th {
|
|||
}
|
||||
th a:link,th a:visited { color:#3366cc; background-color:inherit; }
|
||||
form table { border:none; }
|
||||
|
||||
a.sorting { }
|
Loading…
Reference in New Issue