]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8349 - responses not being filtered in history display. Merged from MOODLE_18_STABLE.
authortjhunt <tjhunt>
Tue, 6 Mar 2007 18:00:23 +0000 (18:00 +0000)
committertjhunt <tjhunt>
Tue, 6 Mar 2007 18:00:23 +0000 (18:00 +0000)
question/type/multichoice/questiontype.php
question/type/questiontype.php

index 86a3742864199e4a2c2b0fc0515403f5df4b8bc0..5fb6d8f09a0479f43367ca35726777085e87f69f 100644 (file)
@@ -376,9 +376,12 @@ class question_multichoice_qtype extends default_questiontype {
     // ULPGC ecastro
     function get_actual_response($question, $state) {
         $answers = $question->options->answers;
+        $responses = array();
         if (!empty($state->responses)) {
             foreach ($state->responses as $aid =>$rid){
-                $responses[] = (!empty($answers[$rid]) ? $answers[$rid]->answer : '');
+                if (!empty($answers[$rid])) {
+                    $responses[] = $this->format_text($answers[$rid]->answer, $question->questiontextformat);
+                }
             }
         } else {
             $responses[] = '';
@@ -386,6 +389,10 @@ class question_multichoice_qtype extends default_questiontype {
         return $responses;
     }
 
+    function response_summary($question, $state, $length = 80) {
+        return implode(',', $this->get_actual_response($question, $state));
+    }
+    
 /// BACKUP FUNCTIONS ////////////////////////////
 
     /*
index 846e9d9f397efe1125b28fad375604fe3b37e478..69cabe8b7cf0ff07a829a6053e2730c5eb52fe9a 100644 (file)
@@ -1190,11 +1190,11 @@ class default_questiontype {
      * @param object $cmoptions the context the string is being displayed in. Only $cmoptions->course is used.
      * @return string the formatted text.
      */
-    function format_text($text, $textformat, $cmoptions) {
+    function format_text($text, $textformat, $cmoptions = NULL) {
         $formatoptions = new stdClass;
         $formatoptions->noclean = true;
         $formatoptions->para = false;
-        return format_text($text, $textformat, $formatoptions, $cmoptions->course);
+        return format_text($text, $textformat, $formatoptions, $cmoptions === NULL ? NULL : $cmoptions->course);
     }
 
 /// BACKUP FUNCTIONS ////////////////////////////