From 528b73035896f39c3d8334493c5868208f2baf12 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 8 Jul 2013 18:48:55 +0000 Subject: [PATCH] Updates on the search form Remove the go button Take out the setting of form selects Remove regions work on adding to breadcrumbs which search your doing --- Toolkit/Template/BreadCrumbs.php | 56 +++++++++++++++++++++++++++++++- libjs/pagefunctions.js | 21 +++++++++--- templates/template.html | 18 ++-------- 3 files changed, 74 insertions(+), 21 deletions(-) diff --git a/Toolkit/Template/BreadCrumbs.php b/Toolkit/Template/BreadCrumbs.php index fb1035b..c884de1 100644 --- a/Toolkit/Template/BreadCrumbs.php +++ b/Toolkit/Template/BreadCrumbs.php @@ -74,6 +74,60 @@ class Toolkit_Template_BreadCrumbs && filter_var($_GET['photo_catid'], FILTER_VALIDATE_INT) ); + $activityId = filter_var($_REQUEST['activityId'], FILTER_VALIDATE_INT); + $parkId = filter_var($_REQUEST['parkId'], FILTER_VALIDATE_INT); + $countyId = filter_var($_REQUEST['countyId'], FILTER_VALIDATE_INT); + $hasSearch = ($activityId || $parkId || $countyId); + + if ($hasSearch) { + // add search type Activity, Park or County + $catid = filter_var($_GET['catid'], FILTER_VALIDATE_INT); + // get activity or park + try { + $dbh = Toolkit_Database::getInstance(); + if ($activityId) { + $sql = " + SELECT name + FROM members.category + WHERE category_id = :id"; + $stmt = $dbh->prepare($sql); + $stmt->bindParam(':id', $activityId, PDO::PARAM_INT); + $searchParam = $stmt->fetchColumn(); + $searchParam .= ' Activity'; + } else if ($parkId) { + $sql = " + SELECT name + FROM members.category + WHERE category_id = :id"; + $stmt = $dbh->prepare($sql); + $stmt->bindParam(':id', $parkId, PDO::PARAM_INT); + $searchParam = $stmt->fetchColumn(); + $searchParam .= ' Park'; + } else if ($countyId) { + $sql = " + SELECT county_name + FROM members.county + WHERE county_id = :id"; + $stmt = $dbh->prepare($sql); + $stmt->bindParam(':id', $countyId, PDO::PARAM_INT); + $searchParam = $stmt->fetchColumn(); + $searchParam .= ' County'; + } + $stmt->execute(); + array_unshift($stack, $searchParam); + } catch (PDOException $e) { + Toolkit_Common::handleError($e); + } + $seoUrl = Toolkit_Template_Page::getSeoUrl( + $this->pageGateway, + $catid + ); + // this should be after adding the search type + $page = $this->pageGateway->findNavItem($catid); + $anchor = ''.$page['navigation_name'].''; + array_unshift($stack, $anchor); + } + if ($hasPhotoGalleriesOnThisPage) { if (!$catid = filter_var($_GET['catid'], FILTER_VALIDATE_INT)) { throw new RuntimeException('Invalid catid'); @@ -120,7 +174,7 @@ class Toolkit_Template_BreadCrumbs } $page = $this->pageGateway->findNavItem($id); $isShortcut = filter_var($_REQUEST['t'], FILTER_SANITIZE_STRING); - if ($hasPhotoGalleriesOnThisPage) { + if ($hasPhotoGalleriesOnThisPage || $hasSearch) { // Do Nothing } else { array_unshift($stack, $page['navigation_name']); diff --git a/libjs/pagefunctions.js b/libjs/pagefunctions.js index 82a0bd4..f2113b2 100755 --- a/libjs/pagefunctions.js +++ b/libjs/pagefunctions.js @@ -1,6 +1,17 @@ $(document).ready(function() { + // setup the search form to submit onChange + $("#activity").change(function(){ + $("#findTrail").submit(); + }); + $("#park").change(function(){ + $("#findTrail").submit(); + }); + $("#county").change(function(){ + $("#findTrail").submit(); + }); + currentNav(); - + // Add Click Handlers for the tab buttons. //$("#trail_main_btn").click(function() { // trailTabs(this); @@ -30,21 +41,21 @@ function currentNav() { function trailTabs(clickedLink) { //alert(clickedLink.id); - + // Clear all currents. //$("#trail_main_btn").removeClass('current'); $("#trail_guide_btn").removeClass('current'); $("#trail_facilities_btn").removeClass('current'); $("#trail_directions_btn").removeClass('current'); $("#trail_information_btn").removeClass('current'); - + // Hide all tab content. //$("#top_wrapper").css('display', 'none'); $("#trail_guide").css('display', 'none'); $("#trail_facilities").css('display', 'none'); $("#trail_directions").css('display', 'none'); $("#trail_information").css('display', 'none'); - + // Set this as current. if(clickedLink.id == "trail_guide_btn") { $("#trail_guide_btn").addClass('current'); @@ -59,4 +70,4 @@ function trailTabs(clickedLink) { $("#trail_information_btn").addClass('current'); $("#trail_information").css('display', 'block'); } -} \ No newline at end of file +} diff --git a/templates/template.html b/templates/template.html index 55a09a5..3f3ab3e 100755 --- a/templates/template.html +++ b/templates/template.html @@ -78,7 +78,7 @@ activitySearch as $id => $label) { echo ''; }?> @@ -89,18 +89,7 @@ parkSearch as $id => $label) { echo ''; - }?> - - @@ -111,11 +100,10 @@ countySearch as $id => $label) { echo ''; }?> -
-- 2.17.1