]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed bug 1531, section links to invisible sections now greyed out or hidden
authorgustav_delius <gustav_delius>
Sat, 5 Jun 2004 11:57:11 +0000 (11:57 +0000)
committergustav_delius <gustav_delius>
Sat, 5 Jun 2004 11:57:11 +0000 (11:57 +0000)
blocks/section_links/block_section_links.php

index eb5879ae0cab075c6bf488aab66e74dc6f07e17f..10abef16ded067cae43f41187078103248d0de55 100644 (file)
@@ -55,14 +55,24 @@ class CourseBlock_section_links extends MoodleBlock {
         }
         $text = '<font size=-1>';
         for ($i = $inc; $i <= $this->course->numsections; $i += $inc) {
+            $isvisible = get_field('course_sections', 'visible', 'course', $this->course->id, 'section', $i);
+            if (!$isvisible and !isteacher($this->course->id)) {
+                if ($i == $highlight) { 
+                    $highlight = 0;
+                }
+                continue;
+            }
+            $style = ($isvisible) ? '' : ' class="dimmed"';
             if ($i == $highlight) {
-                $text .= "<a href=\"$link$i\"><b>$i</b></a> ";
+                $text .= "<a href=\"$link$i\"$style><b>$i</b></a> ";
             } else {
-                $text .= "<a href=\"$link$i\">$i</a> ";
+                $text .= "<a href=\"$link$i\"$style>$i</a> ";
             }
         }
         if ($highlight) {
-            $text .= "<br><a href=\"$link$highlight\">$linktext</a>";
+            $isvisible = get_field('course_sections', 'visible', 'course', $this->course->id, 'section', $highlight);
+            $style = ($isvisible) ? '' : ' class="dimmed"';
+            $text .= "<br><a href=\"$link$highlight\"$style>$linktext</a>";
         }
 
         $this->content = New stdClass;