Hi,
This is the particular code in question :
$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++;
}
The line ( $cal->setUser($id); ) is where I set the feed for the
particular calendar. However, no matter which feed I use, all the
events for all calendars seem to be returned in that single feed.
Does anyone know why this might be happening?
Ralfe
On Apr 22, 9:52 am, "Ray Baxter" <[EMAIL PROTECTED]> wrote:
> On Mon, Apr 21, 2008 at 10:58 PM, ralfe <[EMAIL PROTECTED]> wrote:
>
> > The problem is not that I get all events for all calendars. The
> > problem is that I get all events for all calendars in every single
> > eventsfeed. What ends up happening is that, as I loop through the
> > calandar eventfeeds, I end up getting duplicate entries. The problem
> > with this is that I would like to distinguish between the events from
> > the different feeds. This is imposible at the moment for me, as all
> > events appear in all feeds.
>
> If you are sure that your data is correct (events are not duplicated on
> multiple calendars) then there is a bug in your code.
>
> The only code that you showed is pulling all events for all calendars. If
> you show code that you believe should be pulling from only a single
> calender, maybe someone will have some ideas.
>
> Ray
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---