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:
patrickslee
2006-02-08 03:34:20 +00:00
parent 70eed352e6
commit 48643b4918
+3 -2
View File
@@ -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>";