return $r;
}
+ /**
+ * Get event times simplified
+ *
+ * @param integer $categoryID Select by Category (optional)
+ * @param string $startDate Date formatted to be used in MySQL
+ * @param string $endDate Date formatted to be used in MySQL
+ *
+ * @return object Class object
+ */
+ public function getEventTimesSimplified($categoryID = false, $startDate = false, $endDate = false)
+ {
+
+ $savedFields = $this->fields;
+
+ $this->fields = array(
+ 'id' => $savedFields['id'],
+ 'event' => $savedFields['event'],
+ 'event_name' => $savedFields['event_name'],
+ 'start_time' => $savedFields['start_time'],
+ 'end_time' => $savedFields['end_time'],
+ 'all_day' => $savedFields['all_day']
+ );
+
+ // Only display times from start date
+ if (!$startDate) {
+ $startDate = date('Y-m-d H:i:s');
+ }
+ $where = " T.start_time >= '$startDate' ";
+ if ($endDate) {
+ $where .= " AND T.start_time <= '$endDate' ";
+ }
+
+ if ($categoryID) {
+ $where .= "
+ AND
+ T.event IN (
+ SELECT event
+ FROM " .GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "event_categories
+ WHERE category = $categoryID
+ )
+ ";
+ }
+
+ $eventsSimplified = $this->getList($where);
+
+ $this->fields = $savedFields;
+
+ return $eventsSimplified;
+
+ }
+
}
?>
--- /dev/null
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Get events for a monty for AJAX call
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package glmMembersDatabase
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.1
+ */
+
+// Load Event Times data abstract
+require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataTimes.php');
+
+/*
+ * This class performs the work of handling images passed to it via
+ * an AJAX call that goes through the WorPress AJAX Handler.
+ *
+ */
+class GlmMembersAdmin_ajax_eventsCalMonthAJAX extends GlmDataEventsTimes
+{
+
+ /**
+ * WordPress Database Object
+ *
+ * @var $wpdb
+ * @access public
+ */
+ public $wpdb;
+ /**
+ * Plugin Configuration Data
+ *
+ * @var $config
+ * @access public
+ */
+ public $config;
+
+ /*
+ * Constructor
+ *
+ * This contructor sets up this model. At this time that only includes
+ * storing away the WordPress data object.
+ *
+ * @return object Class object
+ *
+ */
+ public function __construct ($wpdb, $config)
+ {
+
+ // Save WordPress Database object
+ $this->wpdb = $wpdb;
+
+ // Save plugin configuration object
+ $this->config = $config;
+
+ // Run constructor for members data class
+ parent::__construct(false, false);
+
+ }
+
+ /*
+ * Perform Model Action
+ *
+ * This modelAction takes an AJAX image upload and stores the image in the
+ * media/images directory of the plugin.
+ *
+ * This model action does not return, it simply does it's work then calls die();
+ *
+ * @param $actionData
+ *
+ * Echos JSON string as response and does not return
+ */
+ public function modelAction ($actionData = false)
+ {
+
+ $return = array(
+ 'status' => false, // Assume nothing works
+ 'events' => false, // Where our events list will go
+ 'message' => ''
+ );
+
+$return['message'] = 'Made it Here!';
+
+ // Return stored image data
+ echo json_encode($return);
+ wp_die();
+ }
+
+
+}
$status = $categoryId = null;
$action = '';
$settings = $events = $event = $categoryEvents = array();
+ $calDates = false;
// If a memberID has been specified, limit to that member
$memberId = $actionData['request']['member'] - 0;
default:
$view = 'agenda.html';
$events = $this->getModelEventsData($categoryId, null, $memberId);
+
+ /* *** NOT USING AT THIS TIME - Moving to AJAX - REMOVE WHEN DONE
+ // Also get event times for calendar display
+ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataTimes.php';
+ $Times = new GlmDataEventsTimes($this->wpdb, $this->config);
+ $calDates = $Times->getEventTimesSimplified($categoryID);
+ */
+
break;
}
$view = 'listForMemberDetail.html';
break;
default:
- // No changes otherwis
+ // No changes otherwise
break;
}
'fromDate' => $fromDate,
'toDate' => $toDate,
'eventName' => $eventNameSearch,
- 'imgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/'
+ 'imgUrl' => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/',
+ 'calDates' => $calDates
);
error_reporting(E_ALL ^ E_NOTICE);
),
'management' => array(
'events' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG
+ ),
+ 'ajax' => array(
+ 'eventsCalMonthAJAX' => GLM_MEMBERS_EVENTS_PLUGIN_SLUG
)
),
'frontActions' => array(
<a href="{$thisUrl}?page={$thisPage}&glm_action=list" class="button button-secondary glm-button glm-right">Return to Events List</a>
{/if}
- {if $option == 'edit'}
+ {if $option == 'edit' || $option == 'update'}
<a id="deleteEventButton" class="button button-secondary glm-button glm-right">Delete this Event</a>
<h2>Edit Event</h2>
{else}
timeFormat : 'h:mma',
fixedWeekCount : false,
eventClick: function(calEvent, jsEvent, view) {
-
-// alert('Event: ' + calEvent.title);
$("#occurrences").dialog();
$(this).css('border-color', 'red');
}
fullCalendarLoaded = true;
}
-
+
});
/*
initLocations();
}
});
-
+
+ // Set masking for phone number fields - see http://digitalbush.com/projects/masked-input-plugin/
+ $.mask.definitions['e'] = "[A-Za-z0-9: ]";
+ $(".glm-phone-input").mask("999-999-9999? eeeeeeeeeee");
+
// Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
<tr>
<th {if $event.fieldRequired.admin_phone}class="glm-required"{/if}>Admin Contact Phone:</th>
<td {if $event.fieldFail.admin_phone}class="glm-form-bad-input" data-tabid="glm-event-admin"{/if}>
- <input type="text" name="admin_phone" value="{$event.fieldData.admin_phone}" class="glm-form-text-input-medium">
+ <input type="text" name="admin_phone" value="{$event.fieldData.admin_phone}" class="glm-form-text-input-medium glm-phone-input">
{if $event.fieldFail.admin_phone}<p>{$event.fieldFail.admin_phone}</p>{/if}<br>
</td>
</tr>
<tr>
<td>
<table>
+ <tr>
+ <th>Hide Location Address:</th>
+ <td>
+ <input type="checkbox" name="hide_address" {if $event.fieldData.hide_address.value} checked{/if}>
+ Don't show location address to site visitors.
+ </td>
+ </tr>
<tr>
<th>Use {$terms.term_member_cap} location:</th>
<td>
<input id="name_{$loc.id}" type="text" name="Loc{$loc.id}_name" value="{$loc.name}" class="glm-form-text-input-medium">
</td>
</tr>
- <tr>
- <th>Hide Location Address:</th>
- <td>
- <input type="checkbox" name="Loc{$loc.id}_hide_address" {if $event.fieldData.hide_address.value} checked{/if}>
- Don't show location address to site visitors.
- </td>
- </tr>
<tr>
<th>Address:</th>
<td>
<tr>
<th>Phone:</th>
<td>
- <input type="text" name="Loc{$loc.id}_phone" value="{$loc.phone}" class="glm-form-text-input-medium">
+ <input type="text" name="Loc{$loc.id}_phone" value="{$loc.phone}" class="glm-form-text-input-medium glm-phone-input">
</td>
</tr>
<tr>
<tr>
<th {if $event.fieldRequired.contact_phone}class="glm-required"{/if}>Event Phone #:</th>
<td {if $event.fieldFail.contact_phone}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- <input type="text" name="phone" value="{$event.fieldData.contact_phone}" class="glm-form-text-input-medium" placeholder="ex: 123-123-1234">
+ <input type="text" name="phone" value="{$event.fieldData.contact_phone}" class="glm-form-text-input-medium glm-phone-input" placeholder="ex: 123-123-1234">
{if $event.fieldFail.contact_phone}<p>{$event.fieldFail.contact_phone}</p>{/if}<br>
</td>
</tr>
<tr>
<th>Contact Phone:</th>
<td>
- <input type="text" name="contact_phone" value="{$event.fieldData.contact_phone}" class="glm-form-text-input-medium">
+ <input type="text" name="contact_phone" value="{$event.fieldData.contact_phone}" class="glm-form-text-input-medium glm-phone-input">
</td>
</tr>
<tr>
</div>
</div>
{/foreach}
+
+ <!-- Calendar -->
+
+ <div id="eventCalendar"></div>
+
+
</div>
</div>
</div>
+
+
+<script type="text/javascript">
+ jQuery(document).ready(function($) {
+
+ var fullCalendarLoaded = false;
+ var recurrencesInited = false;
+ var locationsInited = false;
+
+/* Temporarily dissable calendar display
+
+ // Get calendar month via AJAX
+ function eventsCalMonthAJAX(month) {
+ var data = {
+ action: 'glm_members_admin_ajax',
+ glm_action: 'eventsCalMonthAJAX'
+ month: 'Month Stuff'
+ };
+ jQuery.post('{$ajaxUrl}', data, function(response) {
+ alert(response);
+ });
+ }
+// Fire off for testing
+var x = eventsCalMonthAJAX('123');
+
+
+ if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
+
+ // **** Should probably move all this to a function and check if it's been initialized already
+ $('#eventCalendar').fullCalendar({
+ events: [
+ {$sep = ''}
+ {foreach $calDates as $cDate}
+ {$sep}{
+ title : "{$cDate.event_name|unescape:'html'}",
+ start : '{$cDate.start_time.datetime}',
+ end : '{$cDate.end_time.datetime}',
+ allday : {$cDate.all_day.value}
+ }
+ {$sep = ','}
+ {/foreach}
+ ],
+ defaultDate : '{$firstTime.start_time.datetime}',
+ timeFormat : 'h:mma',
+ fixedWeekCount : false,
+ eventClick: function(calEvent, jsEvent, view) {
+
+ $("#occurrences").dialog();
+ $(this).css('border-color', 'red');
+ }
+ });
+
+ fullCalendarLoaded = true;
+// }
+*/
+
+
+ });
+</script>
\ No newline at end of file