public function add_event(CalendarEvent $event)
 {
     $athleticEvent = new AthleticEvent();
     $athleticEvent->setID($event->getID());
     $athleticEvent->setTitle($event->get_summary());
     $athleticEvent->setDescription($event->get_description());
     $athleticEvent->setLocation($event->get_location());
     $athleticEvent->setStartDate(new DateTime("@" . $event->get_start()));
     $this->addEvent($athleticEvent);
 }
 protected function apiArrayFromEvent(CalendarEvent $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;
 }
 protected function convertEventToEventDataObject(CalendarEvent $eventObject)
 {
     $event = new EventDataObject();
     $event->setID($eventObject->get_uid());
     $event->setTitle($eventObject->get_summary());
     $event->setRange($eventObject->get_range());
     $event->setStart($eventObject->get_start());
     $event->setEnd($eventObject->get_end());
     $event->setDescription($eventObject->get_description());
     return $event;
 }