From 31dad3a967e2966fd49ab85e30a2acd28c87b213 Mon Sep 17 00:00:00 2001 From: inghamn Date: Wed, 6 Jan 2010 15:34:36 +0000 Subject: [PATCH] The interment list is now sortable git-svn-id: https://rosehill.googlecode.com/svn/branches/php@26 100bd78a-fc82-11de-b5bc-ffd2847a4b57 --- blocks/html/interments/intermentList.inc | 21 ++++++++++++++++++--- classes/IntermentList.php | 11 ++++++++--- html/interments/home.php | 3 ++- html/skins/local/screen.css | 7 ++++--- 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/blocks/html/interments/intermentList.inc b/blocks/html/interments/intermentList.inc index 779ccef..8798af6 100644 --- a/blocks/html/interments/intermentList.inc +++ b/blocks/html/interments/intermentList.inc @@ -4,7 +4,10 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt * @author Cliff Ingham * @param IntermentList $this->intermentList + * @param GET sort */ +$previousSort = isset($_GET['sort']) ? $_GET['sort'] : 'deceasedDate'; +$url = new URL($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); ?>

@@ -22,9 +25,21 @@ - - - + + + diff --git a/classes/IntermentList.php b/classes/IntermentList.php index 7b320d4..e59c527 100644 --- a/classes/IntermentList.php +++ b/classes/IntermentList.php @@ -28,11 +28,16 @@ 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)) { - $this->find($fields); + if ($order) { + $this->find($fields,$order); + } + else { + $this->find($fields); + } } } @@ -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'); diff --git a/html/interments/home.php b/html/interments/home.php index e530ae4..6d2c613 100644 --- a/html/interments/home.php +++ b/html/interments/home.php @@ -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); } diff --git a/html/skins/local/screen.css b/html/skins/local/screen.css index eec4544..0549ec5 100644 --- a/html/skins/local/screen.css +++ b/html/skins/local/screen.css @@ -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 { } @@ -30,4 +29,6 @@ tbody th { height:8pt; padding:4px 4px 2px 2px; } th a:link,th a:visited { color:#3366cc; background-color:inherit; } -form table { border:none; } \ No newline at end of file +form table { border:none; } + +a.sorting { } \ No newline at end of file
Last NameFirst NameDate of Deathsort = $previousSort=='lastname' ? 'lastname desc' : 'lastname'; + echo "Last Name"; + ?> + sort = $previousSort=='firstname' ? 'firstname desc' : 'firstname'; + echo "First Name"; + ?> + sort = $previousSort=='deceasedDate' ? 'deceasedDate desc' : 'deceasedDate'; + echo "Date of Death"; + ?> + Cemetery Section & Lot