Skip to content

Commit

Permalink
MDL-33117 grade: added some smarts to the user report method inject_r…
Browse files Browse the repository at this point in the history
…owspans() to deal with activity conditional availability
  • Loading branch information
andyjdavis committed Sep 28, 2012
1 parent bac15e5 commit 60b6b62
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions grade/report/user/lib.php
Expand Up @@ -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;
Expand Down

0 comments on commit 60b6b62

Please sign in to comment.