Skip to content

Commit

Permalink
Show category list rather than the whole list of courses if there is …
Browse files Browse the repository at this point in the history
…only one category and with more than 200 courses in it

Otherwise we will have a HUGE list of courses flooding our browser.
  • Loading branch information
patrickslee committed Feb 8, 2006
1 parent 6aa427a commit 71397cc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion blocks/course_list/block_course_list.php
Expand Up @@ -53,7 +53,7 @@ function get_content() {

$categories = get_categories("0"); // Parent = 0 ie top-level categories only
if ($categories) { //Check we have categories
if (count($categories) > 1) { // Just print top level category links
if (count($categories) > 1 || (count($categories) == 1 && count_records('course') > 200)) { // Just print top level category links
foreach ($categories as $category) {
$linkcss = $category->visible ? "" : " class=\"dimmed\" ";
$this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">$category->name</a>";
Expand Down
2 changes: 1 addition & 1 deletion course/index.php
Expand Up @@ -31,7 +31,7 @@
if (!$adminediting) {
$countcategories = count_records("course_categories");

if ($countcategories > 1) {
if ($countcategories > 1 || ($countcategories == 1 && count_records('course') > 200)) {
$strcourses = get_string("courses");
$strcategories = get_string("categories");
print_header("$site->shortname: $strcategories", $strcourses,
Expand Down
3 changes: 2 additions & 1 deletion index.php
Expand Up @@ -155,7 +155,8 @@
print_heading_block(get_string('mycourses'));
print_my_moodle();
} else {
if (count_records('course_categories') > 1) {
$countcategories = count_records('course_categories');
if ($countcategories > 1 || ($countcategories == 1 && count_records('course') > 200)) {
if ($CFG->frontpage == FRONTPAGECOURSELIST) {
print_heading_block(get_string('availablecourses'));
} else {
Expand Down

0 comments on commit 71397cc

Please sign in to comment.