Skip to content

Commit

Permalink
MDL-32505/MDL-32508 course: fix section_links block
Browse files Browse the repository at this point in the history
Now course_display has gone
  • Loading branch information
danpoltawski committed May 4, 2012
1 parent fe221dd commit 3246428
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions blocks/section_links/block_section_links.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ function get_content() {
}
}

if (isloggedin()) {
$display = $DB->get_field('course_display', 'display', array('course'=>$this->page->course->id, 'userid'=>$USER->id));
}
if (!empty($display)) {
$link = $CFG->wwwroot.'/course/view.php?id='.$this->page->course->id.'&'.$sectionname.'=';
} else {
$link = '#section-';
}

$sql = "SELECT section, visible
FROM {course_sections}
WHERE course = ? AND
Expand All @@ -129,17 +120,17 @@ function get_content() {
}
$style = ($isvisible) ? '' : ' class="dimmed"';
if ($i == $highlight) {
$text .= "<li><a href=\"$link$i\"$style><strong>$i</strong></a></li>\n";
$text .= '<li><a href="'.course_get_url($course, $i)."\"$style><strong>$i</strong></a></li>\n";
} else {
$text .= "<li><a href=\"$link$i\"$style>$i</a></li>\n";
$text .= '<li><a href="'.course_get_url($course, $i)."\"$style>$i</a></li>\n";
}
}
$text .= '</ol>';
if ($highlight and isset($sections[$highlight])) {
$isvisible = $sections[$highlight]->visible;
if ($isvisible or has_capability('moodle/course:update', $context)) {
$style = ($isvisible) ? '' : ' class="dimmed"';
$text .= "\n<a href=\"$link$highlight\"$style>$linktext</a>";
$text .= "\n<a href=\"".course_get_url($course, $highlight)."\"$style>$linktext</a>";
}
}
}
Expand Down

0 comments on commit 3246428

Please sign in to comment.