]> git.mjollnir.org Git - moodle.git/commitdiff
Bug fix for sort order in category display and allow limit on recursive display of...
authorfiedorow <fiedorow>
Mon, 5 Apr 2004 03:13:10 +0000 (03:13 +0000)
committerfiedorow <fiedorow>
Mon, 5 Apr 2004 03:13:10 +0000 (03:13 +0000)
course/category.php
course/lib.php

index a555b2fd949cd0d56f70a3941707e81a40d89f0d..d33ee5f93728560208cd9b8a928c5d6b4ee45c97 100644 (file)
 
 /// Print out all the sub-categories
 
-    if ($subcategories = get_records("course_categories", "parent", $category->id)) {
+    if ($subcategories = get_records("course_categories", "parent", $category->id), "sortorder ASC") {
         $firstentry = true;
         foreach ($subcategories as $subcategory) {
             if ($subcategory->visible or iscreator()) {
index 90895880f5c4261c77ead89e7d80d57e9a4831d3..525c7e4fc09248a445433da29b0750c8cfdb3063 100644 (file)
@@ -1218,6 +1218,10 @@ function make_categories_list(&$list, &$parents, $category=NULL, $path="") {
 function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1) {
 /// Recursive function to print out all the categories in a nice format 
 /// with or without courses included
+    global $CFG;
+    if (isset($CFG->max_category_depth)&&($depth >= $CFG->max_category_depth)) {
+      return;
+    }
 
     if (!$displaylist) {
         make_categories_list($displaylist, $parentslist);
@@ -1297,7 +1301,7 @@ function print_category_info($category, $depth) {
         echo "<td class=\"categoryname\">&nbsp;</td>";
         echo "</tr>\n";
 
-        if ($courses) {
+        if ($courses && !(isset($CFG->max_category_depth)&&($depth>=$CFG->max_category_depth-1))) {
             foreach ($courses as $course) {
                 $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
                 echo "<tr><td valign=\"top\" width=\"30\">&nbsp;";