From 941939ef51bfc227260d19b0692b87a60ed1f53b Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 19 Jun 2008 17:57:57 +0000 Subject: [PATCH] MDL-13229 - Cannot export group events - now make it export group events if 'all' is selected. --- calendar/export_execute.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/calendar/export_execute.php b/calendar/export_execute.php index 001a2c12f1..e2cd72c5b3 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -30,12 +30,19 @@ $allowed_time = array('weeknow', 'weeknext', 'monthnow', 'monthnext', 'recentupc if(!empty($what) && !empty($time)) { if(in_array($what, $allowed_what) && in_array($time, $allowed_time)) { $courses = get_my_courses($user->id, NULL, 'id, visible, shortname'); - - $include_user = ($what == 'all'); - if ($include_user) { - //Also include site (global) events + + if ($what == 'all') { + $users = $user->id; + $groups = array(); + foreach ($courses as $course) { + $course_groups = groups_get_all_groups($course->id, $user->id); + $groups = $groups + array_keys($course_groups); + } $courses[SITEID] = new stdClass; $courses[SITEID]->shortname = get_string('globalevents', 'calendar'); + } else { + $users = false; + $groups = false; } switch($time) { @@ -99,7 +106,7 @@ if(!empty($what) && !empty($time)) { die(); } } -$events = calendar_get_events($timestart, $timeend, $include_user ? array($user->id) : false, false, array_keys($courses), false); +$events = calendar_get_events($timestart, $timeend, $users, $groups, array_keys($courses), false); $ical = new iCalendar; $ical->add_property('method', 'PUBLISH'); -- 2.39.5