MDL-76150 gradereport_grader: Make numerical grades right-aligned

- state icons follow the alignment of their respective grade type
This commit is contained in:
Shamim Rezaie 2023-04-05 01:55:19 +10:00 committed by Paul Holden
parent 867186cb1d
commit 21aee2b968
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164
2 changed files with 41 additions and 2 deletions

View File

@ -846,6 +846,18 @@ class grade_report_grader extends grade_report {
$itemcell->attributes['class'] .= ' statusicons';
}
switch ($element['object']->gradetype) {
case GRADE_TYPE_SCALE:
$itemcell->attributes['class'] .= ' grade_type_scale';
break;
case GRADE_TYPE_VALUE:
$itemcell->attributes['class'] .= ' grade_type_value';
break;
case GRADE_TYPE_TEXT:
$itemcell->attributes['class'] .= ' grade_type_text';
break;
}
$itemcell->colspan = $colspan;
$itemcell->header = true;
$itemcell->scope = 'col';
@ -1318,6 +1330,14 @@ class grade_report_grader extends grade_report {
$itemcell = new html_table_cell();
$itemcell->attributes['class'] .= ' range i'. $itemid;
if ($item->gradetype == GRADE_TYPE_SCALE) {
$itemcell->attributes['class'] .= ' grade_type_scale';
} else if ($item->gradetype == GRADE_TYPE_VALUE) {
$itemcell->attributes['class'] .= ' grade_type_value';
} else if ($item->gradetype == GRADE_TYPE_TEXT) {
$itemcell->attributes['class'] .= ' grade_type_text';
}
$hidden = '';
if ($item->is_hidden()) {
$hidden = ' dimmed_text ';
@ -1477,9 +1497,18 @@ class grade_report_grader extends grade_report {
$decimalpoints = $averagesdecimalpoints;
}
$gradetypeclass = '';
if ($item->gradetype == GRADE_TYPE_SCALE) {
$gradetypeclass = ' grade_type_scale';
} else if ($item->gradetype == GRADE_TYPE_VALUE) {
$gradetypeclass = ' grade_type_value';
} else if ($item->gradetype == GRADE_TYPE_TEXT) {
$gradetypeclass = ' grade_type_text';
}
if (!isset($sumarray[$item->id]) || $meancount == 0) {
$avgcell = new html_table_cell();
$avgcell->attributes['class'] = 'i'. $itemid;
$avgcell->attributes['class'] = $gradetypeclass . ' i'. $itemid;
$avgcell->text = '-';
$avgrow->cells[] = $avgcell;
@ -1494,7 +1523,7 @@ class grade_report_grader extends grade_report {
}
$avgcell = new html_table_cell();
$avgcell->attributes['class'] = 'i'. $itemid;
$avgcell->attributes['class'] = $gradetypeclass . ' i'. $itemid;
$avgcell->text = $gradehtml.$numberofgrades;
$avgrow->cells[] = $avgcell;
}

View File

@ -51,6 +51,10 @@
margin-right: 10px;
}
.path-grade-report-grader .grade_type_value .grade_icons {
margin-left: auto;
}
.path-grade-report-grader .grade_icons .icon {
margin-right: 20px;
}
@ -151,6 +155,12 @@
margin-right: 1px;
}
.path-grade-report-grader .gradeparent td.grade_type_value,
.path-grade-report-grader .gradeparent td.grade_type_value input {
text-align: right;
margin-left: auto;
}
.path-grade-report-grader .gradeparent .gradevalue {
display: inline-block;
}