Results 1 to 3 of 3

Thread: GDATA : how to get an other calendar than the default one ?

  1. #1
    wene is offline 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.

  2. #2
    wene is offline 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.

  3. #3
    superheap is offline 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
    }

Similar Threads

  1. Integrate a Calendar
    By enkara in forum Integration with Third party tools
    Replies: 9
    Last Post: 07-29-2010, 01:43 PM
  2. need a good calendar
    By krapspark in forum General Q&A on Zend Framework
    Replies: 1
    Last Post: 04-01-2009, 11:48 PM
  3. Calendar: Get URL of Entry ?
    By spookt in forum Web & Web Services
    Replies: 0
    Last Post: 11-08-2008, 08:23 PM
  4. Add Guests to calendar events with Zend Gdata
    By gijs73 in forum Web & Web Services
    Replies: 0
    Last Post: 05-13-2008, 01:23 PM
  5. Gdata Calendar: event color
    By jetbaron in forum General Q&A on Zend Framework
    Replies: 0
    Last Post: 01-21-2008, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •