Skip to content

Commit

Permalink
Do not show the category list with courses if there are more than 200…
Browse files Browse the repository at this point in the history
… courses in the system

Otherwise the front page/course list will be flooded with courses.
  • Loading branch information
patrickslee committed Feb 8, 2006
1 parent 70eed35 commit 48643b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions course/lib.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1292,15 +1292,16 @@ function print_category_info($category, $depth) {


$frontpage = explode(',', $CFG->frontpage); $frontpage = explode(',', $CFG->frontpage);
$frontpage = $frontpage?array_flip($frontpage):array(); $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="" />'; $catimage = '<img src="'.$CFG->pixpath.'/i/course.gif" width="16" height="16" border="0" alt="" />';
} else { } else {
$catimage = "&nbsp;"; $catimage = "&nbsp;";
} }


echo "\n\n".'<table border="0" cellpadding="3" cellspacing="0" width="100%">'; 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'); $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>"; echo "<tr>";
Expand Down

0 comments on commit 48643b4

Please sign in to comment.