Skip to content

Commit

Permalink
Added has_capability checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vyshane committed Aug 15, 2006
1 parent bede8db commit 67e4cf2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions blocks/section_links/block_section_links.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function get_content() {
}

$course = get_record('course', 'id', $this->instance->pageid);
$context = get_context_instance(CONTEXT_COURSE, $course->id);

if ($course->format == 'weeks') {
$highlight = ceil((time()-$course->startdate)/604800);
Expand Down Expand Up @@ -73,7 +74,7 @@ function get_content() {
$text = '';
for ($i = $inc; $i <= $course->numsections; $i += $inc) {
$isvisible = get_field('course_sections', 'visible', 'course', $this->instance->pageid, 'section', $i);
if (!$isvisible and !isteacher($this->instance->pageid)) {
if (!$isvisible and !has_capability('moodle/course:update', $context)) {
continue;
}
$style = ($isvisible) ? '' : ' class="dimmed"';
Expand All @@ -85,7 +86,7 @@ function get_content() {
}
if ($highlight) {
$isvisible = get_field('course_sections', 'visible', 'course', $this->instance->pageid, 'section', $highlight);
if ($isvisible or isteacher($this->instance->pageid)) {
if ($isvisible or has_capability('moodle/course:update', $context)) {
$style = ($isvisible) ? '' : ' class="dimmed"';
$text .= "<br /><a href=\"$link$highlight\"$style>$linktext</a>";
}
Expand Down

0 comments on commit 67e4cf2

Please sign in to comment.