]> git.mjollnir.org Git - moodle.git/commitdiff
Teacher-provided text is now printed without cleaning.
authorgustav_delius <gustav_delius>
Sun, 19 Mar 2006 19:49:37 +0000 (19:49 +0000)
committergustav_delius <gustav_delius>
Sun, 19 Mar 2006 19:49:37 +0000 (19:49 +0000)
question/editlib.php
question/questiontypes/description/questiontype.php
question/questiontypes/essay/questiontype.php
question/questiontypes/match/questiontype.php
question/questiontypes/multianswer/questiontype.php
question/questiontypes/multichoice/questiontype.php
question/questiontypes/shortanswer/questiontype.php
question/questiontypes/truefalse/questiontype.php

index 8eac65f4a0fe899935e121cc56bebcd89c203c4c..57aff6c0ca755df8b8e8b77193c04ff6d471a707 100644 (file)
@@ -134,7 +134,8 @@ function question_list($course, $categoryid, $quizid,
         return;
     }
     echo "<center>";
-    echo format_text($category->info, FORMAT_MOODLE);
+    $formatoptions->noclean = true;
+    echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $course->id);
 
     echo '<table><tr>';
 
index 049ea3a5848aa18508f0aa8722ac280fe7e04338..eec8bbc1539cda6c9d2c70f18df12fba316e1d8e 100644 (file)
@@ -38,9 +38,12 @@ class quiz_description_qtype extends quiz_default_questiontype {
             $editlink = link_to_popup_window('/question/question.php?id='.$question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
         }
 
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
+
         $questiontext = format_text($question->questiontext,
                          $question->questiontextformat,
-                         NULL, $cmoptions->course);
+                         $formatoptions, $cmoptions->course);
         $image = get_question_image($question, $cmoptions->course);
 
         include "$CFG->dirroot/question/questiontypes/description/question.html";
index e4e0b551bee6b5298f16a2d0fdf1194777eb4a5e..e641ecc4ee776e1479fa4a5217a6d55b6a80b28e 100644 (file)
@@ -84,12 +84,14 @@ class question_essay_qtype extends quiz_default_questiontype {
         $answers = &$question->options->answers;
         //$correctanswers = $this->get_correct_responses($question, $state);  // no correct answers ;)
         $readonly = empty($options->readonly) ? '' : 'disabled="disabled"';
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
         $nameprefix = $question->name_prefix;
         
         /// Print question text and media
        echo format_text($question->questiontext,
                          $question->questiontextformat,
-                         NULL, $cmoptions->course);
+                         $formatoptions, $cmoptions->course);
                          
         echo get_question_image($question, $cmoptions->course);
 
@@ -156,7 +158,7 @@ class question_essay_qtype extends quiz_default_questiontype {
             if (empty($value)) {  // no comment yet
                 echo format_text(get_string('nocommentsyet', 'quiz'));
             } else {
-                echo format_text($value);    
+                echo format_text($value, '', $formatoptions, $cmoptions->course);    
             }
             echo '</div></p>';
         }
@@ -164,7 +166,7 @@ class question_essay_qtype extends quiz_default_questiontype {
         // feedback
         if ($options->feedback) {
             foreach ($answers as $answer) {
-                format_text("<p align=\"right\">$answer->feedback</p>");
+                format_text("<p align=\"right\">$answer->feedback</p>", '', $formatoptions, $cmoptions->course);
             }
         }
         $this->print_question_submit_buttons($question, $state, $cmoptions, $options);
index 623c12068380a4cdc8c30267d3b492719c851128..29045ceb66425ca9b8245df0081af01f0054704b 100644 (file)
@@ -218,6 +218,8 @@ class question_match_qtype extends quiz_default_questiontype {
         $answers        = array();
         $responses      = &$state->responses;
 
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
 
         foreach ($subquestions as $subquestion) {
             foreach ($subquestion->options->answers as $ans) {
@@ -231,7 +233,7 @@ class question_match_qtype extends quiz_default_questiontype {
         // Print formulation
         $questiontext = format_text($question->questiontext,
                          $question->questiontextformat,
-                         NULL, $cmoptions->course);
+                         $formatoptions, $cmoptions->course);
         $image = get_question_image($question, $cmoptions->course);
 
         ///// Print the input controls //////
@@ -240,7 +242,7 @@ class question_match_qtype extends quiz_default_questiontype {
 
             /// Subquestion text:
             $a->text = format_text($subquestion->questiontext,
-                $question->questiontextformat, NULL, $cmoptions->course);
+                $question->questiontextformat, $formatoptions, $cmoptions->course);
 
             /// Drop-down list:
             $menuname = $nameprefix.$subquestion->id;
index 2f9d572d780588e97724ca5c0e1cda834bc14049..f4e08373b0ec2aa7b54ee6acc1835f86a9437d94 100644 (file)
@@ -195,6 +195,8 @@ class quiz_embedded_cloze_qtype extends quiz_default_questiontype {
     function print_question_formulation_and_controls(&$question, &$state, $cmoptions, $options) {
         global $QTYPES;
         $readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
         $nameprefix = $question->name_prefix;
 
         // For this question type, we better print the image on top:
@@ -202,7 +204,7 @@ class quiz_embedded_cloze_qtype extends quiz_default_questiontype {
 
         $qtextremaining = format_text($question->questiontext,
                                       $question->questiontextformat,
-                                      NULL, $cmoptions->course);
+                                      $formatoptions, $cmoptions->course);
 
         $strfeedback = get_string('feedback', 'quiz');
 
index 43a964171e3e47ca0970c7855685a92ea7d12623..a0476f17e215b11bd7a0aefb45be81474640f48c 100644 (file)
@@ -261,12 +261,13 @@ class question_multichoice_qtype extends quiz_default_questiontype {
         $readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
 
         $formatoptions = new stdClass;
+        $formatoptions->noclean = true;
         $formatoptions->para = false;
 
         // Print formulation
         $questiontext = format_text($question->questiontext,
                          $question->questiontextformat,
-                         NULL, $cmoptions->course);
+                         $formatoptions, $cmoptions->course);
         $image = get_question_image($question, $cmoptions->course);
         $answerprompt = ($question->options->single) ? get_string('singleanswer', 'quiz') :
             get_string('multipleanswers', 'quiz');
@@ -305,11 +306,11 @@ class question_multichoice_qtype extends quiz_default_questiontype {
                 'highlight' : '';
 
             // Print the answer text
-            $a->text = format_text("$qnumchar. $answer->answer", FORMAT_MOODLE, $formatoptions);
+            $a->text = format_text("$qnumchar. $answer->answer", FORMAT_MOODLE, $formatoptions, $cmoptions->course);
 
             // Print feedback if feedback is on
             $a->feedback = (($options->feedback || $options->correct_responses) && $checked) ?
-               $feedback = format_text($answer->feedback, true, false) : '';
+               $feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course) : '';
 
             $anss[] = clone($a);
         }
index d8d9f83dc0936a405ff8a2eaa8ab5dad2e502988..d20b31f44f83ca94e07184406e7d138d35c7c2ff 100644 (file)
@@ -124,13 +124,15 @@ class question_shortanswer_qtype extends quiz_default_questiontype {
         $answers = &$question->options->answers;
         $correctanswers = $this->get_correct_responses($question, $state);
         $readonly = empty($options->readonly) ? '' : 'readonly="readonly"';
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
         $nameprefix = $question->name_prefix;
 
         /// Print question text and media
 
         $questiontext =  format_text($question->questiontext,
                          $question->questiontextformat,
-                         NULL, $cmoptions->course);
+                         $formatoptions, $cmoptions->course);
         $image = get_question_image($question, $cmoptions->course);
 
         /// Print input controls
@@ -146,7 +148,7 @@ class question_shortanswer_qtype extends quiz_default_questiontype {
         if ($options->feedback) {
             foreach($answers as $answer) {
                 if($answer->feedback and $this->test_response($question, $state, $answer)) {
-                    $feedback = format_text($answer->feedback, true, false);
+                    $feedback = format_text($answer->feedback, true, $formatoptions, $cmoptions->course);
                     break;
                 }
             }
index e7cc30671fa97c0ebdcfb560ed3c76bba00eb492..07775d1cc6c26a4bcf2571689588b666d23a4fe6 100644 (file)
@@ -138,11 +138,13 @@ class question_truefalse_qtype extends quiz_default_questiontype {
         global $CFG;
 
         $readonly = $options->readonly ? ' readonly="readonly"' : '';
+        $formatoptions->noclean = true;
+        $formatoptions->para = false;
 
         // Print question formulation
         $questiontext = format_text($question->questiontext,
                          $question->questiontextformat,
-                         NULL, $cmoptions->course);
+                         $formatoptions, $cmoptions->course);
         $image = get_question_image($question, $cmoptions->course);
 
         $answers = &$question->options->answers;
@@ -179,7 +181,7 @@ class question_truefalse_qtype extends quiz_default_questiontype {
         $feedback = '';
         if ($options->feedback and isset($answers[$state->responses['']])) {
             $chosenanswer = $answers[$state->responses['']];
-            $feedback = format_text($chosenanswer->feedback, true, false);
+            $feedback = format_text($chosenanswer->feedback, true, $formatoptions, $cmoptions->course);
         }
         
         include("$CFG->dirroot/question/questiontypes/truefalse/display.html");