From 129b263023cb8385680266abb3616956b12893b7 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 4 Feb 2019 13:22:10 -0500 Subject: [PATCH] Adding city and region into search Taking most of this from the wmta theme and how it is showing the city in search. --- models/front/events/list.php | 14 +++++++-- views/front/events/searchForm.html | 50 +++++++++++++++++++++++++----- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/models/front/events/list.php b/models/front/events/list.php index 1cdb17b..58a6384 100644 --- a/models/front/events/list.php +++ b/models/front/events/list.php @@ -78,11 +78,16 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction $defaultViewFile = ( $this->config['settings']['default_agenda_view'] ) ? $this->config['settings']['default_agenda_view'] . '.html' : 'agenda.html'; - // get list cities to search by - require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php'; - $cities = new GlmDataCities($this->wpdb, $this->config); + // Get list cities to search by + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataCities.php'; + $cities = new GlmDataCities( $this->wpdb, $this->config ); $cityData = $cities->getList( null, 'name' ); + // Get list of regions to search by + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH . '/data/dataRegions.php'; + $regions = new GlmDataRegions( $this->wpdb, $this->config ); + $regionData = $regions->getList( null, 'name' ); + // If there's a pageslug as attribute then update the pageSlug if ( isset ( $actionData['request']['pageslug'] ) ) { $pageSlug = $actionData['request']['pageslug']; @@ -496,6 +501,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction break; } + // echo '
$events: ' . print_r( $events, true) . '
'; // group the events by the starting date $eventsByDate = $mainEvents = array(); $eventCounter = 0; @@ -715,7 +721,9 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction 'amenities' => $amenities, 'memberId' => $memberId, 'cities' => $cityData, + 'regions' => $regionData, 'cityId' => $cityId, + 'regionId' => $regionId, 'members' => $members, 'venues' => $venues, 'venueId' => $venueId, diff --git a/views/front/events/searchForm.html b/views/front/events/searchForm.html index 7390e7f..8d46e3a 100644 --- a/views/front/events/searchForm.html +++ b/views/front/events/searchForm.html @@ -46,7 +46,31 @@ -
+ {if $settings.show_search_city} +
+ +
+ {/if} + {if $settings.show_search_region} +
+ +
+ {/if} +
-
+ {if $settings.show_search_city || $settings.show_search_region} +
+ +
+ {/if} +
{if !$eventId} {else} @@ -67,6 +99,14 @@
+ {if !$settings.show_search_city && !$settings.show_search_region} +
+ +
+ {/if}
@@ -85,12 +125,6 @@ {/if} -
- -