示例#1
0
  public function add_event(ICalEvent $event) {
    $uid = $event->get_uid();
    $this->events[$uid] = $event;

    // use event start times so we can return events in starting order
    $this->eventStartTimes[$uid] = $event->get_start();
  }
示例#2
0
 protected function apiArrayFromEvent(ICalEvent $event, $version)
 {
     $standardAttributes = array('datetime', 'start', 'end', 'uid', 'summary', 'description', 'location', 'geo');
     $result = array('id' => $event->get_uid(), 'title' => $event->get_summary(), 'description' => nl2br($event->get_description()), 'start' => $event->get_start(), 'end' => $event->get_end(), 'allday' => $event->isAllDay(), 'location' => $event->get_location(), 'locationLabel' => '');
     // iCal GEO property -- subclass if event lat/lon comes from somewhere else
     $coords = $event->get_location_coordinates();
     if ($coords) {
         $result['latitude'] = $coords['lat'];
         $result['longitude'] = $coords['lon'];
     }
     foreach ($this->fieldConfig as $aField => $fieldInfo) {
         if (in_array($aField, $standardAttributes)) {
             continue;
         }
         // Handled these above
         $id = self::argVal($fieldInfo, 'id', $aField);
         $title = self::argVal($fieldInfo, 'label', $id);
         $section = self::argVal($fieldInfo, 'section', '');
         $type = self::argVal($fieldInfo, 'type', '');
         $value = $event->get_attribute($aField);
         if ($value) {
             if (self::argVal($fieldInfo, 'type', '') == 'category' && is_array($value)) {
                 $value = $this->apiArrayFromCategories($value);
             }
             if ($version < 2) {
                 $result[$title] = $value;
             } else {
                 if (!isset($result['fields'])) {
                     $result['fields'] = array();
                 }
                 $result['fields'][] = array('id' => $id, 'section' => $section, 'type' => $type, 'title' => $title, 'value' => $value);
             }
         }
     }
     return $result;
 }
 public function add_event(ICalEvent $event) {
   $uid = $event->get_uid();
   $this->events[$uid] = $event;
 }
示例#4
0
 public function add_event(ICalEvent $event)
 {
     $uid = $event->get_uid();
     if (is_null($event->get_recurid())) {
         $this->events[$uid] = $event;
         // use event start times so we can return events in starting order
         $this->eventStartTimes[$uid] = $event->get_start();
         // Add any stored exceptions to the event.
         if (isset($this->recurrence_exceptions[$uid])) {
             foreach ($this->recurrence_exceptions[$uid] as $exception) {
                 $this->events[$uid]->addRecurenceException($exception);
             }
         }
     } else {
         // If the event already exists, add the exception to it.
         if (isset($this->events[$uid])) {
             $this->events[$uid]->addRecurenceException($event);
         } else {
             if (!isset($this->recurrence_exceptions[$uid])) {
                 $this->recurrence_exceptions[$uid] = array();
             }
             $this->recurrence_exceptions[$uid][] = $event;
         }
     }
 }