]> git.mjollnir.org Git - moodle.git/commitdiff
FIxed some holes with hidden categories bug 1093
authormoodler <moodler>
Sat, 20 Mar 2004 12:21:08 +0000 (12:21 +0000)
committermoodler <moodler>
Sat, 20 Mar 2004 12:21:08 +0000 (12:21 +0000)
course/category.php
lang/en/error.php

index 619b91d6fcb642d9a58b9d0a599f405560cf9b98..a555b2fd949cd0d56f70a3941707e81a40d89f0d 100644 (file)
@@ -33,6 +33,9 @@
         $adminediting = (isadmin() and $creatorediting);
 
     } else {
+        if (!$category->visible) {
+            error(get_string('notavailable', 'error'));
+        }
         $navbaritem = print_course_search("", true, "navbar");
         $adminediting = false;
         $creatorediting = false;
 /// Print out all the sub-categories
 
     if ($subcategories = get_records("course_categories", "parent", $category->id)) {
-        echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\">";
-        echo "<tr><th>".get_string("subcategories")."</th></tr>";
-        echo "<tr><td nowrap>";
+        $firstentry = true;
         foreach ($subcategories as $subcategory) {
-            echo "<a href=\"category.php?id=$subcategory->id\">$subcategory->name</a><br />";
+            if ($subcategory->visible or iscreator()) {
+                if ($firstentry) {
+                    echo "<table align=\"center\" border=0 cellspacing=2 cellpadding=4 class=\"generalbox\">";
+                    echo "<tr><th>".get_string("subcategories")."</th></tr>";
+                    echo "<tr><td nowrap>";
+                    $firstentry = false;
+                }
+                $catlinkcss = $subcategory->visible ? "" : " class=\"dimmed\" ";
+                echo "<a $catlinkcss href=\"category.php?id=$subcategory->id\">$subcategory->name</a><br />";
+            }
+        }
+        if (!$firstentry) {
+            echo "</td></tr></table>";
+            echo "<br />";
         }
-        echo "</td></tr></table>";
-        echo "<br />";
     }
     
 
index 4792e9903ca475988b50e5cf01472977c53adca7..2daf7401db55f5b530ad33495cec5eed6f3ecddc 100755 (executable)
@@ -9,6 +9,7 @@ $string['groupunknown'] = 'Group $a not associated to specified course';
 $string['invalidfieldname'] = '\"$a\" is not a valid field name';
 $string['missingfield'] = 'Field \"$a\" is missing';
 $string['modulerequirementsnotmet'] = 'Module \"$a->modulename\" ($a->moduleversion) could not be installed.  It requires a newer version of Moodle (currently you are using $a->currentmoodle, you need $a->requiremoodle).';
+$string['notavailable'] = 'That is not currently available';
 $string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that.';
 $string['unknowncourse'] = 'Unknown course named \"$a\"';
 $string['usernotaddederror'] = 'User \"$a\" not added - unknown error';