public function sif2vtodo($sif) { $a = Horde_SyncMl_Device_sync4j::sif2array($sif); $iCal = new Horde_Icalendar(); $iCal->setAttribute('PRODID', '-//The Horde Project//SyncML//EN'); $iCal->setAttribute('METHOD', 'PUBLISH'); $vtodo = Horde_Icalendar::newComponent('vtodo', $iCal); $vtodo->setAttribute('SUMMARY', $a['Subject']); $vtodo->setAttribute('DESCRIPTION', $a['Body']); if ($a['Importance'] == 0) { $vtodo->setAttribute('PRIORITY', 5); } elseif ($a['Importance'] == 2) { $vtodo->setAttribute('PRIORITY', 1); } else { $vtodo->setAttribute('PRIORITY', 3); } if (!empty($a['StartDate']) && $a['StartDate'] != '45001231T230000Z') { $vtodo->setAttribute('DTSTART', $iCal->_parseDateTime($a['StartDate'])); } $dueSet = false; if (!empty($a['DueDate']) && $a['DueDate'] != '45001231T230000Z') { $vtodo->setAttribute('DUE', $iCal->_parseDateTime($a['DueDate'])); $dueSet = true; } if (!empty($a['ReminderSet'])) { if (!$dueSet) { $vtodo->setAttribute('DUE', $iCal->_parseDateTime($a['ReminderTime'])); } $vtodo->setAttribute('AALARM', $iCal->_parseDateTime($a['ReminderTime'])); } if (!empty($a['Complete'])) { $vtodo->setAttribute('STATUS', 'COMPLETED'); } $vtodo->setAttribute('CATEGORIES', isset($a['Categories']) ? $a['Categories'] : ''); if (isset($a['Sensitivity'])) { switch ($a['Sensitivity']) { case 0: /* olNormal */ $vtodo->setAttribute('CLASS', 'PUBLIC'); break; case 1: /* olPersonal */ /* olPersonal */ case 2: /* olPrivate */ $vtodo->setAttribute('CLASS', 'PRIVATE'); break; case 3: /* olConfidential */ $vtodo->setAttribute('CLASS', 'CONFIDENTIAL'); break; } } return $vtodo->exportvCalendar(); }