]> git.mjollnir.org Git - moodle.git/commitdiff
Some cleanups for the courses menu
authormoodler <moodler>
Sat, 22 May 2004 04:28:36 +0000 (04:28 +0000)
committermoodler <moodler>
Sat, 22 May 2004 04:28:36 +0000 (04:28 +0000)
calendar/view.php

index dd97d8fcd3e4c5fc06b664ca5e4a9f234d27f775..a7e742786e889c87d038e4fd266b6d46248c3f18 100644 (file)
@@ -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&amp;'.$getvars.'&amp;id=', $courseoptions, 'cal_course_flt', $selected, '', '', '', true);
+
+    $form = popup_form(CALENDAR_URL.'set.php?var=setcourse&amp;'.$getvars.'&amp;id=', 
+                       $courseoptions, 'cal_course_flt', $selected, '', '', '', true);
+
     return str_replace('<form', '<form style="display: inline;"', $form);
 }