From 95a892257c89eb089bbe079784c4ec6bd2e99d95 Mon Sep 17 00:00:00 2001 From: defacer Date: Tue, 20 Apr 2004 13:00:39 +0000 Subject: [PATCH] Corrected a bug that prevented admins from seeing events for ALL site courses (today's functionality was not complete yet). Also, minor sorting change to display the course filter sorted by shortname. --- calendar/lib.php | 6 +++++- calendar/view.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 0edc01ad77..010fc016cb 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -1105,9 +1105,13 @@ function calendar_edit_event_allowed($event) { } function calendar_get_default_courses() { - global $USER; + global $USER, $CFG; $courses = array(); + if(isadmin($USER->id)) { + $courses = get_records_sql('SELECT id, 1 FROM '.$CFG->prefix.'course'); + return $courses; + } if(isset($USER->student) && is_array($USER->student)) { $courses = $USER->student + $courses; } diff --git a/calendar/view.php b/calendar/view.php index 511642d7d3..007a97d054 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -556,7 +556,7 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) { $coursesdata = get_courses('all', 'c.shortname'); } else { - $coursesdata = get_my_courses($USER->id); + $coursesdata = get_my_courses($USER->id, 'shortname'); } $coursesdata = array_diff_assoc($coursesdata, array(1 => 1)); -- 2.39.5