protected function _process()
{
$ids = array();
$components = $this->_iCal->getComponents();
if (count($components) == 0) {
throw new Kronolith_Exception(_("No iCalendar data was found."));
}
foreach ($components as $component) {
if (!$this->_preSave($component)) {
continue;
}
try {
// RECURRENCE-ID - must import after base event is
// imported/saved so defer these until all other data is
// processed.
$component->getAttribute('RECURRENCE-ID');
$this->_exceptions[] = $component;
} catch (Horde_Icalendar_Exception $e) {
$event = $this->_driver->getEvent();
$event->fromiCalendar($component, true);
// Delete existing exception events. There is no efficient way
// to determine if any existing events have been changed/deleted
// so we just remove them all since they will be re-added during
// the import process.
foreach ($event->boundExceptions() as $exception) {
$this->_driver->deleteEvent($exception->id);
}
// Save and post-process.
$event->save();
$this->_postSave($event);
$ids[$event->uid] = $event->id;
}
}
// Save exception events.
foreach ($this->_exceptions as $exception) {
$event = $this->_driver->getEvent();
$event->fromiCalendar($exception);
$event->save();
}
return $ids;
}