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.
This commit is contained in:
+3
-2
@@ -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 = " ";
|
||||
@@ -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>";
|
||||
|
||||
Reference in New Issue
Block a user