--- /home/mayank/Desktop/moodle/course/lib.php 2009-04-15 16:25:38.000000000 +0530 +++ lib.php 2009-04-15 17:26:37.000000000 +0530 @@ -1731,7 +1731,7 @@ } } -function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1, $showcourses = true) { +function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1, $showcourses = true, $coursescount=NULL) { /// Recursive function to print out all the categories in a nice format /// with or without courses included global $CFG; @@ -1747,13 +1747,14 @@ if ($category) { if ($category->visible or has_capability('moodle/category:viewhiddencategories', get_context_instance(CONTEXT_SYSTEM))) { - print_category_info($category, $depth, $showcourses); + print_category_info($category, $depth, $showcourses,$coursescount); } else { return; // Don't bother printing children of invisible categories } } else { - $category->id = "0"; + $category->id = "0"; + $coursescount = count_records('course'); } if ($categories = get_child_categories($category->id)) { // Print all the children recursively @@ -1770,7 +1771,7 @@ $down = $last ? false : true; $first = false; - print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1, $showcourses); + print_whole_category_list($cat, $displaylist, $parentslist, $depth + 1, $showcourses, $coursescount); } } } @@ -1791,7 +1792,7 @@ return $cats; } -function print_category_info($category, $depth, $showcourses = false) { +function print_category_info($category, $depth, $showcourses = false, $coursescount) { /// Prints the category info in indented fashion /// This function is only used by print_whole_category_list() above @@ -1806,7 +1807,7 @@ $catlinkcss = $category->visible ? '' : ' class="dimmed" '; - $coursecount = count_records('course') <= FRONTPAGECOURSELIMIT; + $coursecount = $coursescount <= FRONTPAGECOURSELIMIT; if ($showcourses and $coursecount) { $catimage = ''; } else {