From 9ff3b4ab32ff47411c4752dc07d45ba7053bb855 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 30 Jul 2007 10:41:15 +0000 Subject: [PATCH] MDL-10300 - cleaning incorrectly applied to overall feedback. Backported from HEAD. --- mod/quiz/locallib.php | 7 ++++++- mod/quiz/mod_form.php | 2 +- mod/quiz/report/overview/report.php | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 1d5f9f27f99..57d7f407a49 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -317,7 +317,7 @@ function quiz_rescale_grade($rawgrade, $quiz) { /** * Get the feedback text that should be show to a student who - * got this grade on this quiz. + * got this grade on this quiz. The feedback is processed ready for diplay. * * @param float $grade a grade on this quiz. * @param integer $quizid the id of the quiz object. @@ -331,6 +331,11 @@ function quiz_feedback_for_grade($grade, $quizid) { $feedback = ''; } + // Clean the text, ready for display. + $formatoptions = new stdClass; + $formatoptions->noclean = true; + $feedback = format_text($feedback, FORMAT_MOODLE, $formatoptions); + return $feedback; } diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index 9e631d6daf8..8924ff9a4e2 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -222,7 +222,7 @@ class mod_quiz_mod_form extends moodleform_mod { } $numfeedbacks = max(count($this->_feedbacks) * 1.5, 5); - $mform->setType('feedbacktext', PARAM_TEXT); + $mform->setType('feedbacktext', PARAM_RAW); $mform->setType('feedbackboundaries', PARAM_NOTAGS); $nextel=$this->repeat_elements($repeatarray, $numfeedbacks-1, diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 07c1743f929..a364bc30861 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -55,6 +55,10 @@ class quiz_report extends quiz_default_report { break; } + // Set of format options for teacher-created content, for example overall feedback. + $nocleanformatoptions = new stdClass; + $nocleanformatoptions->noclean = true; + // Set table options $noattempts = optional_param('noattempts', 0, PARAM_INT); $detailedmarks = optional_param('detailedmarks', 0, PARAM_INT); @@ -480,7 +484,7 @@ class quiz_report extends quiz_default_report { } if ($hasfeedback) { if ($attempt->timefinish) { - $row[] = $attempt->feedbacktext; + $row[] = format_text($attempt->feedbacktext, FORMAT_MOODLE, $nocleanformatoptions); } else { $row[] = '-'; }