MDL-51749 CALENDAR: Add ical export for user or group events
This commit is contained in:
@@ -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'), '<br/>');
|
||||
$mform->addGroupRule('events', get_string('required'), 'required');
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user