コード例 #1
0
ファイル: Ical.php プロジェクト: rodrigofns/ExpressoLivre3
 /**
  * convert a VCALENDAR into a Tinebase_Record_RecordSet of Calendar_Model_Event
  * 
  * @param   qCal_Component_Vcalendar $component
  * @return  Tinebase_Record_RecordSet of Calendar_Model_Event
  */
 protected function _getEvents(qCal_Component_Vcalendar $component)
 {
     $events = new Tinebase_Record_RecordSet('Calendar_Model_Event');
     // do we have a generic timezone?
     if ($component->hasComponent('VTIMEZONE')) {
         $tz = array_value(0, $component->getComponent('VTIMEZONE'));
         $this->_defaultTimezoneId = array_value(0, $tz->getProperty('TZID'))->getValue();
     } else {
         $this->_defaultTimezoneId = (string) Tinebase_Core::get(Tinebase_Core::USERTIMEZONE);
     }
     foreach ($component->getChildren() as $children) {
         if (is_array($children)) {
             foreach ($children as $child) {
                 if ($child->getName() === 'VEVENT') {
                     $events->addRecord($this->_getEvent($child));
                 }
             }
         } else {
             if ($children->getName() === 'VEVENT') {
                 $events->addRecord($this->_getEvent($children));
             }
         }
     }
     return $events;
 }