I had a long detailed question about how to get a specific calendar's event feed, but figured (I think) a solution out before I posted. However, even with the solution I'm left wondering what I'm missing about this process. To get a single calendar's event feed (or to search that feed) I do the following:
Why do I have to manipulate the ID? It seems like the documentation for Zend_Gdata is spread over both Google's and Zend's sites. I haven't located a good reference on available properties from getCalendarListFeed(), so maybe I should grab something other than the ID?
It seems like there has to be more straightforward way - what am I missing here?
I was looking for an answer to this same question and eventually came up with the following:
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$Client = Zend_Gdata_ClientLogin::getHttpClient('googleaccount','googlepass',$service);
$Service = new Zend_Gdata_Calendar($Client);
$Query = $Service->newEventQuery();
$Query->setUser('calendarid'); # As you know, you can obtain this with getCalendarListFeed()
$Query->setVisibility('public');
$Query->setProjection('full');
$Query->setOrderby('starttime');
$Query->setFutureevents('true');
The part that threw me off at first was that the "user" portion of the call is actually the calendar ID. Then you can do something like:
$events = $Service->getCalendarEventFeed($Query);
foreach ($events as $Event)
{
// work with Event object here...
}
(The above should really be enclosed in a try/catch, but I'm too lazy to do that here.)
You don't have to manipulate the ID.
If you look at the protocol guide, there's a <link rel="alternate" .../>
element which contains the URL you want.
In the PHP client, you can retrieve this link by calling:
// $entry is an instance of Zend_Gdata_Calendar_ListEntry
$link = $entry->getAlternateLink()->getHref();
Also, the documentation you're looking for is here: http://framework.zend.com/apidoc/1.9/Zend_Gdata/Calendar/Zend_Gdata_Calendar_ListEntry.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With