fixing a warning when variable is not an object

This commit is contained in:
toyomoyo 2007-09-20 02:45:59 +00:00
parent 55a814399f
commit 8397874d1b

View file

@ -1315,8 +1315,10 @@ function calendar_set_filters(&$courses, &$group, &$user, $courseeventsfrom = NU
foreach($groupcourses as $courseid) {
if (!isset($courseeventsfrom[$courseid]->context)) { // SHOULD be set MDL-11221
if (is_object($courseeventsfrom[$courseid])) {
$courseeventsfrom[$courseid]->context = get_context_instance(CONTEXT_COURSE, $courseid);
}
}
// If the user is an editing teacher in there,
if (!empty($USER->id) && has_capability('moodle/calendar:manageentries', $courseeventsfrom[$courseid]->context)) {