Fixed bug 1531, section links to invisible sections now greyed out or hidden

This commit is contained in:
gustav_delius 2004-06-05 11:57:11 +00:00
parent a96deb69e2
commit 319225a714

View 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;