diff --git a/calendar/classes/export_form.php b/calendar/classes/export_form.php index 18fbe3336dc..17d8bf75508 100644 --- a/calendar/classes/export_form.php +++ b/calendar/classes/export_form.php @@ -48,6 +48,8 @@ class core_calendar_export_form extends moodleform { $export = array(); $export[] = $mform->createElement('radio', 'exportevents', '', get_string('eventsall', 'calendar'), 'all'); $export[] = $mform->createElement('radio', 'exportevents', '', get_string('eventsrelatedtocourses', 'calendar'), 'courses'); + $export[] = $mform->createElement('radio', 'exportevents', '', get_string('eventsrelatedtogroups', 'calendar'), 'groups'); + $export[] = $mform->createElement('radio', 'exportevents', '', get_string('eventspersonal', 'calendar'), 'user'); $mform->addGroup($export, 'events', get_string('export', 'calendar'), '
'); $mform->addGroupRule('events', get_string('required'), 'required'); diff --git a/calendar/export_execute.php b/calendar/export_execute.php index b999205db52..7767847aa0b 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -40,7 +40,7 @@ $time = optional_param('preset_time', 'weeknow', PARAM_ALPHA); $now = $calendartype->timestamp_to_date_array(time()); // Let's see if we have sufficient and correct data -$allowed_what = array('all', 'courses'); +$allowed_what = array('all', 'user', 'groups', 'courses'); $allowed_time = array('weeknow', 'weeknext', 'monthnow', 'monthnext', 'recentupcoming', 'custom'); if (!empty($generateurl)) { @@ -61,8 +61,7 @@ if(!empty($what) && !empty($time)) { if(in_array($what, $allowed_what) && in_array($time, $allowed_time)) { $courses = enrol_get_users_courses($user->id, true, 'id, visible, shortname'); - if ($what == 'all') { - $users = $user->id; + if ($what == 'all' || $what == 'groups') { $groups = array(); foreach ($courses as $course) { $course_groups = groups_get_all_groups($course->id, $user->id); @@ -71,8 +70,18 @@ if(!empty($what) && !empty($time)) { if (empty($groups)) { $groups = false; } + } + if ($what == 'all') { + $users = $user->id; $courses[SITEID] = new stdClass; $courses[SITEID]->shortname = get_string('globalevents', 'calendar'); + } else if ($what == 'groups') { + $users = false; + $courses = array(); + } else if ($what == 'user') { + $users = $user->id; + $groups = false; + $courses = array(); } else { $users = false; $groups = false; diff --git a/lang/en/calendar.php b/lang/en/calendar.php index f60a5bf6719..98583927982 100644 --- a/lang/en/calendar.php +++ b/lang/en/calendar.php @@ -86,7 +86,9 @@ $string['eventsimported'] = 'Events imported: {$a}'; $string['eventsupdated'] = 'Events updated: {$a}'; $string['eventsfor'] = '{$a} events'; $string['eventskey'] = 'Events key'; +$string['eventspersonal'] = 'My personal events'; $string['eventsrelatedtocourses'] = 'Events related to courses'; +$string['eventsrelatedtogroups'] = 'Events related to groups'; $string['eventstarttime'] = 'Start time'; $string['eventtime'] = 'Time'; $string['eventview'] = 'Event details'; @@ -215,4 +217,3 @@ $string['weeknext'] = 'Next week'; $string['weekthis'] = 'This week'; $string['yesterday'] = 'Yesterday'; $string['youcandeleteallrepeats'] = 'This event is part of a repeating event series. You can delete this event only, or all {$a} events in the series at once.'; -