]> git.mjollnir.org Git - moodle.git/commitdiff
user/view: show user courses that are hidden, with dimmed class
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:21:47 +0000 (07:21 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:21:47 +0000 (07:21 +0000)
If the $USER can see them, there is no reason to hide courses that
may be hidden. But show them dimmed to indicate so.

user/view.php

index 00491b285d6679be3ed386b816307cd6e6546caf..0dc5e48529c0783ede73af5158b63b0168e8a90f 100644 (file)
         $shown=0;
         $courselisting = '';
         foreach ($mycourses as $mycourse) {
-            if ($mycourse->visible and $mycourse->category) {
+            if ($mycourse->category) {
                 if ($mycourse->id != $course->id){
-                    $courselisting .= "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$mycourse->id\">"
+                    $class = '';
+                    if ($mycourse->visible == 0) {
+                        // get_my_courses will filter courses $USER cannot see
+                        // if we get one with visible 0 it just means it's hidden
+                        // ... but not from $USER
+                        $class = 'class="dimmed"';
+                    }
+                    $courselisting .= "<a href=\"{$CFG->wwwroot}/user/view.php?id={$user->id}&amp;course={$mycourse->id}\" $class >"
                         . format_string($mycourse->fullname) . "</a>, ";
                 }
                 else {