mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-79980 mod_survey: respect activity group mode getting report.
This commit is contained in:
parent
b3c12c8219
commit
e80696b2b6
@ -106,9 +106,16 @@ $renderer = $PAGE->get_renderer('mod_survey');
|
||||
echo $renderer->response_actionbar($actionbar);
|
||||
|
||||
// Check to see if groups are being used in this survey.
|
||||
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
|
||||
$groupmode = groups_get_activity_groupmode($cm);
|
||||
if ($groupmode != NOGROUPS) {
|
||||
$menuaction = $action == "student" ? "students" : $action;
|
||||
|
||||
// Get the current activity group, confirm user can access.
|
||||
$currentgroup = groups_get_activity_group($cm, true);
|
||||
if ($currentgroup === 0 && $groupmode == SEPARATEGROUPS && !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
throw new moodle_exception('notingroup');
|
||||
}
|
||||
|
||||
$groupsactivitymenu = groups_print_activity_menu($cm, new moodle_url('/mod/survey/report.php',
|
||||
['id' => $cm->id, 'action' => $menuaction, 'qid' => $qid]), true);
|
||||
} else {
|
||||
@ -365,8 +372,9 @@ switch ($action) {
|
||||
break;
|
||||
|
||||
case "student":
|
||||
if (!$user = $DB->get_record("user", array("id" => $student))) {
|
||||
throw new moodle_exception('invaliduserid');
|
||||
$user = core_user::get_user($student, '*', MUST_EXIST);
|
||||
if ($currentgroup && !array_key_exists($user->id, $users)) {
|
||||
throw new moodle_exception('usernotavailable', 'error');
|
||||
}
|
||||
|
||||
echo $OUTPUT->heading(get_string("analysisof", "survey", fullname($user)), 3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user