Skip to content
Browse files

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.
  • Loading branch information...
1 parent 70eed35 commit 48643b4918e2f11405d12c3dc6eaf8a9c97a24d4 patrickslee committed Feb 8, 2006
Showing with 3 additions and 2 deletions.
  1. +3 −2 course/lib.php
View
5 course/lib.php
@@ -1292,15 +1292,16 @@ 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 = '<img src="'.$CFG->pixpath.'/i/course.gif" width="16" height="16" border="0" alt="" />';
} else {
$catimage = "&nbsp;";
}
echo "\n\n".'<table border="0" cellpadding="3" cellspacing="0" width="100%">';
- 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 "<tr>";

0 comments on commit 48643b4

Please sign in to comment.
Something went wrong with that request. Please try again.