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
)
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);
}
}
}
}
+ if (count($this->_filters) > 0) {
+ $html .= '<br>Filtered by ';
+ $fCount = 0;
+ foreach ($this->_filters as $filters) {
+ if ($fCount > 0) {
+ $html .= ', ';
+ }
+ $html .= implode(', ', $filters);
+ $fCount++;
+ }
+ }
return $html;
}