* Get recurances along with all times entries for a particular event ID
*
* @param integer $eventID Event ID
+ * @param boolean $allTimes Flag to get all times entries for the event, not just current and future
*
* @return object Class object
*
*/
- public function getRecurWithTimes($eventID)
+ public function getRecurWithTimes($eventID, $allTimes = false)
{
// Check for positive integer event ID
return false;
}
+ // By setting fromDate to false by default we're telling getEventTimesByRecurrenceSimplified() to provide only future times.
+ $fromDate = false;
+
+ // If all times are requested, set $fromTime to our time epoch.
+ if ($allTimes) {
+ $fromDate = date('Y-m-d H:i:s', 0);
+ }
+
// Get all recurrences
$recurrences = $this->getList("T.event = $eventID", 'start_time');
foreach ($recurrences as $k=>$v) {
require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataTimes.php';
$Times = new GlmDataEventsTimes($this->wpdb, $this->config);
- $recurrences[$k]['times'] = $Times->getEventTimesByRecurrenceSimplified($v['id']);
+ $recurrences[$k]['times'] = $Times->getEventTimesByRecurrenceSimplified($v['id'], $fromDate);
}
}
// Only display times from startDate to endDate
if (!$startDate) {
+
+ // With no start time supplied, only supply times from today forward.
$startDate = date('Y-m-d H:i:s');
+
}
$where .= " AND T.start_time >= '$startDate' ";
if ($endDate) {
// Get any schedules and times for this event
require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php';
$RecurrenceData = new GlmDataEventsRecurrences($this->wpdb, $this->config);
- $recurrences = $RecurrenceData->getRecurWithTimes($eventId);
+ $recurrences = $RecurrenceData->getRecurWithTimes($eventId, true);
return $recurrences;