From: Steve Sutton Date: Thu, 26 Jun 2014 20:25:56 +0000 (-0400) Subject: update the text for searching in... X-Git-Tag: v1.1^2~2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=146ac71e308e6e1119926e6bd24c09fc85bd4f58;p=web%2FMichiganTrailMaps.git update the text for searching in... if the filters are given then output it as filtered by; then comma separated all filters --- diff --git a/Toolkit/Members/SearchDisplay.php b/Toolkit/Members/SearchDisplay.php index c843865..6880f43 100644 --- a/Toolkit/Members/SearchDisplay.php +++ b/Toolkit/Members/SearchDisplay.php @@ -30,21 +30,31 @@ class Toolkit_Members_SearchDisplay { private $_searchTerms; + private $_filters; public function __construct(PDO $dbh) { $this->_searchTerms = new ArrayObject(); + $this->_filters = new ArrayObject(); $posted = filter_var_array( $_REQUEST, array( - 'member_name' => FILTER_SANITIZE_STRING, - 'activityId' => FILTER_VALIDATE_INT, - 'destinationId' => FILTER_VALIDATE_INT, - 'parkId' => FILTER_VALIDATE_INT, - 'regionId' => FILTER_VALIDATE_INT, - 'countyId' => FILTER_VALIDATE_INT, - 'cityId' => FILTER_VALIDATE_INT, - 'amenity' => array( + 'member_name' => FILTER_SANITIZE_STRING, + 'activityId' => FILTER_VALIDATE_INT, + 'destinationId' => FILTER_VALIDATE_INT, + 'parkId' => FILTER_VALIDATE_INT, + 'regionId' => FILTER_VALIDATE_INT, + 'countyId' => FILTER_VALIDATE_INT, + 'cityId' => FILTER_VALIDATE_INT, + 'amenity' => array( + 'filter' => FILTER_VALIDATE_INT, + 'flags' => FILTER_FORCE_ARRAY + ), + 'filterActivity' => array( + 'filter' => FILTER_VALIDATE_INT, + 'flags' => FILTER_FORCE_ARRAY + ), + 'filterParks' => array( 'filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_FORCE_ARRAY ) @@ -83,7 +93,21 @@ class Toolkit_Members_SearchDisplay foreach ($amenity as $amm) { $amenities[] = $this->getAmenityName($dbh, $amm); } - $this->_searchTerms->offsetSet('amenity', $amenities); + $this->_filters->offsetSet('amenity', $amenities); + } + if (!empty($filterActivity) && $filterActivity[0]) { + $activityFilter = array(); + foreach ($filterActivity as $catId) { + $activityFilter[] = $this->getCategoryName($dbh, $catId); + } + $this->_filters->offsetSet('activities', $activityFilter); + } + if (!empty($filterParks) && $filterParks[0]) { + $parkFilter = array(); + foreach ($filterParks as $catId) { + $parkFilter[] = $this->getCategoryName($dbh, $catId); + } + $this->_filters->offsetSet('parks', $parkFilter); } } @@ -137,6 +161,17 @@ class Toolkit_Members_SearchDisplay } } + if (count($this->_filters) > 0) { + $html .= '
Filtered by '; + $fCount = 0; + foreach ($this->_filters as $filters) { + if ($fCount > 0) { + $html .= ', '; + } + $html .= implode(', ', $filters); + $fCount++; + } + } return $html; } diff --git a/Toolkit/Members/templates/userSearchForm.html b/Toolkit/Members/templates/userSearchForm.html index 762603c..a295720 100644 --- a/Toolkit/Members/templates/userSearchForm.html +++ b/Toolkit/Members/templates/userSearchForm.html @@ -329,6 +329,9 @@ '; + } if ($activity = filter_var($_REQUEST['activityId'], FILTER_VALIDATE_INT)) { echo ''; }