MDL-51402 quiz: notification emails should respect grouping

In the case where teachers do not have the accessallgroups capability,
we only send "an attempt has been sumbitted "notification to teachers
in the same group as the student who submitted.

At the moment this considers all groups in the course. If this
particular quiz has a grouping set, then the logic should only consider
the groups in that grouping.
This commit is contained in:
Ferenc Lengyel
2015-09-21 13:31:08 +01:00
committed by Tim Hunt
parent 2dd2288807
commit e5cd1282a1
+1 -1
View File
@@ -1550,7 +1550,7 @@ function quiz_send_notification_messages($course, $quiz, $attempt, $context, $cm
// Check for notifications required.
$notifyfields = 'u.id, u.username, u.idnumber, u.email, u.emailstop, u.lang, u.timezone, u.mailformat, u.maildisplay, ';
$notifyfields .= get_all_user_name_fields(true, 'u');
$groups = groups_get_all_groups($course->id, $submitter->id);
$groups = groups_get_all_groups($course->id, $submitter->id, $cm->groupingid);
if (is_array($groups) && count($groups) > 0) {
$groups = array_keys($groups);
} else if (groups_get_activity_groupmode($cm, $course) != NOGROUPS) {