views:

197

answers:

1

Hi Everyone,

I am currently working on a Google Calendar Sync Feature which is supposed to sync with our own Calendar app and to the Google Calendar app. Now I need to identify the recent changes in Google Calendar so I can copy these events into our Calendar App. I use the zend gdata however any idea I would appreciate.

+2  A: 

(Modified from 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>";
Michael Mior
I think you mean `$refresh_date = date('Y-m-dTH:i:sP', $refresh);`
Stobor
This worked out great! Thanks
drikoda