0

我目前正在开发一个谷歌日历同步功能,它应该与我们自己的日历应用程序和谷歌日历应用程序同步。现在我需要识别 Google 日历中最近的更改,以便将这些事件复制到我们的日历应用程序中。我使用 zend gdata,但是我会很感激任何想法。

4

1 回答 1

2

(修改自http://framework.zend.com/manual/en/zend.gdata.calendar.html

$query = $service->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');

// Subtract time frame for when you want to detect
// updated events, for example, in the past 24 hrs
$refresh = time() - 60*60*24;
$refresh_date = date('Y-m-dTH:i:sP', $refresh);

$query->setUpdatedMin($refresh_date);


// Retrieve the event list from the calendar server
try {
    $eventFeed = $service->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getMessage();
}

// Iterate through the list of events, outputting them as an HTML list
echo "<ul>";
foreach ($eventFeed as $event) {
    echo "<li>" . $event->title . " (Event ID: " . $event->id . ")</li>";
}
echo "</ul>";
于 2009-08-18T02:40:18.823 回答