From 48643b4918e2f11405d12c3dc6eaf8a9c97a24d4 Mon Sep 17 00:00:00 2001 From: patrickslee Date: Wed, 8 Feb 2006 03:34:20 +0000 Subject: [PATCH] Do not show the category list with courses if there are more than 200 courses in the system Otherwise the front page/course list will be flooded with courses. --- course/lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/course/lib.php b/course/lib.php index d7558ab8f22..4f6903e79e5 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1292,7 +1292,8 @@ function print_category_info($category, $depth) { $frontpage = explode(',', $CFG->frontpage); $frontpage = $frontpage?array_flip($frontpage):array(); - if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) { + $coursecount = count_records('course') <= 200; + if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST]) && $coursecount) { $catimage = ''; } else { $catimage = " "; @@ -1300,7 +1301,7 @@ function print_category_info($category, $depth) { echo "\n\n".''; - if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) { + if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST]) && $coursecount) { $courses = get_courses($category->id, 'c.sortorder ASC', 'c.id,c.sortorder,c.visible,c.fullname,c.shortname,c.password,c.summary,c.guest,c.cost,c.currency'); echo "";