Browse files

Merge branch 'MDL-25122_19' of git://github.com/timhunt/moodle into M…

…OODLE_19_STABLE
  • Loading branch information...
2 parents eeff6a0 + 8d5eaee commit 49a1b113ad1dca725a25c77fbbb97ea6141c6adb @stronk7 stronk7 committed Feb 22, 2011
Showing with 20 additions and 0 deletions.
  1. +10 −0 mod/quiz/review.php
  2. +10 −0 mod/quiz/reviewquestion.php
View
10 mod/quiz/review.php
@@ -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.
View
10 mod/quiz/reviewquestion.php
@@ -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");

0 comments on commit 49a1b11

Please sign in to comment.