From 60b6b6280b8d9b3f7fdab93dc9dde9a2ca4a24e5 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 14 Aug 2012 20:24:33 +0800 Subject: [PATCH] MDL-33117 grade: added some smarts to the user report method inject_rowspans() to deal with activity conditional availability --- grade/report/user/lib.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/grade/report/user/lib.php b/grade/report/user/lib.php index 915aefd25256c..5b92b1cd43d4a 100644 --- a/grade/report/user/lib.php +++ b/grade/report/user/lib.php @@ -228,6 +228,26 @@ function inject_rowspans(&$element) { } $count = 1; foreach ($element['children'] as $key=>$child) { + + $grade_object = $child['object']; + // If grade object isn't hidden + if ($grade_object->hidden != 1) { + + // If grade object is an module instance + if (!empty($grade_object->itemmodule) && !empty($grade_object->iteminstance)) { + + $instances = $this->gtree->modinfo->get_instances(); + // If we can find the module instance + if (!empty($instances[$grade_object->itemmodule][$grade_object->iteminstance])) { + + $cm = $instances[$grade_object->itemmodule][$grade_object->iteminstance]; + // Skip generating rowspans if the user cannot see the module instance + if (!$cm->uservisible) { + continue; + } + } + } + } $count += $this->inject_rowspans($element['children'][$key]); } $element['rowspan'] = $count;