MDL-27295 Course Category View - Only display count when more than 0 courses
authorDan Poltawski <dan.poltawski@luns.net.uk>
Sat, 6 Aug 2011 21:12:07 +0000 (22:12 +0100)
committerDan Poltawski <dan.poltawski@luns.net.uk>
Fri, 30 Sep 2011 10:59:58 +0000 (11:59 +0100)
course/lib.php

index f3c81f7..a00348f 100644 (file)
@@ -2265,7 +2265,9 @@ function print_category_info($category, $depth=0, $showcourses = false) {
         echo '<div class="categorylist">';
         $html = '';
         $cat = html_writer::link(new moodle_url('/course/category.php', array('id'=>$category->id)), $fullname, $catlinkcss);
-        $cat .= html_writer::tag('span', ' ('.count($courses).')', array('title'=>get_string('numberofcourses'), 'class'=>'numberofcourse'));
+        if (count($courses) > 0) {
+            $cat .= html_writer::tag('span', ' ('.count($courses).')', array('title'=>get_string('numberofcourses'), 'class'=>'numberofcourse'));
+        }
 
         if ($depth > 0) {
             for ($i=0; $i< $depth; $i++) {