Fixing bug # 4567: warning in get_my_courses

This commit is contained in:
mjollnir_
2006-01-12 02:55:59 +00:00
parent 7c5406967d
commit fbcbd77c85
+8 -4
View File
@@ -2259,10 +2259,14 @@ function get_my_courses($userid, $sort='visible DESC,sortorder ASC') {
$course[$student->course] = $student->course;
}
}
$courses = get_records_list('course', 'id', implode(',', $course));
foreach ($courses as $k => $c) {
if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) {
unset($course[$c->id]);
if (count($course) > 0) {
if ($courses = get_records_list('course', 'id', implode(',', $course))) {
foreach ($courses as $k => $c) {
if (empty($USER->admin) && (!$c->visible || !course_parent_visible($c))) {
unset($course[$c->id]);
}
}
}
}
if ($teachers = get_records('user_teachers', 'userid', $userid, '', 'id, course')) {