Zend Framework Forum

Go Back   Zend Framework Forum > Zend Framework Components > Web & Web Services

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-23-2007, 01:03 AM
Junior Member
 
Join Date: Aug 2007
Posts: 4
Question GDATA : how to get an other calendar than the default one ?

hello
everything is in the title
i need to get events from another cal than the default one.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-23-2007, 02:43 AM
Junior Member
 
Join Date: Aug 2007
Posts: 4
Thumbs up

i see that the question is reccurent.
i have found a way to have an answer.

using the calendar link :

Code:
// get the calendars list feed

$gdataCal = new Zend_Gdata_Calendar($client);
$calFeed = $gdataCal->getCalendarListFeed();

// get the calendar url (0 is first one, then 1 is second one etc...)

$url = $calFeed[1]->link[0]->href;

// ask for feeds

$events = $gdataCal->getCalendarEventFeed($url);
....
the same using queries :

Code:
// get the calendars list feed

$gdataCal = new Zend_Gdata_Calendar($client);
$calFeed = $gdataCal->getCalendarListFeed();

// get the calendar user ( $cals[1] for the first calendar... )

$id = $cals[1]->id->text;
$user = str_replace(Zend_Gdata_Calendar::CALENDAR_FEED_URI.'/default/', "", $id); // kind of dirty way to get the info, nut it lokks working :)

// ask for feeds

$query->setUser($user);
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');
$events = $gdataCal->getCalendarEventFeed($query);
......

Last edited by wene; 08-23-2007 at 04:04 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-09-2010, 05:46 AM
Junior Member
 
Join Date: Mar 2010
Posts: 1
Default

There is a cleaner way to use queries. Get the URL, and pass it as a parameter in the newEventQuery() constructor. The trick is to then set user, projection, and visibility to NULL or they will be set twice (they are already in the URL)

See the API docs - specifically the constructor

$gdataCal = new Zend_Gdata_Calendar($client);
$calFeed = $gdataCal->getCalendarListFeed(); // get all calendars the user has created

Code:
	foreach ($calFeed as $calendar) {
		$url = $calendar->link[0]->href;
		 $query = $gdataCal->newEventQuery( $url );
		 $query->setUser(NULL); 
		 $query->setVisibility(NULL);
		 $query->setProjection(NULL); 
		 $query->setOrderby('starttime');
		$query->setStartMin($startDate);
		$query->setStartMax($endDate);
		$eventFeed = $gdataCal->getCalendarEventFeed($query); 
                //… do something with $eventFeed
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 03:00 AM.


Designed by: Miner Skinz Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0