From: defacer Date: Wed, 26 May 2004 11:03:27 +0000 (+0000) Subject: Fix for bug 1462: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7bd1677c72716fbfbe162832a4c99e04f7c73f72;p=moodle.git Fix for bug 1462: Warnings removed. --- diff --git a/calendar/lib.php b/calendar/lib.php index d8e558fa7f..4d1170b2f9 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -120,12 +120,12 @@ function calendar_get_mini($courses, $groups, $users, $cal_month = false, $cal_y // will also set the $SESSION->cal_courses_shown variable to that one course. Otherwise, we 'd need to add extra // arguments to this function. - $courses = array_diff($courses, array(1)); - if(count($courses) == 1) { - $morehref = '&course='.reset($courses); - } - else { - $morehref = ''; + $morehref = ''; + if(!empty($courses)) { + $courses = array_diff($courses, array(1)); + if(count($courses) == 1) { + $morehref = '&course='.reset($courses); + } } // We want to have easy access by day, since the display is on a per-day basis. @@ -305,12 +305,12 @@ function calendar_get_upcoming($courses, $groups, $users, $daysinfuture, $maxeve // will also set the $SESSION->cal_courses_shown variable to that one course. Otherwise, we 'd need to add extra // arguments to this function. - $courses = array_diff($courses, array(1)); - if(count($courses) == 1) { - $morehref = '&course='.reset($courses); - } - else { - $morehref = ''; + $morehref = ''; + if(!empty($courses)) { + $courses = array_diff($courses, array(1)); + if(count($courses) == 1) { + $morehref = '&course='.reset($courses); + } } if($events !== false) {