]> git.mjollnir.org Git - moodle.git/commitdiff
MDL12932 -Random Short-Answer Matching does not display correctly in Item analysis...
authorpichetp <pichetp>
Fri, 11 Jan 2008 14:24:10 +0000 (14:24 +0000)
committerpichetp <pichetp>
Fri, 11 Jan 2008 14:24:10 +0000 (14:24 +0000)
mod/quiz/report/analysis/report.php
question/type/randomsamatch/questiontype.php

index 81db91eb6da8c57f2d767b9067316d6263b0cf80..bf579faf6cd4f342661e068bde947eb321696e58 100644 (file)
@@ -154,6 +154,9 @@ class quiz_report extends quiz_default_report {
                     continue;
                 }
                 $qtype = ($quizquestions[$i]->qtype=='random') ? $states[$i]->options->question->qtype : $quizquestions[$i]->qtype;
+                if($quizquestions[$i]->qtype =='randomsamatch'){
+                    $quizquestions[$i]->options =$states[$i]->options ;
+                }   
                 $q = get_question_responses($quizquestions[$i], $states[$i]);
                 if (empty($q)){
                     continue;
index fb4a8306dce0baa295841ffee8c0fc1abe0c8fa0..e6fbee99fe094c96f348b5737fe7087832f5643e 100644 (file)
@@ -246,6 +246,26 @@ class question_randomsamatch_qtype extends question_match_qtype {
          "AND hidden = '0'" .
          "AND id NOT IN ($questionsinuse)");
     }
+    function get_all_responses($question, $state) {
+        $answers = array();
+        if (is_array($question->options->subquestions)) {
+            foreach ($question->options->subquestions as $aid => $answer) {
+                if ($answer->questiontext) {
+                    foreach($answer->options->answers as $ans ){
+                       $answer->answertext = $ans->answer ;
+                    } 
+                    $r = new stdClass;
+                    $r->answer = $answer->questiontext . ": " . $answer->answertext;
+                    $r->credit = 1;
+                    $answers[$aid] = $r;
+                }
+            }
+        }
+        $result = new stdClass;
+        $result->id = $question->id;
+        $result->responses = $answers;
+        return $result;
+    }
     
 /// BACKUP FUNCTIONS ////////////////////////////