Hey Everyone,
So what I'm trying to do is create a short event feed on my website
that will come from events defined on my public google calendar.
Basically I'm just interested in the event name, start time, location
and a link to the event's page
http://www.google.com/calendar/event?eid=something.
The first part I have down but I can't seem to get the EID from the
zend gdata api that we're using. I've heard that the entire link to
the event's page can be found in the atom's link element where
rel='alternate' but I haven't been able to retrieve it. Does anyone
know how to retrieve this?
Here is the entirety (slightly edited) of my script. FYI its intended
to return data in JSON format.
<?php
require_once '../system.php';
require_once '../configuration.php';
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
global $EventsCalendar;
function parseGoogleTime($time) {
//... Simply takes the time provided by Google (one of the
ISO formats I think?), parses it and returns it as a formatted string
}
$gdataCal = new Zend_Gdata_Calendar();
$query = $gdataCal->newEventQuery();
$query->setUser($EventsCalendar);
$query->setVisibility('public');
$query->setProjection('full-noattendees');
$query->setOrderby('starttime');
$query->setSingleEvents('true');
$eventFeed = $gdataCal->getCalendarEventFeed($query);
$data = array();
foreach ($eventFeed as $event) {
$current = array();
$current['title'] = $event->title->text;
//$current['url'] = $event->id->text;
$current['url'] = $event->getAlternateLink();
$when = $event->when[0];
$current['start'] = parseGoogleTime($when->startTime);
$current['end'] = parseGoogleTime($when->endTime);
$where = $event->getWhere();
$current['where'] = $where[0]->getValueString();
$data[] = $current;
}
header("mime-type: application/json");
echo json_encode($data);
?>
By the way I'm really not all that familiar with Zend so its totally
possible I'm reading the documentation wrongly or I'm using it
improperly.
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---