MDL-50959 gradebook: fix XML grade publishing score
authorSimey Lameze <simey@moodle.com>
Tue, 8 Sep 2015 03:40:22 +0000 (11:40 +0800)
committerSimey Lameze <simey@moodle.com>
Mon, 14 Sep 2015 01:04:14 +0000 (09:04 +0800)
grade/export/xml/grade_export_xml.php

index 8b25939..4f3d99f 100644 (file)
@@ -88,7 +88,14 @@ class grade_export_xml extends grade_export {
                 fwrite($handle,  "\t\t<assignment>{$grade_item->idnumber}</assignment>\n");
                 // this column should be customizable to use either student id, idnumber, uesrname or email.
                 fwrite($handle,  "\t\t<student>{$user->idnumber}</student>\n");
-                fwrite($handle,  "\t\t<score>$gradestr</score>\n");
+                // Format and display the grade in the selected display type (real, letter, percentage).
+                if (is_array($this->displaytype)) {
+                    foreach ($this->displaytype as $gradedisplayconst) {
+                        $gradestr = $this->format_grade($grade, $gradedisplayconst);
+                        fwrite($handle,  "\t\t<score>$gradestr</score>\n");
+                    }
+                }
+
                 if ($this->export_feedback) {
                     $feedbackstr = $this->format_feedback($userdata->feedbacks[$itemid]);
                     fwrite($handle,  "\t\t<feedback>$feedbackstr</feedback>\n");