mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-13102 - quiz_results block links to the old URL of the groups editing interface, and it links there for everyone, even if they don't have the capability to go there. Make it link to the participants page instead, if possible.
This commit is contained in:
parent
cea55a1c7f
commit
9d6c4e80f9
@ -183,6 +183,16 @@ class block_quiz_results extends block_base {
|
||||
$this->content->text .= '<h1><a href="'.$CFG->wwwroot.'/mod/quiz/view.php?q='.$quizid.'">'.$quiz->name.'</a></h1>';
|
||||
}
|
||||
|
||||
if ($nameformat = B_QUIZRESULTS_NAME_FORMAT_FULL) {
|
||||
if (has_capability('moodle/course:managegroups', $context)) {
|
||||
$grouplink = $CFG->wwwroot.'/group/overview.php?courseid='.$courseid.'&id=';
|
||||
} else if (has_capability('moodle/course:viewparticipants', $context)) {
|
||||
$grouplink = $CFG->wwwroot.'/user/index.php?id='.$courseid.'&group=';
|
||||
} else {
|
||||
$grouplink = '';
|
||||
}
|
||||
}
|
||||
|
||||
$rank = 0;
|
||||
if(!empty($best)) {
|
||||
$this->content->text .= '<table class="grades"><caption>';
|
||||
@ -196,7 +206,11 @@ class block_quiz_results extends block_base {
|
||||
break;
|
||||
default:
|
||||
case B_QUIZRESULTS_NAME_FORMAT_FULL:
|
||||
$thisname = '<a href="'.$CFG->wwwroot.'/course/group.php?group='.$groupid.'&id='.$courseid.'">'.$groupgrades[$groupid]['group'].'</a>';
|
||||
if ($grouplink) {
|
||||
$thisname = '<a href="'.$grouplink.$groupid.'">'.$groupgrades[$groupid]['group'].'</a>';
|
||||
} else {
|
||||
$thisname = $groupgrades[$groupid]['group'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->content->text .= '<tr><td>'.(++$rank).'.</td><td>'.$thisname.'</td><td>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user