Skip to content

Commit

Permalink
Use Kronolith_Icalendar_Handler in Kronolith_Api::import.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Mar 18, 2015
1 parent 5a7386f commit e4dde89
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions kronolith/lib/Api.php
Expand Up @@ -812,33 +812,8 @@ public function import($content, $contentType, $calendar = null)
if (count($components) == 0) {
throw new Kronolith_Exception(_("No iCalendar data was found."));
}

$ids = array();
$recurrences = array();
foreach ($components as $content) {
if ($content instanceof Horde_Icalendar_Vevent) {
// Need to ensure that the original recurring event is
// added before any of the instance exceptions. Easiest way
// to do that is just add all the recurrence-id entries last
try {
$content->getAttribute('RECURRENCE-ID');
$recurrences[] = $content;
} catch (Horde_Icalendar_Exception $e) {
$ids[] = $this->_addiCalEvent($content, $kronolith_driver);
}
}
}

if (count($ids) == 0) {
throw new Kronolith_Exception(_("No iCalendar data was found."));
}

// Now add all the exception instances
foreach ($recurrences as $recurrence) {
$ids[] = $this->_addiCalEvent($recurrence, $kronolith_driver, true);
}

return $ids;
$ical_importer = new Kronolith_Icalendar_Handler_Base($ical, $kronolith_driver);
return $ical_importer->process();

case 'activesync':
$event = $kronolith_driver->getEvent();
Expand Down

0 comments on commit e4dde89

Please sign in to comment.