예제 #1
0
 function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
 {
     debugLog('CalDAV::GetMessage(' . $folderid . ', ' . $id . ', ..)');
     if (trim($id) == "") {
         return;
     }
     if ($folderid == "calendar") {
         $output = $this->_events[$id]['data'];
     } elseif ($folderid == "tasks") {
         $output = $this->_tasks[$id]['data'];
     } else {
         return;
     }
     //debugLog("CalDAV::Got File ".$id." now parseing ".$output);
     $v = new vcalendar();
     $v->runparse($output);
     $v->sort();
     if ($folderid == "tasks") {
         while ($vtodo = $v->getComponent('vtodo', $vcounter)) {
             $message = $this->converttotask($vtodo, $truncsize);
             $vcounter++;
         }
     } else {
         $vcounter = 1;
         $fullexceptionsarray = array();
         while ($vevent = $v->getComponent('vevent', $vcounter)) {
             $val = $vevent->getProperty("RECURRENCE-ID");
             if ($val === false) {
                 $message = $this->converttoappointment($vevent, $truncsize);
             } else {
                 $tmp = $this->converttoappointment($vevent, $truncsize);
                 $tmp->deleted = "0";
                 //The exceptionstarttime is the ORIGINAL starttime of the event
                 //On Thunderbird this is equal to the RECCURENCE-ID (which is in $val)
                 $tmp->exceptionstarttime = mktime($val['hour'], $val['min'], $val['sec'], $val['month'], $val['day'], $val['year']);
                 unset($tmp->uid);
                 unset($tmp->exceptions);
                 array_push($fullexceptionsarray, $tmp);
                 unset($tmp);
             }
             $vcounter++;
         }
         $message->exceptions = array_merge($message->exceptions, $fullexceptionsarray);
     }
     if ($vtimezone = $v->getComponent('vtimezone')) {
         $message = $this->setoutlooktimezone($message, $vtimezone);
     }
     debugLog("CalDAV::Finsihed Converting " . $id . " now returning");
     return $message;
 }