If you want to retrieve events from a calendar besides the default, you need
to pass an argument to getCalendarEventFeed. The example doesn't illustrate
this.
Ray


On Sat, Apr 19, 2008 at 8:28 AM, ralfe <[EMAIL PROTECTED]> wrote:

>
> Hi,
>
> Thanks for the reply. I initially tried to use those two functions to
> retrieve events, however, the function outputCalendar($client)  only
> seems to retrieve events from the default calendar. I'm trying to work
> out how to retrieve all events from all calendars, not just the
> default calendar, using the php api.
>
> Ralfe
>
> Austin (Google) wrote:
> > Hi,
> >
> > I think it's best to consult the PHP client library dev guide.  There
> > are a lot of sample codes there, especially the one on how to retrieve
> > the list of all your calendar -
> >
> >
> http://code.google.com/apis/calendar/developers_guide_php.html#RetrievingCalendars
> >
> > And this snippet here on how to retrieve events
> >
> >
> http://code.google.com/apis/calendar/developers_guide_php.html#RetrievingEvents
> >
> > Hope it helps,
> > Austin
> >
> > On Fri, Apr 18, 2008 at 2:04 AM, ralfe <[EMAIL PROTECTED]> wrote:
> > >
> > >  Hi,
> > >
> > >  When I retrieve events from multiple calendars, I seem to be getting
> > >  all the events duplicated amongst all the calendar feeds. I'm not
> sure
> > >  if this a problem with my code, or perhaps I'm not understand the
> > >  eventfeeds correctly. Here is the function I have written, please
> > >  advise me what I am doing wrong.
> > >
> > >  Ralfe
> > >
> > >         /**
> > >          * This function retrieves events for all calendars
> > >          *
> > >          * @param date $start_date Starting date for the events to
> retrieve
> > >          * @param date $end_date Ending date for the events to
> retrieve
> > >          */
> > >         function get_events($start_date="", $end_date=""){
> > >                 $y = 0;
> > >                 $this->debug("Retrieving events from calendars.");
> > >                 foreach ($this->calendar_ids as $title => $id){
> > >                         try {
> > >                                 # Create temporary calendar service
> > >                                 $cal =
> $this->service->newEventQuery();
> > >                                 $this->debug("Calendar Feed ['$title']
> : $id.");
> > >
> > >                                 # Set the id of the calendar to query
> > >                                 if(isset($id)){
> > >                                         $cal->setUser($id);
> > >                                 }
> > >                                 else {
> > >                                         $cal->setUser('default');
> > >                                 }
> > >
> > >                                 # Set Query Options
> > >                                 $this->debug("Setting Event Query
> Options.");
> > >                                 $cal->setVisibility('private');
> > >                                 $cal->setProjection('full');
> > >                                 $cal->setOrderby('starttime');
> > >
> > >                                 # Set Time Frame
> > >                                 $this->debug("Setting Time Frame");
> > >                                 if (strlen($start_date) > 1){
> > >                                         $cal->setStartMin($start_date
> . "T00:00:00.000+02:00");
> > >                                         $cal->setStartMax($end_date .
> "T23:59:59.000+02:00");
> > >                                 }
> > >                                 else {
> > >                                         $cal->setFutureevents('true');
> > >                                 }
> > >
> > >                                 # Create Event Feed
> > >                                 $this->debug("Creating Event Feed.");
> > >                                 $event_feed =
> $this->service->getCalendarEventFeed();
> > >
> > >                                 # Populate the Events Array
> > >                                 $this->debug("Retrieving events.");
> > >                                 $x = sizeof($this->events);
> > >                                 foreach ($event_feed as $e){
> > >                                         # Break up When String
> > >                                         if (isset($e->when[0])){
> > >                                                 $when
>                                   = $e->when[0]->__toString();
> > >                                                 $start_date
>                                   = substr($when, 8, 10);
> > >                                                 $start_time
>                                   = substr($when, 19, 8);
> > >                                                 $end_date
>                                   = substr($when, 44, 10);
> > >                                                 $end_time
>                                   = substr($when, 55, 8);
> > >                                         }
> > >                                         else {
> > >                                                 $start_date
>                                   = "";
> > >                                                 $start_time
>                                   = "";
> > >                                                 $end_date
>                                   = "";
> > >                                                 $end_time
>                                   = "";
> > >                                         }
> > >
> > >                                         # Add to Array
> > >                                         $this->debug("Adding '" .
> $e->title . "' to events array.");
> > >                                         $this->events[$x]->title
>                  = $e->title;
> > >                                         $this->events[$x]->location
>                   = $e->where[0]->__toString();
> > >                                         $this->events[$x]->description
>          = $e->content->text;
> > >                                         $this->events[$x]->start_date
>           = $start_date;
> > >                                         $this->events[$x]->start_time
>           = $start_time;
> > >                                         $this->events[$x]->end_date
>                   = $end_date;
> > >                                         $this->events[$x]->end_time
>                   = $end_time;
> > >                                         $this->events[$x]->calendar
>                   = $title;
> > >
> > >                                         # Increment Counter
> > >                                         $x++;
> > >                                 }
> > >                                 $y++;
> > >                         }
> > >                         catch (Zend_Gdata_App_Exception $e){
> > >                                 $this->debug("Retrieving events
> Failed.");
> > >                                 $this->debug("ERROR : " .
> $e->__toString());
> > >                         }
> > >                 }
> > >         }
> > >  >
> > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to