Add url for the calendar api for bibco.
Add shortcode and management page for settings.
// 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' );
// Database table prefixes - change if using add-on tables
global $wpdb;
$starlineUrl = false;
$starlinePageSlug = false;
$starlineOptionName = GLM_MEMBERS_APIS_STARLINE_OPTION_NAME;
+ $option3 = false;
+ $calendarUrl = false;
+ $bibcoOptionName = GLM_MEMBERS_APIS_BIBCO_OPTION_NAME;
if (isset($_REQUEST['option'])) {
$option = $_REQUEST['option'];
if ( isset( $_REQUEST['option2'] ) ) {
$option2 = $_REQUEST['option2'];
}
+ $option3 = '';
+ if ( isset( $_REQUEST['option3'] ) ) {
+ $option3 = $_REQUEST['option3'];
+ }
switch($option2) {
// Update the settings and redisplay the form
break;
}
+ switch($option3) {
+ // Update the settings and redisplay the form
+ case 'submit':
+ $settings_updated = true;
+ update_option( $bibcoOptionName, serialize( $_REQUEST[$bibcoOptionName] ) );
+ $bibcoOptions = unserialize( get_option( $bibcoOptionName ) );
+ $calendarUrl = ( isset( $bibcoOptions['calendarUrl'] ) ) ? $bibcoOptions['calendarUrl'] : '';
+
+ break;
+
+ // Default is to get the current settings and display the form
+ default:
+ $bibcoOptions = unserialize( get_option( $bibcoOptionName ) );
+ $calendarUrl = ( isset( $bibcoOptions['calendarUrl'] ) ) ? $bibcoOptions['calendarUrl'] : '';
+
+ break;
+ }
break;
}
'starlineUrl' => $starlineUrl,
'starlinePageSlug' => $starlinePageSlug,
'starlineOptionName' => $starlineOptionName,
+ 'calendarUrl' => $calendarUrl,
+ 'bibcoOptionName' => $bibcoOptionName,
'settingsUpdated' => $settings_updated,
'settingsUpdateError' => $settings_update_error,
'apisSettings' => $api_settings,
--- /dev/null
+<?php
+/**
+ * detail.php
+ *
+ * This is the Member Api Plugin model for the front detail shortcode.
+ * Handles the view of the detail pages.
+ */
+
+/**
+ * GLmMembersFront_api_detail
+ *
+ * @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_bibcoCalendar
+{
+ /**
+ * __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)
+ {
+ //echo '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
+ //echo '<pre>$actionData: ' . print_r( $actionData, true ) . '</pre>';
+ $view = 'schedule';
+ $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 . 'schedule.php';
+ $curl = curl_init( $url );
+ curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
+ //curl_setopt( $curl, CURLOPT_USERPWD, 'dev55:Glm15Keep!' );
+ $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
+ );
+ }
+}
'off_canvas' => false,
)
),
+ 'glm-members-api-bibco-calander' => array(
+ 'plugin' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ 'menu' => 'apis',
+ 'action' => 'bibcoCalendar',
+ 'table' => false,
+ 'attributes' => array(
+ //'template' => false,
+ )
+ ),
);
$glmMembersApisShortcodesDescription = '
<td width="50%">
Pulls in the Schedule for Starline
</td>
+ </tr>
+ <tr>
+ <th>[glm-members-api-bibco-calander]</th>
+ <td> </td>
+ <td width="50%">
+ Pulls in the Schedule for Bibco
+ </td>
</tr>
';
),
'frontActions' => array(
'apis' => array(
- 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
- )
+ 'schedule' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ 'bibcoCalendar' => GLM_MEMBERS_APIS_PLUGIN_SLUG,
+ ),
)
);
</form>
</td>
</tr>
+ <tr>
+ <td>
+ <h3>Bibco 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="option3" value="submit">
+ <table class="glm-admin-table">
+ <tr>
+ <th> URL for Calendar Schedule system [include ending slash] </th>
+ <td>
+ <input
+ class="glm-form-text-input-medium"
+ name="{$bibcoOptionName}[calendarUrl]"
+ id="calendarUrl"
+ type="text"
+ value="{$calendarUrl}">
+ </td>
+ </tr>
+ </table>
+ <input type="submit" value="Update Settings" class="button-primary">
+ </form>
+ </td>
+ </tr>
</table>
<script>
--- /dev/null
+{$content}