2010-07-09 162 views
1

我正在嘗試使用Google日曆獲取ical feed,但我似乎無法正確理解。我使用PHP iCalcreator類(http://www.kigkonsult.se/iCalcreator/index.php),這裏是我使用的代碼:PHP/ICAL/Google日曆

<?php 

require_once APP_ROOT . '/lib/icalcreator.class.php'; 

$user = new User; 
$user->Get(1); 

$v = new vcalendar(); // create a new calendar instance 
$v->setConfig('unique_id', 'Domain ' . $user->id); // set Your unique id 
$v->setProperty('method', 'PUBLISH'); // required of some calendar software 
$v->setProperty('X-WR-CALNAME;VALUE=TEXT', 'My Calendar'); 
$v->setProperty('X-WR-CALDESC', 'The description'); 

$tasks = $user->GetTasks(); 

foreach ($tasks as $task) { 

    $vevent = new vevent(); // create an event calendar component 
    $year = date('Y', strtotime($task->due)); 
    $month = date('m', strtotime($task->due)); 
    $day = date('d', strtotime($task->due)); 
    $hour = date('H', strtotime($task->due)); 
    $min = date('i', strtotime($task->due)); 
    $sec = date('s', strtotime($task->due)); 

    $vevent = new vevent(); 
    $vevent->setProperty('dtstart', array('year'=> $year, 'month'=> $month, 'day'=> $day, 'hour'=> $hour, 'min'=> $min, 'sec'=> $sec)); 
    $vevent->setProperty('dtend', array('year'=> $year, 'month'=> $month, 'day'=> $day, 'hour'=> $hour, 'min'=> $min, 'sec'=> $sec)); 
    $vevent->setProperty('summary', $task->subject); 
    $vevent->setProperty('description', "Description of the task"); 
    $v->setComponent($vevent); 
} 

$v->returnCalendar(); 

?> 

的問題是,總結和說明日曆不來通過,以及每個事件的說明不通過。

任何想法是怎麼回事?

回答

0

我不能說說明,但我發現一個錯誤,在'總結'不會輸出,但'摘要'作爲屬性名稱將輸出。我一直試圖讓自己在谷歌工作,但無濟於事。我確實有'描述'與您的'描述'相同,所以我不確定爲什麼這不是爲您輸出。