]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15274 Asking for Excel file when no answers have been provided leads to a "file...
authoragrabs <agrabs>
Fri, 20 Jun 2008 14:54:19 +0000 (14:54 +0000)
committeragrabs <agrabs>
Fri, 20 Jun 2008 14:54:19 +0000 (14:54 +0000)
MDL-15107 feedback dml conversion

mod/feedback/analysis_to_excel.php

index 5a5fc19d5fe316e11f5cc45f4f14b0d20d5c04e6..73c526d4e3e5aaba78242c2224974f968676d9e3 100644 (file)
     $fstring->course = get_string('course');
     $fstring->anonymous_user = get_string('anonymous_user','feedback');
     ob_end_clean();
+    
+    //get the questions (item-names)
+    if(!$items = $DB->get_records('feedback_item', array('feedback'=>$feedback->id, 'hasvalue'=>1), 'position')) {
+        error(get_string('no_items_available_yet', 'feedback'), $CFG->wwwroot.'/mod/feedback/view.php?id='.$id);
+        exit;
+    }
 
     $filename = "feedback.xls";
     
         $worksheet1->write_string($rowOffset1, 0, $fstring->modulenameplural.': '.strval($completedscount));
     }
 
-    //get the questions (item-names)
-    $items = $DB->get_records('feedback_item', array('feedback'=>$feedback->id, 'hasvalue'=>1, 'position'));
     if(is_array($items)){
         $rowOffset1++;
         $worksheet1->write_string($rowOffset1, 0, $fstring->questions.': '. strval(sizeof($items)));