Commit f0b759ab authored by Camille Tardy's avatar Camille Tardy
Browse files

Fix grade button url in course header.

If prof : link to grader report, if student, link to student report.
Signed-off-by: Camille Tardy's avatarCamille Tardy <>
parent 2bce89eb
......@@ -557,7 +557,17 @@ class core_renderer extends \theme_boost\output\core_renderer {
$html .= get_string('participants', 'moodle');
$html .= html_writer::end_tag('a');
$html .= html_writer::start_tag('a', array('href'=> new moodle_url('/grade/report/user/index.php', array('id' => $this->page->course->id)), 'class'=>'btn btn-secondary singlebutton'));
//choose url to link to the "grade" button according to user profile
$studentgradereport = '/grade/report/user/index.php';
$profgradereport = '/grade/report/grader/index.php';
//set to student grade report by default.
$urlgradereport = $studentgradereport;
// if user has capability to update this course, then use prof url
if(has_capability('moodle/course:update', $context)){
$urlgradereport = $profgradereport;
$html .= html_writer::start_tag('a', array('href'=> new moodle_url($urlgradereport, array('id' => $this->page->course->id)), 'class'=>'btn btn-secondary singlebutton'));
$html .= get_string('grades', 'moodle');
$html .= html_writer::end_tag('a');
Supports Markdown
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