Commit 36c10592 authored by Camille Tardy's avatar Camille Tardy
Browse files

fix issues for courses with no sections where not able to gather context to...


fix issues for courses with no sections where not able to gather context to define persmission for grade button.
Signed-off-by: Camille Tardy's avatarCamille Tardy <camille.tardy@unige.ch>
parent 70358cea
......@@ -515,6 +515,7 @@ class core_renderer extends \theme_boost\output\core_renderer {
public function course_menu() {
global $PAGE, $CFG;
$html = "";
$context = context_course::instance($this->page->course->id);
// If the page is a course page
if (($this->page->pagelayout == "course") OR ($this->page->course->format == "singleactivity" AND $this->page->pagelayout == "incourse")) {
......@@ -534,19 +535,15 @@ class core_renderer extends \theme_boost\output\core_renderer {
if ($counter != 0) {
// If the section is visible to students
$context = context_course::instance($this->page->course->id);
if ((($course_sections[$counter]->visible == 0) AND (has_capability('moodle/course:create', $context))) OR ($course_sections[$counter]->visible == 1)) {
$sectionname = $format->get_section_name($num_section);
$html .= html_writer::tag('option', $sectionname, array('value' => 'section-' . $counter));
}
}
$counter += 1;
} //end topic list
$html .= html_writer::end_tag('select');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment