From de266537a75f5665f73edbde49c497690e6d7049 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 30 Jul 2007 10:33:43 +0000 Subject: [PATCH] MDL-10300 - cleaning incorrectly applied to overall feedback. --- 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 48cb83786efd3..bf4efc9c34206 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -346,7 +346,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. @@ -360,6 +360,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 fac1761d205e5..c34deb476bacc 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -228,7 +228,7 @@ function definition() { } $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 ff9fc5db5e8ff..7e29ddf1fc3e1 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -42,6 +42,10 @@ function display($quiz, $cm, $course) { 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); @@ -466,7 +470,7 @@ function display($quiz, $cm, $course) { } if ($hasfeedback) { if ($attempt->timefinish) { - $row[] = $attempt->feedbacktext; + $row[] = format_text($attempt->feedbacktext, FORMAT_MOODLE, $nocleanformatoptions); } else { $row[] = '-'; }