.$userid.'_'.$item->id.'" value="' . s($grade->feedback) . '" />';
}
- } else {
- // Percentage format if specified by user (check each item for a set preference)
+ } else { // Not editing
$gradedisplaytype = $item->get_displaytype();
$percentsign = '';
$grademin = $item->grademin;
$grademax = $item->grademax;
- if ($gradedisplaytype == GRADE_DISPLAY_TYPE_PERCENTAGE) {
- if (!is_null($gradeval)) {
- $gradeval = grade_to_percentage($gradeval, $grademin, $grademax);
- }
- $percentsign = '%';
- }
-
- // If feedback present, surround grade with feedback tooltip
+ // If feedback present, surround grade with feedback tooltip: Open span here
if (!empty($grade->feedback)) {
$overlib = '';
if ($grade->feedbackformat == 1) {
if ($item->needsupdate) {
$studentshtml .= '<span class="gradingerror">'.get_string('error').'</span>';
-
- } else if ($gradedisplaytype == GRADE_DISPLAY_TYPE_LETTER) {
- if (!is_null($gradeval)) {
- $studentshtml .= grade_format_gradevalue($gradeval, $item, false, GRADE_DISPLAY_TYPE_LETTER, null);
- }
- } else if ($item->scaleid && !empty($scales_array[$item->scaleid])
- && $gradedisplaytype == GRADE_DISPLAY_TYPE_REAL) {
+ } elseif ($item->scaleid && !empty($scales_array[$item->scaleid])) {
$scale = $scales_array[$item->scaleid];
$scales = explode(",", $scale->scale);
if (is_null($gradeval)) {
$studentshtml .= '-';
} else {
- $studentshtml .= format_float($gradeval, $decimalpoints). $percentsign;
+ $studentshtml .= grade_format_gradevalue($gradeval, $item, true, $gradedisplaytype, null);
}
}
+
+ // Close feedback span
if (!empty($grade->feedback)) {
$studentshtml .= '</span>';
}
'showlocks' => $checkbox_default);
$preferences['prefrows'] = array(
- 'averagesdisplaytype' => array(GRADE_DISPLAY_TYPE_DEFAULT => 'default',
+ 'averagesdisplaytype' => array(GRADE_REPORT_PREFERENCE_DEFAULT => 'default',
+ GRADE_REPORT_PREFERENCE_INHERIT => $strinherit,
GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades')),
- 'rangesdisplaytype' => array(GRADE_DISPLAY_TYPE_DEFAULT => 'default',
+ 'rangesdisplaytype' => array(GRADE_REPORT_PREFERENCE_DEFAULT => 'default',
+ GRADE_REPORT_PREFERENCE_INHERIT => $strinherit,
GRADE_DISPLAY_TYPE_REAL => get_string('real', 'grades'),
GRADE_DISPLAY_TYPE_PERCENTAGE => get_string('percentage', 'grades'),
GRADE_DISPLAY_TYPE_LETTER => get_string('letter', 'grades')),