Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
authored February 08, 2006

Showing 1 changed file with 3 additions and 2 deletions. Show diff stats Hide diff stats

  1. 5  course/lib.php
5  course/lib.php
@@ -1292,7 +1292,8 @@ function print_category_info($category, $depth) {
1292 1292
 
1293 1293
     $frontpage = explode(',', $CFG->frontpage);
1294 1294
     $frontpage = $frontpage?array_flip($frontpage):array();
1295  
-    if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) {
  1295
+    $coursecount = count_records('course') <= 200;
  1296
+    if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST]) && $coursecount) {
1296 1297
         $catimage = '<img src="'.$CFG->pixpath.'/i/course.gif" width="16" height="16" border="0" alt="" />';
1297 1298
     } else {
1298 1299
         $catimage = "&nbsp;";
@@ -1300,7 +1301,7 @@ function print_category_info($category, $depth) {
1300 1301
 
1301 1302
     echo "\n\n".'<table border="0" cellpadding="3" cellspacing="0" width="100%">';
1302 1303
 
1303  
-    if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST])) {
  1304
+    if (isset($frontpage[FRONTPAGECATEGORYNAMES]) && !isset($frontpage[FRONTPAGECOURSELIST]) && $coursecount) {
1304 1305
         $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');
1305 1306
 
1306 1307
         echo "<tr>";

0 notes on commit 48643b4

Please sign in to comment.
Something went wrong with that request. Please try again.