From 7ecee1067b496ccd6333a809116de9f888eaf6a1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 3 May 2017 13:35:12 -0400 Subject: [PATCH] Adding api for shortcode of the bibco search. Adding the bibco search to the api plugin. Adds shorcode to bring in their old search form for dock schedules. --- js/dummy.js | 0 models/front/apis/bibcoCalendar.php | 11 +++++++++++ models/front/apis/bibcoSearch.php | 29 ++++++++++++++++++++++------- setup/shortcodes.php | 12 ++++++------ setup/validActions.php | 1 + views/front/apis/bibcoSearch.html | 1 + 6 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 js/dummy.js create mode 100644 views/front/apis/bibcoSearch.html diff --git a/js/dummy.js b/js/dummy.js new file mode 100644 index 0000000..e69de29 diff --git a/models/front/apis/bibcoCalendar.php b/models/front/apis/bibcoCalendar.php index 21d318f..a611d69 100644 --- a/models/front/apis/bibcoCalendar.php +++ b/models/front/apis/bibcoCalendar.php @@ -54,6 +54,17 @@ class GlmMembersFront_apis_bibcoCalendar // Setup the url. $url = $calendarUrl . 'schedule.php'; + + // Check for $_REQUEST array and put into url + if ( isset( $_REQUEST['dock'] ) ) { + $urlParams[] = 'dock=' . $_REQUEST['dock']; + } + if ( isset( $_REQUEST['departDate'] ) ) { + $urlParams[] = 'departDate=' . $_REQUEST['departDate']; + } + if ( !empty( $urlParams ) ) { + $url .= '?' . implode( '&', $urlParams ); + } $curl = curl_init( $url ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' ); diff --git a/models/front/apis/bibcoSearch.php b/models/front/apis/bibcoSearch.php index c87c57b..1550f46 100644 --- a/models/front/apis/bibcoSearch.php +++ b/models/front/apis/bibcoSearch.php @@ -32,12 +32,6 @@ class GlmMembersFront_apis_bibcoSearch $this->wpdb = $wpdb; $this->config = $config; - //parent::__construct(false, false); - - if ( $this->config['settings']['use_venue_locations'] ) { - $this->getMemberList(); - } - } /** * modelAction @@ -52,14 +46,32 @@ class GlmMembersFront_apis_bibcoSearch $view = 'bibcoSearch'; $settings = array(); $content = ''; - $mainSchedId = false; // Get the options for bibco $bibcoOptions = unserialize( get_option( GLM_MEMBERS_APIS_BIBCO_OPTION_NAME ) ); $calendarUrl = ( isset( $bibcoOptions['calendarUrl'] ) ) ? $bibcoOptions['calendarUrl'] : ''; + // enqueue styles and scripts for the schedule form. + wp_enqueue_style('jquery-ui'); + wp_enqueue_style('plugin_name-admin-ui-css', + 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/cupertino/jquery-ui.css', + false, + '1.0', + false + ); + wp_register_script( + 'glm_api_dummy_script', + GLM_MEMBERS_APIS_PLUGIN_BASE_URL . '/js/dummy.js', + array('jquery-ui-datepicker'), + '1.0', + true + ); + + wp_enqueue_script('glm_api_dummy_script'); + // Setup the url. $url = $calendarUrl . 'scheduleSearch.php'; + $curl = curl_init( $url ); curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true ); curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' ); @@ -67,6 +79,9 @@ class GlmMembersFront_apis_bibcoSearch $content = curl_exec( $curl ); curl_close( $curl ); + // Once you get the content replace ACTION_URL + $content = str_replace( 'ACTION_URL', get_permalink(), $content ); + $templateData = array( 'content' => $content, ); diff --git a/setup/shortcodes.php b/setup/shortcodes.php index 63676aa..e7c05dc 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -120,8 +120,8 @@ $glmMembersApisShortcodes = array( 'menu' => 'apis', 'action' => 'bibcoSearch', 'table' => false, - 'attribute' => array( - 'template' => false + 'attributes' => array( + //'template' => false ) ), ); @@ -143,17 +143,17 @@ $glmMembersApisShortcodesDescription = ' - [glm-members-api-golf-directory] + [glm-members-api-bibco-search]   - Pulls in the Directory for Harbor Point Golf Club + Pulls in the Search for Bibco - [glm-members-api-bibco-search] + [glm-members-api-golf-directory]   - Pulls in the Search for Bibco + Pulls in the Directory for Harbor Point Golf Club '; diff --git a/setup/validActions.php b/setup/validActions.php index ad1fd63..8be2c3b 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -73,6 +73,7 @@ $glmMembersApisAddOnValidActions = array( 'apis' => array( 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG, 'bibcoCalendar' => GLM_MEMBERS_APIS_PLUGIN_SLUG, + 'bibcoSearch' => GLM_MEMBERS_APIS_PLUGIN_SLUG, 'golfclubDirectory' => GLM_MEMBERS_APIS_PLUGIN_SLUG, ), ) diff --git a/views/front/apis/bibcoSearch.html b/views/front/apis/bibcoSearch.html new file mode 100644 index 0000000..d9f1e44 --- /dev/null +++ b/views/front/apis/bibcoSearch.html @@ -0,0 +1 @@ +{$content} -- 2.17.1