&& 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 = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
+ array_unshift($stack, $anchor);
+ }
+
if ($hasPhotoGalleriesOnThisPage) {
if (!$catid = filter_var($_GET['catid'], FILTER_VALIDATE_INT)) {
throw new RuntimeException('Invalid catid');
}
$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']);
$(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);
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');
$("#trail_information_btn").addClass('current');
$("#trail_information").css('display', 'block');
}
-}
\ No newline at end of file
+}
<option value="">Activity</option>
<?php foreach($t->activitySearch as $id => $label) {
echo '<option
- value="'.$id.'"'.(($_REQUEST['activityId'] == $id)?' selected':'').'>
+ value="'.$id.'">
'.$label.'</option>';
}?>
</select>
<option value="">Park</option>
<?php foreach($t->parkSearch as $id => $label) {
echo '<option
- value="'.$id.'"'.(($_REQUEST['parkId'] == $id)?' selected':'').'>
- '.$label.'</option>';
- }?>
- </select>
- <select
- name="regionId"
- id="region"
- flexy:if="regionSearch">
- <option value="">Region</option>
- <?php foreach($t->regionSearch as $id => $label) {
- echo '<option
- value="'.$id.'"'.(($_REQUEST['regionId'] == $id)?' selected':'').'>
+ value="'.$id.'">
'.$label.'</option>';
}?>
</select>
<option value="">County</option>
<?php foreach($t->countySearch as $id => $label) {
echo '<option
- value="'.$id.'"'.(($_REQUEST['countyId'] == $id)?' selected':'').'>
+ value="'.$id.'">
'.$label.'</option>';
}?>
</select>
- <input type="submit" name="submit" value="submit">
</form>
</div><!--/#findatrail-->
<div id="action">