Browse files

MDL-31510 grade: made the user report observe $cm->uservisible so tha…

…t activities not available to a student because of groups do not appear on their user report
  • Loading branch information...
1 parent ead4f18 commit aee748d32c8ad5e9419ee400970944525d21759d @andyjdavis andyjdavis committed Apr 8, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 grade/report/user/lib.php
View
13 grade/report/user/lib.php
@@ -347,6 +347,19 @@ private function fill_table_recursive(&$element) {
($this->showhiddenitems == GRADE_REPORT_USER_HIDE_UNTIL && !$grade_grade->is_hiddenuntil()))) {
// return false;
} else {
+ // The grade object can be marked visible but still be hidden
+ // if "enablegroupmembersonly" is on and its an activity assigned to a grouping the user is not in
+ if (!empty($grade_object->itemmodule) && !empty($grade_object->iteminstance)) {
+
+ $instances = $this->gtree->modinfo->get_instances();
+ if (!empty($instances[$grade_object->itemmodule][$grade_object->iteminstance])) {
+ $cm = $instances[$grade_object->itemmodule][$grade_object->iteminstance];
+ if (!$cm->uservisible) {
+ return false;
+ }
+ }
+ }
+
/// Excluded Item
if ($grade_grade->is_excluded()) {
$fullname .= ' ['.get_string('excluded', 'grades').']';

0 comments on commit aee748d

Please sign in to comment.