Permalink
Browse files

Bug fix for sort order in category display and allow limit on recursi…

…ve display of categories and courses
  • Loading branch information...
1 parent 1372c95 commit 9ff5310a081c654e27e3e6124a7bc38062182674 fiedorow committed Apr 5, 2004
Showing with 6 additions and 2 deletions.
  1. +1 −1 course/category.php
  2. +5 −1 course/lib.php
View
@@ -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()) {
View
@@ -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;";

0 comments on commit 9ff5310

Please sign in to comment.