Changeset View
Changeset View
Standalone View
Standalone View
plugins/calendar/drivers/kolab/kolab_calendar.php
Show First 20 Lines • Show All 653 Lines • ▼ Show 20 Lines | public function get_recurring_events($event, $start, $end = null, $event_id = null) | ||||
} | } | ||||
// found the specifically requested instance, exiting... | // found the specifically requested instance, exiting... | ||||
if ($event_id && !empty($this->events[$event_id])) { | if ($event_id && !empty($this->events[$event_id])) { | ||||
return array($this->events[$event_id]); | return array($this->events[$event_id]); | ||||
} | } | ||||
// use libkolab to compute recurring events | // use libkolab to compute recurring events | ||||
if (class_exists('kolabcalendaring')) { | |||||
$recurrence = new kolab_date_recurrence($object); | $recurrence = new kolab_date_recurrence($object); | ||||
} | |||||
else { | |||||
// fallback to local recurrence implementation | |||||
require_once($this->cal->home . '/lib/calendar_recurrence.php'); | |||||
$recurrence = new calendar_recurrence($this->cal, $event); | |||||
} | |||||
$i = 0; | $i = 0; | ||||
while ($next_event = $recurrence->next_instance()) { | while ($next_event = $recurrence->next_instance()) { | ||||
$datestr = $next_event['start']->format('Ymd'); | $datestr = $next_event['start']->format('Ymd'); | ||||
$instance_id = $next_event['start']->format($recurrence_id_format); | $instance_id = $next_event['start']->format($recurrence_id_format); | ||||
// use this event data for future recurring instances | // use this event data for future recurring instances | ||||
if ($futuredata[$datestr]) | if ($futuredata[$datestr]) | ||||
Show All 34 Lines | while ($next_event = $recurrence->next_instance()) { | ||||
} | } | ||||
else if ($next_event['start'] > $end) // stop loop if out of range | else if ($next_event['start'] > $end) // stop loop if out of range | ||||
break; | break; | ||||
// avoid endless recursion loops | // avoid endless recursion loops | ||||
if (++$i > 100000) | if (++$i > 100000) | ||||
break; | break; | ||||
} | } | ||||
return $events; | return $events; | ||||
} | } | ||||
/** | /** | ||||
* Convert from Kolab_Format to internal representation | * Convert from Kolab_Format to internal representation | ||||
*/ | */ | ||||
private function _to_driver_event($record, $noinst = false, $links = true, $master_event = null) | private function _to_driver_event($record, $noinst = false, $links = true, $master_event = null) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |