From ed05bdfa9d389c8201731cd01def766ad19f16ef Mon Sep 17 00:00:00 2001 From: moodler Date: Sat, 22 May 2004 04:28:36 +0000 Subject: [PATCH] Some cleanups for the courses menu --- calendar/view.php | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/calendar/view.php b/calendar/view.php index dd97d8fcd3..a7e742786e 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -626,30 +626,31 @@ function calendar_print_event_table($event, $starttime, $endtime, &$coursecache, function calendar_course_filter_selector($getvars = '') { global $USER, $SESSION; - if(isguest($USER->id)) { + if (isguest($USER->id)) { return ''; } - if(isadmin($USER->id)) { - $coursesdata = get_courses('all', 'c.shortname'); - } - else { - $coursesdata = get_my_courses($USER->id, 'shortname'); - } + if (isadmin($USER->id)) { + $courses = get_courses('all', 'c.shortname'); - $coursesdata = array_diff_assoc($coursesdata, array(1 => 1)); - $courseoptions = array(1 => get_string('fulllistofcourses')); + } else { + $courses = get_my_courses($USER->id, 'shortname'); + } - foreach($coursesdata as $cdata) { - $courseoptions[$cdata->id] = $cdata->shortname; + foreach ($courses as $course) { + $courseoptions[$course->id] = $course->shortname; } - if(is_numeric($SESSION->cal_courses_shown)) { + $courseoptions[1] = get_string('fulllistofcourses'); + + if (is_numeric($SESSION->cal_courses_shown)) { $selected = $SESSION->cal_courses_shown; - } - else { + } else { $selected = ''; } - $form = popup_form(CALENDAR_URL.'set.php?var=setcourse&'.$getvars.'&id=', $courseoptions, 'cal_course_flt', $selected, '', '', '', true); + + $form = popup_form(CALENDAR_URL.'set.php?var=setcourse&'.$getvars.'&id=', + $courseoptions, 'cal_course_flt', $selected, '', '', '', true); + return str_replace('