* @access public
* @return array events
*/
- public function getModelEventsData( $categoryId = null, $limit = null, $memberId = null, $amenityId = null, $venueId = null )
+ public function getModelEventsData( $categoryId = null, $limit = null, $memberId = null, $amenityId = null, $venueId = null, $cityId = null )
{
$this->postAddTimes = true;
)
)";
}
+
+ // check for city id in event list search
+ if ( $cityId = filter_var( $cityId, FILTER_VALIDATE_INT ) ) {
+ $whereParts[] = "
+ T.id IN (
+ SELECT event
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations
+ WHERE city = {$cityId}
+ AND event IN (
+ SELECT event
+ FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times AS ET
+ WHERE status = " . $this->config['status_numb']['Active'] . "
+ AND " . $this->dateRange . "
+ )
+ )";
+ }
if ( $venueId = filter_var( $venueId, FILTER_VALIDATE_INT ) ) {
$whereParts[] = "
$amenityId = null;
$amenities = array();
$memberId = null;
+ $cityId = null;
$members = array();
$venues = array();
$venueId = null;
$groupByDay = true;
$groupMonth = false;
+
+ // get list cities to search by
+ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataEvents.php';
+ $cities = new GlmDataEvents($this->wpdb, $this->config);
+ $cityData = $cities->getEventsCities(true);
+
// If there's a pageslug as attribute then update the pageSlug
if ( isset ( $actionData['request']['pageslug'] ) ) {
$pageSlug = $actionData['request']['pageslug'];
$search = true;
$action = 'event-list';
}
+ if ( isset( $_REQUEST['city'] ) && $cityId = filter_var( $_REQUEST['city'], FILTER_VALIDATE_INT ) ) {
+ $search = true;
+ $action = 'event-list';
+ }
if ( isset( $_REQUEST['venue'] ) && $venueId = filter_var( $_REQUEST['venue'], FILTER_VALIDATE_INT ) ) {
$search = true;
$action = 'event-list';
);
wp_enqueue_script('event-dashboard-js');
wp_enqueue_style('jquery-style', '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
-
+
+
switch ( $action ) {
case 'front-page':
$this->postAddRecurrences = true;
case 'event-list':
$this->postAddLocations = true;
$this->postAddRecurrences = true;
- $events = $this->getModelEventsData( $categoryId, null, $memberId, $amenityId, $venueId );
+ $events = $this->getModelEventsData( $categoryId, null, $memberId, $amenityId, $venueId, $cityId );
if ( !$view ) {
$view = 'agenda.html';
}
$this->postAddRecurrences = false;
break;
}
-
+
// group the events by the starting date
$eventsByDate = $mainEvents = array();
$eventCounter = 0;
}
$json_months = json_encode($months);
ksort($months);
-
+
+
// Compile template data
$templateData = array(
'eventDays' => $eventDays,
'amenityId' => $amenityId,
'amenities' => $amenities,
'memberId' => $memberId,
+ 'cities' => $cityData,
'members' => $members,
'venues' => $venues,
'venueId' => $venueId,