From 9d6c4e80f919d7c2a2a54512a6db909e84c485a2 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 24 Jan 2008 16:33:39 +0000 Subject: [PATCH] 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. --- blocks/quiz_results/block_quiz_results.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/blocks/quiz_results/block_quiz_results.php b/blocks/quiz_results/block_quiz_results.php index cd072cc26e..d470598e47 100644 --- a/blocks/quiz_results/block_quiz_results.php +++ b/blocks/quiz_results/block_quiz_results.php @@ -183,6 +183,16 @@ class block_quiz_results extends block_base { $this->content->text .= '

'.$quiz->name.'

'; } + 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 .= '
'; @@ -196,7 +206,11 @@ class block_quiz_results extends block_base { break; default: case B_QUIZRESULTS_NAME_FORMAT_FULL: - $thisname = ''.$groupgrades[$groupid]['group'].''; + if ($grouplink) { + $thisname = ''.$groupgrades[$groupid]['group'].''; + } else { + $thisname = $groupgrades[$groupid]['group']; + } break; } $this->content->text .= '
'.(++$rank).'.'.$thisname.''; -- 2.39.5