2 messages in com.googlegroups.google-calendar-help-dataapiRe: Getting timezone and "where" from...
FromSent OnAttachments
Daniel Karp21 Mar 2008 07:51 
Austin (Google)22 Mar 2008 13:24 
Subject:Re: Getting timezone and "where" from public calendars using Zend?
From:Austin (Google) (api.@google.com)
Date:03/22/2008 01:24:34 PM
List:com.googlegroups.google-calendar-help-dataapi

Hi,

Unfotunately, since you are accessing the calendar entry directly, you would access them the way you do by using the extension elements.

But if you have subscribed to this public calendar, you can use the getCalendarListFeed(), then you will have convenience methods to access the timezone and where array. This is a code snippet of how to get to those information using getCalendarListFeed() -

function listAllCalendar() {

global $gdataCal;

// get list feed of calendars $uri = 'http://www.google.com/calendar/feeds/default/allcalendars/full';

$calFeed = $gdataCal->getCalendarListFeed();

foreach ($calFeed as $calendar) { echo $calendar->title->text . '<br>'; echo $calendar->getTimezone()->value . '<br>';

foreach ($calendar->where as $where) { echo $where->valueString . '<br>'; } } }

Hope it helps, Austin

On Fri, Mar 21, 2008 at 7:51 AM, Daniel Karp <dani@gmail.com> wrote:

I'm hoping to find a more elegant solution to a problem I've already solved sort of the hard way. I'm trying to get information from public calendar feeds, including timezone and "where". My code currently is:

$gdata = new Zend_Gdata(); $query= new Zend_Gdata_Query($args['gcalcalendarid']); $feed = $gdata->getFeed($query); $calendar['title'] = $feed->title->text; $calendar['description'] = $feed->subtitle->text; foreach ( $feed->extensionElements as $element ) { if ($element->rootElement == 'timezone') { $calendar['timezone'] = $element->extensionAttributes['value'] ['value']; } if ($element->rootElement == 'where') { $calendar['location'] = $element->extensionAttributes['valueString'] ['value']; } } return $calendar;

This definitely works, but there must be a better way to get at those namespaced elements other than drilling down through object like that. I haven't been able to find anything that works for me in the documentation, though. Any thoughts?