当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde_Icalendar::getComponents方法代码示例

本文整理汇总了PHP中Horde_Icalendar::getComponents方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Icalendar::getComponents方法的具体用法?PHP Horde_Icalendar::getComponents怎么用?PHP Horde_Icalendar::getComponents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_Icalendar的用法示例。


在下文中一共展示了Horde_Icalendar::getComponents方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testEmptyData

 public function testEmptyData()
 {
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents(__DIR__ . '/fixtures/empty.ics'));
     $this->assertEquals(array(), $ical->getComponents());
     $ical->parsevCalendar('');
     $this->assertEquals(array(), $ical->getComponents());
 }
开发者ID:kossamums,项目名称:horde,代码行数:8,代码来源:ParseTest.php

示例2: _handle

 /**
  * Variables required in form input:
  *   - imple_submit: vcard action. Contains import and source properties
  *   - mime_id
  *   - muid
  *
  * @return boolean  True on success.
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $registry, $injector, $notification;
     $iCal = new Horde_Icalendar();
     try {
         $contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars));
         if (!($mime_part = $contents->getMimePart($vars->mime_id))) {
             throw new IMP_Exception(_("Cannot retrieve vCard data from message."));
         } elseif (!$iCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
             throw new IMP_Exception(_("Error reading the contact data."));
         }
         $components = $iCal->getComponents();
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
     $import = !empty($vars->imple_submit->import) ? $vars->imple_submit->import : false;
     $source = !empty($vars->imple_submit->source) ? $vars->imple_submit->source : false;
     if ($import && $source && $registry->hasMethod('contacts/import')) {
         $count = 0;
         foreach ($components as $c) {
             if ($c->getType() == 'vcard') {
                 try {
                     $registry->call('contacts/import', array($c, null, $source));
                     ++$count;
                 } catch (Horde_Exception $e) {
                     $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error');
                 }
             }
         }
         $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:40,代码来源:VcardImport.php

示例3: _getFixture

 private function _getFixture($element)
 {
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar(file_get_contents(__DIR__ . '/../fixtures/allday.ics'));
     $components = $iCal->getComponents();
     return $components[$element];
 }
开发者ID:horde,项目名称:horde,代码行数:7,代码来源:AllDayTest.php

示例4: _process

 /**
  * Process the iCalendar data.
  *
  * @return array A hash of UID => id.
  * @throws Kronolith_Exception
  */
 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;
 }
开发者ID:horde,项目名称:horde,代码行数:47,代码来源:Base.php

示例5: testFile

 /**
  * @dataProvider timezones
  */
 public function testFile($file)
 {
     $result = '';
     $ical = new Horde_Icalendar();
     $ical->parsevCalendar(file_get_contents($file));
     foreach ($ical->getComponents() as $component) {
         if ($component->getType() != 'vEvent') {
             continue;
         }
         $date = $component->getAttribute('DTSTART');
         if (is_array($date)) {
             continue;
         }
         $result .= str_replace("\r", '', $component->getAttribute('SUMMARY')) . "\n";
         $d = new Horde_Date($date);
         $result .= $d->format('H:i') . "\n";
     }
     $this->assertStringEqualsFile(__DIR__ . '/fixtures/vTimezone/' . basename($file, 'ics') . 'txt', $result, 'Failed parsing file ' . basename($file));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:22,代码来源:TimezonesTest.php

示例6: _renderInline

 /**
  * Return the full rendered version of the Horde_Mime_Part object.
  *
  * URL parameters used by this function:
  *   - c: (integer) The VCARD component that contains an image.
  *   - p: (integer) The index of image inside the component to display.
  *
  * @return array  See parent::render().
  * @throws Horde_Exception
  */
 protected function _renderInline()
 {
     $vars = $GLOBALS['injector']->getInstance('Horde_Variables');
     if (!isset($vars->p)) {
         $imp_contents = $this->getConfigParam('imp_contents');
         $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_VcardImport', array('mime_id' => $this->_mimepart->getMimeId(), 'muid' => strval($imp_contents->getIndicesOb())));
         $this->_imageUrl = $this->getConfigParam('imp_contents')->urlView($this->_mimepart, 'download_render', array('params' => array('mode' => IMP_Contents::RENDER_INLINE)));
         return parent::_renderInline();
     }
     /* Send the requested photo. */
     $data = $this->_mimepart->getContents();
     $ical = new Horde_Icalendar();
     if (!$ical->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) {
         // TODO: Error reporting
         return array();
     }
     $components = $ical->getComponents();
     if (!isset($components[$vars->c])) {
         // TODO: Error reporting
         return array();
     }
     $name = $components[$vars->c]->getAttributeDefault('FN', false);
     if ($name === false) {
         $name = $components[$vars->c]->printableName();
     }
     if (empty($name)) {
         $name = preg_replace('/\\..*?$/', '', $this->_mimepart->getName());
     }
     $photos = $components[$vars->c]->getAllAttributes('PHOTO');
     if (!isset($photos[$vars->p])) {
         // TODO: Error reporting
         return array();
     }
     $type = 'image/' . Horde_String::lower($photos[$vars->p]['params']['TYPE']);
     return array($this->_mimepart->getMimeId() => array('data' => base64_decode($photos[$vars->p]['value']), 'name' => $name . '.' . Horde_Mime_Magic::mimeToExt($type), 'type' => $type));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:46,代码来源:Vcard.php

示例7: _renderInline

 /**
  * Return the rendered inline version of the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInline()
 {
     $GLOBALS['page_output']->growler = true;
     $data = $this->_mimepart->getContents();
     $mime_id = $this->_mimepart->getMimeId();
     // Parse the iCal file.
     $vCal = new Horde_Icalendar();
     if (!$vCal->parsevCalendar($data, 'VCALENDAR', $this->_mimepart->getCharset())) {
         $status = new IMP_Mime_Status($this->_mimepart, _("The calendar data is invalid"));
         $status->action(IMP_Mime_Status::ERROR);
         return array($mime_id => array('data' => '', 'status' => $status, 'type' => 'text/html; charset=UTF-8'));
     }
     // Check if we got vcard data with the wrong vcalendar mime type.
     $imp_contents = $this->getConfigParam('imp_contents');
     $c = $vCal->getComponentClasses();
     if (count($c) == 1 && !empty($c['horde_icalendar_vcard'])) {
         return $imp_contents->renderMIMEPart($mime_id, IMP_Contents::RENDER_INLINE, array('type' => 'text/x-vcard'));
     }
     $imple = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Imple')->create('IMP_Ajax_Imple_ItipRequest', array('mime_id' => $mime_id, 'muid' => strval($imp_contents->getIndicesOb())));
     // Get the method type.
     try {
         $method = $vCal->getAttribute('METHOD');
     } catch (Horde_Icalendar_Exception $e) {
         $method = '';
     }
     $out = array();
     $exceptions = array();
     $components = $vCal->getComponents();
     foreach ($components as $key => $component) {
         switch ($component->getType()) {
             case 'vEvent':
                 try {
                     if ($component->getAttribute('RECURRENCE-ID')) {
                         $exceptions[] = $this->_vEvent($component, $key, $method, $components);
                     }
                 } catch (Horde_ICalendar_Exception $e) {
                     $out[] = $this->_vEvent($component, $key, $method, $components);
                 }
                 break;
             case 'vTodo':
                 $out[] = $this->_vTodo($component, $key, $method);
                 break;
             case 'vTimeZone':
                 // Ignore them.
                 break;
             case 'vFreebusy':
                 $out[] = $this->_vFreebusy($component, $key, $method);
                 break;
                 // @todo: handle stray vcards here as well.
             // @todo: handle stray vcards here as well.
             default:
                 $out[] = sprintf(_("Unhandled component of type: %s"), $component->getType());
                 break;
         }
     }
     // If we don't have any other parts, any exceptions should be shown
     // since this is likely an update to a series instance such as a
     // cancellation etc...
     if (empty($out)) {
         $out = $exceptions;
     }
     $view = $this->_getViewOb();
     $view->formid = $imple->getDomId();
     $view->out = implode('', $out);
     return array($mime_id => array('data' => $view->render('base'), 'type' => 'text/html; charset=UTF-8'));
 }
开发者ID:Gomez,项目名称:horde,代码行数:71,代码来源:Itip.php

示例8: _getFixture

 private function _getFixture($name, $item = 0)
 {
     $iCal = new Horde_Icalendar();
     $iCal->parsevCalendar(file_get_contents(__DIR__ . '/../fixtures/' . $name));
     $components = $iCal->getComponents();
     $event = new Kronolith_Event_Sql(new Kronolith_Stub_Driver());
     $event->fromiCalendar($components[$item], true);
     return $event;
 }
开发者ID:horde,项目名称:horde,代码行数:9,代码来源:FromIcalendarTest.php

示例9: _getiTipStatus

 /**
  * Return the attendee participation status.
  *
  * @param Horde_Icalendar $vCal  The vCalendar component.
  *
  * @param Horde_Icalendar
  * @throws Horde_ActiveSync_Exception
  */
 protected function _getiTipStatus($vCal)
 {
     foreach ($vCal->getComponents() as $component) {
         switch ($component->getType()) {
             case 'vEvent':
                 try {
                     $atparams = $component->getAttribute('ATTENDEE', true);
                 } catch (Horde_Icalendar_Exception $e) {
                     throw new Horde_ActiveSync_Exception($e);
                 }
                 if (!is_array($atparams)) {
                     throw new Horde_Icalendar_Exception('Unexpected value');
                 }
                 return $atparams[0]['PARTSTAT'];
         }
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:25,代码来源:Adapter.php

示例10: exit

 */
require_once 'Horde/Cli.php';
require_once 'Horde/Icalendar.php';
// This only works on the command line.
if (!Horde_Cli::runningFromCLI()) {
    exit("Must be run from the command line\n");
}
// Load the CLI environment - make sure there's no time limit, init
// some variables, etc.
$cli = Horde_Cli::init();
if (empty($argv[1])) {
    $cli->fatal('No file specified on the command line.');
}
$input_file = $argv[1];
if (!file_exists($input_file)) {
    $cli->fatal($input_file . ' does not exist.');
}
if (!is_readable($input_file)) {
    $cli->fatal($input_file . ' is not readable.');
}
$cli->writeln($cli->blue('Parsing ' . $input_file . ' ...'));
$data = file_get_contents($input_file);
$ical = new Horde_Icalendar();
if (!$ical->parseVCalendar($data)) {
    $cli->fatal('iCalendar parsing failed.');
}
$cli->writeln($cli->green('Parsing successful, found ' . $ical->getComponentCount() . ' component(s).'));
$components = $ical->getComponents();
foreach ($components as $component) {
    var_dump($component->toHash(true));
}
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:parser.php

示例11: _convertEvents

 /**
  * Converts all components of a Horde_Icalendar container into a
  * Kronolith_Event list.
  *
  * @param Horde_Icalendar $ical  A Horde_Icalendar container.
  *
  * @return array  List of Kronolith_Event_Ical objects.
  * @throws Kronolith_Exception
  */
 protected function _convertEvents($ical)
 {
     $events = array();
     foreach ($ical->getComponents() as $component) {
         if ($component->getType() == 'vEvent') {
             try {
                 $events[] = new Kronolith_Event_Ical($this, $component);
             } catch (Kronolith_Exception $e) {
                 Horde::log(sprintf('Failed to parse event from remote calendar: url = "%s"', $this->calendar), 'INFO');
             }
         }
     }
     return $events;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:23,代码来源:Ical.php

示例12: davPutObject

 /**
  */
 public function davPutObject($collection, $object, $data)
 {
     $dav = $GLOBALS['injector']->getInstance('Horde_Dav_Storage');
     $internal = $dav->getInternalCollectionId($collection, 'tasks') ?: $collection;
     if (!Nag::hasPermission($internal, Horde_Perms::EDIT)) {
         throw new Nag_Exception("Task List does not exist or no permission to edit");
     }
     $ical = new Horde_Icalendar();
     if (!$ical->parsevCalendar($data)) {
         throw new Nag_Exception(_("There was an error importing the iCalendar data."));
     }
     $storage = $GLOBALS['injector']->getInstance('Nag_Factory_Driver')->create($internal);
     foreach ($ical->getComponents() as $content) {
         if (!$content instanceof Horde_Icalendar_Vtodo) {
             continue;
         }
         $task = new Nag_Task();
         $task->fromiCalendar($content);
         try {
             try {
                 $existing_id = $dav->getInternalObjectId($object, $internal) ?: preg_replace('/\\.ics$/', '', $object);
             } catch (Horde_Dav_Exception $e) {
                 $existing_id = $object;
             }
             $existing_task = Nag::getTask($internal, $existing_id);
             /* Check if our task is newer then the existing - get the
              * task's history. */
             $modified = $this->_modified($internal, $existing_task->uid);
             try {
                 if (!empty($modified) && $content->getAttribute('LAST-MODIFIED') < $modified) {
                     /* LAST-MODIFIED timestamp of existing entry is newer:
                      * don't replace it. */
                     continue;
                 }
             } catch (Horde_Icalendar_Exception $e) {
             }
             $task->owner = $existing_task->owner;
             $storage->modify($existing_task->id, $task->toHash());
         } catch (Horde_Exception_NotFound $e) {
             $hash = $task->toHash();
             $newTask = $storage->add($hash);
             $dav->addObjectMap($newTask[0], $object, $internal);
         }
     }
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:47,代码来源:Application.php

示例13: replace

 /**
  * Replaces the task identified by UID with the content represented in the
  * specified content type.
  *
  * If you want to replace multiple tasks with the UID specified in the
  * VCALENDAR data, you may use $this->import instead. This automatically does a
  * replace if existings UIDs are found.
  *
  *
  * @param string $uid          Identify the task to replace.
  * @param string $content      The content of the task.
  * @param string $contentType  What format is the data in? Currently supports:
  *                             - text/x-vcalendar
  *                             - text/calendar
  *
  * @return boolean  Success or failure.
  */
 public function replace($uid, $content, $contentType)
 {
     $factory = $GLOBALS['injector']->getInstance('Nag_Factory_Driver');
     $existing = $factory->create('')->getByUID($uid);
     $taskId = $existing->id;
     $owner = $existing->owner;
     if (!Nag::hasPermission($existing->tasklist, Horde_Perms::EDIT)) {
         throw new Horde_Exception_PermissionDenied();
     }
     switch ($contentType) {
         case 'text/calendar':
         case 'text/x-vcalendar':
             if (!$content instanceof Horde_Icalendar_Vtodo) {
                 $iCal = new Horde_Icalendar();
                 if (!$iCal->parsevCalendar($content)) {
                     throw new Nag_Exception(_("There was an error importing the iCalendar data."));
                 }
                 $components = $iCal->getComponents();
                 $component = null;
                 foreach ($components as $content) {
                     if ($content instanceof Horde_Icalendar_Vtodo) {
                         if ($component !== null) {
                             throw new Nag_Exception(_("Multiple iCalendar components found; only one vTodo is supported."));
                         }
                         $component = $content;
                     }
                 }
                 if ($component === null) {
                     throw new Nag_Exception(_("No iCalendar data was found."));
                 }
             }
             $task = new Nag_Task();
             $task->fromiCalendar($content);
             $task->owner = $owner;
             $factory->create($existing->tasklist)->modify($taskId, $task->toHash());
             break;
         case 'activesync':
             $task = new Nag_Task();
             $task->fromASTask($content);
             $task->owner = $owner;
             $factory->create($existing->tasklist)->modify($taskId, $task->toHash());
             break;
         default:
             throw new Nag_Exception(sprintf(_("Unsupported Content-Type: %s"), $contentType));
     }
     return $result;
 }
开发者ID:Gomez,项目名称:horde,代码行数:64,代码来源:Api.php

示例14: import

 /**
  * Import a contact represented in the specified contentType.
  *
  * @param string $content      The content of the contact.
  * @param string $contentType  What format is the data in? Currently
  *                             supports array, text/directory, text/vcard,
  *                             text/x-vcard, and activesync.
  * @param string $source       The source into which the contact will be
  *                             imported.
  *
  * @return string  The new UID.
  *
  * @throws Turba_Exception
  * @throws Turba_Exception_ObjectExists
  */
 public function import($content, $contentType = 'array', $source = null)
 {
     global $cfgSources, $injector, $prefs;
     /* Get default address book from user preferences. */
     if (empty($source) && !($source = $prefs->getValue('default_dir'))) {
         // On new installations default_dir is not set. Try default
         // addressbook if it's editable. Otherwise use first editable
         // addressbook.
         $edit_sources = Turba::getAddressBooks(Horde_Perms::EDIT);
         $default_source = Turba::getDefaultAddressbook();
         if (isset($edit_sources[$default_source])) {
             // use default addressbook
             $source = $default_source;
         } else {
             // Use first writable source
             $source = reset($edit_sources);
         }
     }
     // Check existence of and permissions on the specified source.
     if (!isset($cfgSources[$source])) {
         throw new Turba_Exception(sprintf(_("Invalid address book: %s"), $source));
     }
     $driver = $injector->getInstance('Turba_Factory_Driver')->create($source);
     if (!$driver->hasPermission(Horde_Perms::EDIT)) {
         throw new Turba_Exception(_("Permission denied"));
     }
     if (!$content instanceof Horde_Icalendar_Vcard) {
         switch ($contentType) {
             case 'activesync':
                 $content = $driver->fromASContact($content);
                 break;
             case 'array':
                 if (!isset($content['emails']) && isset($content['email'])) {
                     $content['emails'] = $content['email'];
                 }
                 break;
             case 'text/x-vcard':
             case 'text/vcard':
             case 'text/directory':
                 $iCal = new Horde_Icalendar();
                 if (!$iCal->parsevCalendar($content)) {
                     throw new Turba_Exception(_("There was an error importing the iCalendar data."));
                 }
                 switch ($iCal->getComponentCount()) {
                     case 0:
                         throw new Turba_Exception(_("No vCard data was found."));
                     case 1:
                         $content = $iCal->getComponent(0);
                         break;
                     default:
                         $ids = array();
                         foreach ($iCal->getComponents() as $c) {
                             if ($c instanceof Horde_Icalendar_Vcard) {
                                 $content = $driver->toHash($c);
                                 $result = $driver->search($content);
                                 if (count($result)) {
                                     continue;
                                 }
                                 $ids[] = $driver->add($content);
                             }
                         }
                         return $ids;
                 }
                 break;
             default:
                 throw new Turba_Exception(sprintf(_("Unsupported Content-Type: %s"), $contentType));
         }
     }
     if ($content instanceof Horde_Icalendar_Vcard) {
         $content = $driver->toHash($content);
     }
     // Check if the entry already exists in the data source.
     $result = $driver->search($content);
     if (count($result)) {
         throw new Turba_Exception_ObjectExists(_("Already Exists"));
     }
     // We can't use $object->setValue() here since that cannot be used
     // with composite fields.
     $hooks = $injector->getInstance('Horde_Core_Hooks');
     if ($hooks->hookExists('encode_attribute', 'turba')) {
         foreach ($content as $attribute => &$value) {
             try {
                 $value = $hooks->callHook('encode_attribute', 'turba', array($attribute, $value, null, null));
             } catch (Turba_Exception $e) {
             }
//.........这里部分代码省略.........
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:101,代码来源:Api.php

示例15: _processComponents

 /**
  * Processes the components of a Horde_Icalendar container into an event
  * list.
  *
  * @param array $results             Gets filled with the events in the
  *                                   given time range.
  * @param Horde_Icalendar $ical      An Horde_Icalendar container.
  * @param Horde_Date $startInterval  Start of range date.
  * @param Horde_Date $endInterval    End of range date.
  * @param boolean $showRecurrence    Return every instance of a recurring
  *                                   event? If false, will only return
  *                                   recurring events once inside the
  *                                   $startDate - $endDate range.
  * @param boolean $json              Store the results of the events'
  *                                   toJson() method?
  * @param boolean $coverDates        Whether to add the events to all days
  *                                   that they cover.
  * $param boolean $hideExceptions    Hide events that represent exceptions
  *                                   to a recurring event.
  * @param string $id                 Enforce a certain event id (not UID).
  *
  * @throws Kronolith_Exception
  */
 protected function _processComponents(&$results, $ical, $startDate, $endDate, $showRecurrence, $json, $coverDates, $hideExceptions, $id = null)
 {
     $components = $ical->getComponents();
     $events = array();
     $count = count($components);
     $exceptions = array();
     for ($i = 0; $i < $count; $i++) {
         $component = $components[$i];
         if ($component->getType() == 'vEvent') {
             $event = new Kronolith_Event_Ical($this, $component);
             $event->permission = $this->getPermission();
             // Force string so JSON encoding is consistent across drivers.
             $event->id = $id ? $id : 'ical' . $i;
             /* Catch RECURRENCE-ID attributes which mark single recurrence
              * instances. */
             try {
                 $recurrence_id = $component->getAttribute('RECURRENCE-ID');
                 if (is_int($recurrence_id) && is_string($uid = $component->getAttribute('UID')) && is_int($seq = $component->getAttribute('SEQUENCE'))) {
                     $exceptions[$uid][$seq] = $recurrence_id;
                     if ($hideExceptions) {
                         continue;
                     }
                     $event->id .= '/' . $recurrence_id;
                 }
             } catch (Horde_Icalendar_Exception $e) {
             }
             /* Ignore events out of the period. */
             $recurs = $event->recurs();
             if ($endDate && $event->start->compareDateTime($endDate) > 0 || $startDate && !$recurs && $event->end->compareDateTime($startDate) < 0) {
                 continue;
             }
             if ($recurs && $startDate) {
                 // Fixed end date? Check if end is before start period.
                 if ($event->recurrence->hasRecurEnd() && $event->recurrence->recurEnd->compareDateTime($startDate) < 0) {
                     continue;
                 } elseif ($endDate) {
                     $next = $event->recurrence->nextRecurrence($startDate);
                     if ($next == false || $next->compareDateTime($endDate) > 0) {
                         continue;
                     }
                 }
             }
             $events[] = $event;
         }
     }
     /* Loop through all explicitly defined recurrence intances and create
      * exceptions for those in the event with the matching recurrence. */
     foreach ($events as $key => $event) {
         if ($event->recurs() && isset($exceptions[$event->uid][$event->sequence])) {
             $timestamp = $exceptions[$event->uid][$event->sequence];
             $events[$key]->recurrence->addException(date('Y', $timestamp), date('m', $timestamp), date('d', $timestamp));
         }
         Kronolith::addEvents($results, $event, $startDate, $endDate, $showRecurrence, $json, $coverDates);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:78,代码来源:Ical.php


注:本文中的Horde_Icalendar::getComponents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。