MDL-25122 Quiz review page does not check and enforce separate groups mode.

This commit is contained in:
Tim Hunt
2011-02-18 17:23:41 +00:00
parent 0af9124a00
commit 8d5eaee1c9
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -78,6 +78,16 @@
redirect('view.php?q=' . $quiz->id, $message);
}
}
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
// Check the users have at least one group in common.
$teachersgroups = groups_get_activity_allowed_groups($cm);
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
if (!($teachersgroups && $studentsgroups &&
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
}
}
/// Bits needed to print a good URL for this page.
+10
View File
@@ -80,6 +80,16 @@
if ($attempt->userid != $USER->id) {
error('This is not your attempt!');
}
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
// Check the users have at least one group in common.
$teachersgroups = groups_get_activity_allowed_groups($cm);
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
if (!($teachersgroups && $studentsgroups &&
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
}
}
//add_to_log($course->id, 'quiz', 'review', "review.php?id=$cm->id&attempt=$attempt->id", "$quiz->id", "$cm->id");