]> git.mjollnir.org Git - moodle.git/commitdiff
minor refactoring in grade export lib - part 2
authorskodak <skodak>
Thu, 30 Aug 2007 08:26:04 +0000 (08:26 +0000)
committerskodak <skodak>
Thu, 30 Aug 2007 08:26:04 +0000 (08:26 +0000)
grade/export/lib.php

index 91db8e6be3b62088c88c68a8fef8ceb799c6be1f..a40be8ef060f0374a8ec9734e7a9665e32514f3d 100755 (executable)
@@ -58,13 +58,7 @@ class grade_export {
      * @note Exporting as letters will lead to data loss if that exported set it re-imported.
      */
     function grade_export($id, $itemids = null, $export_letters=false, $publish=false) {
-        global $CFG, $COURSE;
-
-        if ($export_letters) {
-            require_once($CFG->dirroot . '/grade/report/lib.php');
-            $report = new grade_report($COURSE->id, null, null);
-            $letters = $report->get_grade_letters();
-        }
+        global $CFG;
 
         $this->publish = $publish;
         $this->strgrades = get_string("grades");
@@ -87,6 +81,12 @@ class grade_export {
         $this->id = $id;
         $this->course = $course;
 
+        if ($export_letters) {
+            require_once($CFG->dirroot . '/grade/report/lib.php');
+            $report = new grade_report($this->id, null, null);
+            $letters = $report->get_grade_letters();
+        }
+
         // first make sure we have all final grades
         // TODO: check that no grade_item has needsupdate set
         grade_regrade_final_grades($id);