From 393cc5088b6a8a507be79a632892d660282588d0 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 15 Dec 2002 06:00:58 +0000 Subject: [PATCH] Improved course listing display when no courses --- course/lib.php | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/course/lib.php b/course/lib.php index 2aa0eae400..f5a35ddd6e 100644 --- a/course/lib.php +++ b/course/lib.php @@ -196,10 +196,10 @@ function print_all_courses($category="all", $style="full", $maxcount=999, $width $courses = get_records("course", "category", $category, "fullname ASC"); } - if ($courses) { - if ($style == "minimal") { - $count = 0; - $icon = "\"".get_string("course")."\""; + if ($style == "minimal") { + $count = 0; + $icon = "\"".get_string("course")."\""; + if ($courses) { foreach ($courses as $course) { $moddata[]="shortname\" HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname"; $modicon[]=$icon; @@ -208,17 +208,21 @@ function print_all_courses($category="all", $style="full", $maxcount=999, $width } } $fulllist = "

wwwroot/course/\">".get_string("fulllistofcourses")."..."; - print_side_block(get_string("courses"), "", $moddata, $modicon, $fulllist, $width); - } else { - foreach ($courses as $course) { - print_course($course); - echo "
\n"; - } + $moddata = array(); + $modicon = array(); + $fulllist = get_string("nocoursesyet"); + } + print_side_block(get_string("courses"), "", $moddata, $modicon, $fulllist, $width); + + } else if ($courses) { + foreach ($courses as $course) { + print_course($course); + echo "
\n"; } } else { - echo "

".get_string("nocoursesyet")."

"; + echo "

".get_string("nocoursesyet")."

"; } } -- 2.39.5