mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-38065 gradebook: Fix issue with hidden categories breaking rowspan.
Hidden subcategories break the rowspan in the gradebook; this fix corrects the calculation of the rowspan.
This commit is contained in:
parent
1446e02f69
commit
a4bd536688
1 changed files with 19 additions and 11 deletions
|
@ -215,16 +215,6 @@ class grade_report_user extends grade_report {
|
||||||
// Grab the grade_tree for this course
|
// Grab the grade_tree for this course
|
||||||
$this->gtree = new grade_tree($this->courseid, false, $this->switch, null, !$CFG->enableoutcomes);
|
$this->gtree = new grade_tree($this->courseid, false, $this->switch, null, !$CFG->enableoutcomes);
|
||||||
|
|
||||||
// Determine the number of rows and indentation
|
|
||||||
$this->maxdepth = 1;
|
|
||||||
$this->inject_rowspans($this->gtree->top_element);
|
|
||||||
$this->maxdepth++; // Need to account for the lead column that spans all children
|
|
||||||
for ($i = 1; $i <= $this->maxdepth; $i++) {
|
|
||||||
$this->evenodd[$i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->tabledata = array();
|
|
||||||
|
|
||||||
// Get the user (for full name).
|
// Get the user (for full name).
|
||||||
$this->user = $DB->get_record('user', array('id' => $userid));
|
$this->user = $DB->get_record('user', array('id' => $userid));
|
||||||
|
|
||||||
|
@ -238,6 +228,16 @@ class grade_report_user extends grade_report {
|
||||||
$this->canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);
|
$this->canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine the number of rows and indentation.
|
||||||
|
$this->maxdepth = 1;
|
||||||
|
$this->inject_rowspans($this->gtree->top_element);
|
||||||
|
$this->maxdepth++; // Need to account for the lead column that spans all children.
|
||||||
|
for ($i = 1; $i <= $this->maxdepth; $i++) {
|
||||||
|
$this->evenodd[$i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->tabledata = array();
|
||||||
|
|
||||||
// base url for sorting by first/last name
|
// base url for sorting by first/last name
|
||||||
$this->baseurl = $CFG->wwwroot.'/grade/report?id='.$courseid.'&userid='.$userid;
|
$this->baseurl = $CFG->wwwroot.'/grade/report?id='.$courseid.'&userid='.$userid;
|
||||||
$this->pbarurl = $this->baseurl;
|
$this->pbarurl = $this->baseurl;
|
||||||
|
@ -266,7 +266,15 @@ class grade_report_user extends grade_report {
|
||||||
$count = 1;
|
$count = 1;
|
||||||
|
|
||||||
foreach ($element['children'] as $key=>$child) {
|
foreach ($element['children'] as $key=>$child) {
|
||||||
$count += $this->inject_rowspans($element['children'][$key]);
|
// If category is hidden then do not include it in the rowspan.
|
||||||
|
if ($child['type'] == 'category' && $child['object']->is_hidden() && !$this->canviewhidden
|
||||||
|
&& ($this->showhiddenitems == GRADE_REPORT_USER_HIDE_HIDDEN
|
||||||
|
|| ($this->showhiddenitems == GRADE_REPORT_USER_HIDE_UNTIL && !$child['object']->is_hiddenuntil()))) {
|
||||||
|
// Just calculate the rowspans for children of this category, don't add them to the count.
|
||||||
|
$this->inject_rowspans($element['children'][$key]);
|
||||||
|
} else {
|
||||||
|
$count += $this->inject_rowspans($element['children'][$key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$element['rowspan'] = $count;
|
$element['rowspan'] = $count;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue