caldav::calendars proc get_calitems (public)
caldav::calendarsget_calitems [ -user_id user_id ] \ [ -start_date start_date ] [ -end_date end_date ] \ [ -calendar_ids calendar_ids ]
Defined in packages/xotcl-core/tcl/01-debug-procs.tcl
Get feed of calendar items for a given user.
- Switches:
- -user_id (optional, integer)
- -start_date (optional)
- -end_date (optional)
- -calendar_ids (optional, integer)
- Returns:
- list set of calendar item objects
- Testcases:
- No testcase defined.
Source code: # # Get feed of calendar items for a given user. # # @return list set of calendar item objects :debug "get_calitems [current args]" if {$start_date ne "" && $end_date ne ""} { set time_limitation_clause [subst { and start_date between to_timestamp('$start_date','YYYY-MM-DD HH24:MI:SS') and to_timestamp('$end_date', 'YYYY-MM-DD HH24:MI:SS') }] } else { set time_limitation_clause "" } set eventlist {} set recurrences {} # # Note that we can have items without a entry in cal_uids for # these we will use the activity_id as uid calendars of # communities, personal calendars, and public calendars in the # same package as the personal calendar- # foreach item [::xo::dc list_of_lists cal_items [subst { select md5(last_modified::text) as etag, coalesce(cal_uid, e.activity_id::varchar), ical_vars, on_which_calendar, c.item_type_id, to_char(start_date, 'YYYY-MM-DD HH24:MI:SS'), to_char(end_date, 'YYYY-MM-DD HH24:MI:SS'), coalesce(e.name, a.name), coalesce(e.description, a.description), c.cal_item_id, recurrence_id, creation_date, last_modified from acs_objects ao, acs_events e left outer join cal_uids u on u.on_which_activity = e.activity_id, acs_activities a, timespans s, time_intervals t, cal_items c where e.event_id = ao.object_id and a.activity_id = e.activity_id and c.cal_item_id = e.event_id and e.timespan_id = s.timespan_id and s.interval_id = t.interval_id $time_limitation_clause [:calendar_clause -calendar_ids $calendar_ids -user_id $user_id] order by start_date asc }]] { lassign $item etag cal_uid ical_vars calendar_id item_type start_date end_date name description cal_item_id recurrence_id creation_date last_modified #ns_log notice "get_calitems: item $cal_item_id calendar $calendar_id" "we got an recurrence <$recurrence_id>" if {$recurrence_id ne "" && $recurrence_id in $recurrences} { # # Don't report calendar items with recurrence multiple # times. # continue } set caldavItem [::caldav::calitem new -uid $cal_uid -ical_vars $ical_vars -etag $etag -creation_date $creation_date -last_modified $last_modified -dtstart $start_date -is_day_item [dt_no_time_p -start_time $start_date -end_time $end_date] -formatted_recurrences [:format_recurrence -recurrence_id $recurrence_id] -dtend $end_date -summary $name -description $description ] $caldavItem destroy_on_cleanup lappend eventlist $caldavItem lappend recurrences $recurrence_id } return $eventlistXQL Not present: Generic, PostgreSQL, Oracle