MDL-50648 grader report: columns misaligned with some permissions
If a user can see the grader report and singleview report, but not the user report ($CFG->grade_profilereport) then the colspans were wrong and so the columns did not line up under the right headers.
This commit is contained in:
@@ -589,6 +589,9 @@ class grade_report_grader extends grade_report {
|
||||
$rows = array();
|
||||
|
||||
$showuserimage = $this->get_pref('showuserimage');
|
||||
$canseeuserreport = has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context);
|
||||
$canseesingleview = has_capability('gradereport/singleview:view', $this->context);
|
||||
$hasuserreportcell = $canseeuserreport || $canseesingleview;
|
||||
|
||||
$strfeedback = $this->get_lang_string("feedback");
|
||||
$strgrade = $this->get_lang_string('grade');
|
||||
@@ -597,11 +600,7 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
$arrows = $this->get_sort_arrows($extrafields);
|
||||
|
||||
$colspan = 1;
|
||||
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
|
||||
$colspan++;
|
||||
}
|
||||
$colspan += count($extrafields);
|
||||
$colspan = 1 + $hasuserreportcell + count($extrafields);
|
||||
|
||||
$levels = count($this->gtree->levels) - 1;
|
||||
|
||||
@@ -622,7 +621,7 @@ class grade_report_grader extends grade_report {
|
||||
$studentheader->scope = 'col';
|
||||
$studentheader->header = true;
|
||||
$studentheader->id = 'studentheader';
|
||||
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
|
||||
if ($hasuserreportcell) {
|
||||
$studentheader->colspan = 2;
|
||||
}
|
||||
$studentheader->text = $arrows['studentname'];
|
||||
@@ -679,7 +678,7 @@ class grade_report_grader extends grade_report {
|
||||
$userreportcell = new html_table_cell();
|
||||
$userreportcell->attributes['class'] = 'userreport';
|
||||
$userreportcell->header = true;
|
||||
if (has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context)) {
|
||||
if ($canseeuserreport) {
|
||||
$a = new stdClass();
|
||||
$a->user = $fullname;
|
||||
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
|
||||
@@ -687,7 +686,7 @@ class grade_report_grader extends grade_report {
|
||||
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', $strgradesforuser));
|
||||
}
|
||||
|
||||
if (has_capability('gradereport/singleview:view', $this->context)) {
|
||||
if ($canseesingleview) {
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', array('id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user'));
|
||||
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', get_string('singleview', 'grades', $fullname)));
|
||||
$userreportcell->text .= $singleview;
|
||||
|
||||
Reference in New Issue
Block a user