From: defacer Date: Thu, 1 Apr 2004 12:51:24 +0000 (+0000) Subject: Following Eloy's suggestion and Martin's clarification, the wizard is going X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2b10fcf5a8d81dd9c1b370233c128464b7f418fc;p=moodle.git Following Eloy's suggestion and Martin's clarification, the wizard is going to demonstrate a feat where 10 lines of code turn into 2, and a global var dependency vanishes at the same time! ;) --- diff --git a/calendar/view.php b/calendar/view.php index fc3c2d6317..1ca4799421 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -337,7 +337,7 @@ function calendar_show_day($d, $m, $y, $courses, $groups, $users) { function calendar_show_month_detailed($m, $y, $courses, $groups, $users) { global $CFG, $SESSION, $USER; - global $day, $mon, $yr, $defaultcourses; + global $day, $mon, $yr; $getvars = 'from=month&cal_d='.$day.'&cal_m='.$mon.'&cal_y='.$yr; // For filtering @@ -549,16 +549,8 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) { } echo 'style="width: 8px;">'.get_string('courseevents', 'calendar').': '; - $defaultcourses = array_diff_assoc($defaultcourses, array(1 => 1)); // Filter the site out - $getcourses = array_keys($defaultcourses); - - if(!empty($getcourses)) { - $select = 'id IN ('.implode(',', $getcourses).')'; - $coursesdata = get_records_select('course', $select, 'fullname'); - } - else { - $coursedata = false; - } + $coursesdata = get_my_courses($USER->id); + $coursesdata = array_diff_assoc($coursesdata, array(1 => 1)); echo ''; echo '';