Updates to be used for Harbor Country Golf Club.
// Defines for different API's
define( 'GLM_MEMBERS_APIS_STARLINE_OPTION_NAME', 'glm_member_db_apis_starline_url' );
define( 'GLM_MEMBERS_APIS_BIBCO_OPTION_NAME', 'glm_member_db_apis_bibco_url' );
+define( 'GLM_MEMBERS_APIS_GOLFCLUB_OPTION_NAME', 'glm_member_db_apis_golfclub_url' );
// Database table prefixes - change if using add-on tables
global $wpdb;
$option3 = false;
$calendarUrl = false;
$bibcoOptionName = GLM_MEMBERS_APIS_BIBCO_OPTION_NAME;
+ $option4 = false;
+ $directoryUrl = false;
+ $golfclubOptionName = GLM_MEMBERS_APIS_GOLFCLUB_OPTION_NAME;
if (isset($_REQUEST['option'])) {
$option = $_REQUEST['option'];
if ( isset( $_REQUEST['option3'] ) ) {
$option3 = $_REQUEST['option3'];
}
+ $option4 = '';
+ if ( isset( $_REQUEST['option4'] ) ) {
+ $option4 = $_REQUEST['option4'];
+ }
+ // Option for saving the Starline settings.
switch($option2) {
// Update the settings and redisplay the form
case 'submit':
break;
}
+
+ // Option for saving the Bibco settings.
switch($option3) {
// Update the settings and redisplay the form
case 'submit':
break;
}
+
+ // Option for saving the golfclub settings.
+ switch($option4) {
+ // Update the settings and redisplay the form
+ case 'submit':
+ $settings_updated = true;
+ update_option( $golfclubOptionName, serialize( $_REQUEST[$golfclubOptionName] ) );
+ $golfclubOptions = unserialize( get_option( $golfclubOptionName ) );
+ $directoryUrl = ( isset( $golfclubOptions['directoryUrl'] ) ) ? $golfclubOptions['directoryUrl'] : '';
+
+ break;
+
+ // Default is to get the current settings and display the form
+ default:
+ $golfclubOptions = unserialize( get_option( $golfclubOptionName ) );
+ $directoryUrl = ( isset( $golfclubOptions['directoryUrl'] ) ) ? $golfclubOptions['directoryUrl'] : '';
+
+ break;
+ }
+
break;
}
'starlineOptionName' => $starlineOptionName,
'calendarUrl' => $calendarUrl,
'bibcoOptionName' => $bibcoOptionName,
+ 'golfclubOptionName' => $golfclubOptionName,
+ 'directoryUrl' => $directoryUrl,
'settingsUpdated' => $settings_updated,
'settingsUpdateError' => $settings_update_error,
'apisSettings' => $api_settings,
<?php
/**
- * detail.php
+ * bibcoCalendar.php
*
* This is the Member Api Plugin model for the front detail shortcode.
* Handles the view of the detail pages.
*/
/**
- * GLmMembersFront_api_detail
+ * GlmMembersFront_apis_bibcoCalendar
*
* @uses GlmDataApis
* @package GlmMemberApis
$this->wpdb = $wpdb;
$this->config = $config;
- //parent::__construct(false, false);
-
- if ( $this->config['settings']['use_venue_locations'] ) {
- $this->getMemberList();
- }
-
- }
/**
* modelAction
*
*/
public function modelAction($actionData = false)
{
- //echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
- //echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
$view = 'bibcoCalendar';
$settings = array();
$content = '';
--- /dev/null
+<?php
+/**
+ * bibcoSearch.php
+ *
+ * This is the Member Api Plugin model for the front detail shortcode.
+ * Handles the view of the detail pages.
+ */
+
+/**
+ * GlmMembersFront_apis_bibcoSearch
+ *
+ * @uses GlmDataApis
+ * @package GlmMemberApis
+ * @version 0.0.1
+ * @copyright Copyright (c) 2010 All rights reserved.
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
+ */
+class GlmMembersFront_apis_bibcoSearch
+{
+ /**
+ * __construct
+ *
+ * @param mixed $wpdb The main Word Press DB Object
+ * @param mixed $config The main Config
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct($wpdb, $config)
+ {
+ $this->wpdb = $wpdb;
+ $this->config = $config;
+
+ //parent::__construct(false, false);
+
+ if ( $this->config['settings']['use_venue_locations'] ) {
+ $this->getMemberList();
+ }
+
+ }
+ /**
+ * modelAction
+ *
+ * @param bool $actionData Action Data passed to the modelAction
+ *
+ * @access public
+ * @return void
+ */
+ public function modelAction($actionData = false)
+ {
+ $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'] : '';
+
+ // Setup the url.
+ $url = $calendarUrl . 'scheduleSearch.php';
+ $curl = curl_init( $url );
+ curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
+ curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' );
+ curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
+ $content = curl_exec( $curl );
+ curl_close( $curl );
+
+ $templateData = array(
+ 'content' => $content,
+ );
+
+ error_reporting(E_ALL ^ E_NOTICE);
+ return array(
+ 'status' => $status,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/apis/' . $view . '.html',
+ 'data' => $templateData,
+ 'settings' => $settings
+ );
+ }
+}
--- /dev/null
+<?php
+/**
+ * golfclubDirectory.php
+ *
+ * This is the Member Api Plugin model for the front detail shortcode.
+ * Handles the view of the detail pages.
+ */
+
+/**
+ * GlmMembersFront_apis_golfclubDirectory
+ *
+ * @uses GlmDataApis
+ * @package GlmMemberApis
+ * @version 0.0.1
+ * @copyright Copyright (c) 2010 All rights reserved.
+ * @author Steve Sutton <steve@gaslightmedia.com>
+ * @license PHP Version 3.0 {@link http://www.php.net/license/3_0.txt}
+ */
+class GlmMembersFront_apis_golfclubDirectory
+{
+ /**
+ * __construct
+ *
+ * @param mixed $wpdb The main Word Press DB Object
+ * @param mixed $config The main Config
+ *
+ * @access public
+ * @return void
+ */
+ public function __construct($wpdb, $config)
+ {
+ $this->wpdb = $wpdb;
+ $this->config = $config;
+
+ }
+ /**
+ * modelAction
+ *
+ * @param bool $actionData Action Data passed to the modelAction
+ *
+ * @access public
+ * @return void
+ */
+ public function modelAction($actionData = false)
+ {
+ global $wp;
+ $view = 'golfclubDirectory';
+ $settings = array();
+ $content = '';
+ $mainSchedId = false;
+
+ // Get the options for golfclub
+ $golfclubOptions = unserialize( get_option( GLM_MEMBERS_APIS_GOLFCLUB_OPTION_NAME ) );
+ $directoryUrl = ( isset( $golfclubOptions['directoryUrl'] ) ) ? $golfclubOptions['directoryUrl'] : '';
+
+ // Setup the url.
+ $url = $directoryUrl . 'Directory.php';
+ $urlParams = array();
+ if ( isset( $_REQUEST['fname'] ) ) {
+ $urlParams[] = 'fname=' . $_REQUEST['fname'];
+ }
+ if ( isset( $_REQUEST['lname'] ) ) {
+ $urlParams[] = 'lname=' . $_REQUEST['lname'];
+ }
+ if ( isset( $_REQUEST['cottage'] ) ) {
+ $urlParams[] = 'cottage=' . $_REQUEST['cottage'];
+ }
+ if ( isset( $_REQUEST['alpha'] ) ) {
+ $urlParams[] = 'alpha=' . $_REQUEST['alpha'];
+ }
+ if ( !empty( $urlParams ) ) {
+ $url .= '?' . implode( '&', $urlParams );
+ }
+ $curl = curl_init( $url );
+ curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
+ curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' );
+ curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
+ $content = curl_exec( $curl );
+ curl_close( $curl );
+
+
+ // Go through the content and replace the url links for the Directory page.
+ $parsedUrl = parse_url( $_SERVER['REQUEST_URI'] );
+ $currentPage = home_url() . $parsedUrl['path'];
+ $currentEnd = $parsedUrl['path'];
+ // Drop everything after ? in $currentPage
+
+ $content = preg_replace( '%' . $directoryUrl .'Directory.php%', $currentPage, $content );
+
+ $templateData = array(
+ 'content' => $content,
+ );
+
+ error_reporting(E_ALL ^ E_NOTICE);
+ return array(
+ 'status' => $status,
+ 'menuItemRedirect' => false,
+ 'modelRedirect' => false,
+ 'view' => 'front/apis/' . $view . '.html',
+ 'data' => $templateData,
+ 'settings' => $settings
+ );
+ }
+}
<?php
/**
- * detail.php
+ * schedule.php
*
* This is the Member Api Plugin model for the front detail shortcode.
* Handles the view of the detail pages.
*/
/**
- * GLmMembersFront_api_detail
+ * GlmMembersFront_apis_schedule
*
* @uses GlmDataApis
* @package GlmMemberApis
*/
public function modelAction($actionData = false)
{
- //echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
- //echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
$view = 'schedule';
$settings = array();
$content = '';
//'template' => false,
)
),
+ 'glm-members-api-golf-directory' => array(
+ 'plugin' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ 'menu' => 'apis',
+ 'action' => 'golfclubDirectory',
+ 'table' => false,
+ 'attributes' => array(
+ //'template' => false,
+ )
+ ),
);
$glmMembersApisShortcodesDescription = '
<td width="50%">
Pulls in the Schedule for Bibco
</td>
+ </tr>
+ <tr>
+ <th>[glm-members-api-golf-directory]</th>
+ <td> </td>
+ <td width="50%">
+ Pulls in the Directory for Harbor Point Golf Club
+ </td>
</tr>
';
),
'frontActions' => array(
'apis' => array(
- 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
- 'bibcoCalendar' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ 'bibcoCalendar' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ 'golfclubDirectory' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
),
)
);
</form>
</td>
</tr>
+ <tr>
+ <td>
+ <h3>Harbor Point Golf Club API</h3>
+ <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+ <input type="hidden" name="glm_action" value="apis">
+ <input type="hidden" name="option" value="settings">
+ <input type="hidden" name="option4" value="submit">
+ <table class="glm-admin-table">
+ <tr>
+ <th> URL for Directory [include ending slash] </th>
+ <td>
+ <input
+ class="glm-form-text-input-medium"
+ name="{$golfclubOptionName}[directoryUrl]"
+ id="directoryUrl"
+ type="text"
+ value="{$directoryUrl}">
+ </td>
+ </tr>
+ </table>
+ <input type="submit" value="Update Settings" class="button-primary">
+ </form>
+ </td>
+ </tr>
</table>
<script>
--- /dev/null
+{$content}