Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit 48643b4918e2f11405d12c3dc6eaf8a9c97a24d4 1 parent 70eed35
patrickslee authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 course/lib.php
5 course/lib.php
View
@@ -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 = '<img src="'.$CFG->pixpath.'/i/course.gif" width="16" height="16" border="0" alt="" />';
} else {
$catimage = "&nbsp;";
@@ -1300,7 +1301,7 @@ function print_category_info($category, $depth) {
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>";
Please sign in to comment.
Something went wrong with that request. Please try again.