From: fiedorow Date: Mon, 5 Apr 2004 03:13:10 +0000 (+0000) Subject: Bug fix for sort order in category display and allow limit on recursive display of... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9ff5310a081c654e27e3e6124a7bc38062182674;p=moodle.git Bug fix for sort order in category display and allow limit on recursive display of categories and courses --- diff --git a/course/category.php b/course/category.php index a555b2fd94..d33ee5f937 100644 --- a/course/category.php +++ b/course/category.php @@ -205,7 +205,7 @@ /// 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()) { diff --git a/course/lib.php b/course/lib.php index 90895880f5..525c7e4fc0 100644 --- a/course/lib.php +++ b/course/lib.php @@ -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 " "; echo "\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 " ";