From c767d3b7d3fa067f2dd30d2e84bf56ac2f242e32 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 18 Sep 2007 12:15:22 +0000 Subject: [PATCH] MDL-11317 - Slashes displayed in incorrect responses for short answer questions. Fix by adding stripslashes in the appropriate place. Merged from MOODLE_18_STABLE. --- mod/quiz/report/analysis/report.php | 2 +- question/type/questiontype.php | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mod/quiz/report/analysis/report.php b/mod/quiz/report/analysis/report.php index 388721be29..3106d9f5d1 100644 --- a/mod/quiz/report/analysis/report.php +++ b/mod/quiz/report/analysis/report.php @@ -331,7 +331,7 @@ class quiz_report extends quiz_default_report { $qclass = 'partialcorrect'; } $response->credit = '('.format_float($q['credits'][$aid],2).') '; - $response->text = ''.format_text("$resp", FORMAT_MOODLE, $format_options, $quiz->course).' '; + $response->text = ''.format_text($resp, FORMAT_MOODLE, $format_options, $quiz->course).' '; $count = $q['rcounts'][$aid].'/'.$q['count']; $response->rcount = $count; $response->rpercent = '('.format_float($q['rcounts'][$aid]/$q['count']*100,0).'%)'; diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 4859b4a429..08e7ce3fe1 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -255,7 +255,7 @@ class default_questiontype { } if (empty($question->name)) { - $question->name = substr(strip_tags($question->questiontext), 0, 15); + $question->name = shorten_text($question->questiontext, 15); if (empty($question->name)) { $question->name = '-'; } @@ -681,8 +681,7 @@ class default_questiontype { // change length to truncate responses here if you want $lmax = 40; if (!empty($state->responses)) { - $responses[] = (strlen($state->responses['']) > $lmax) ? - substr($state->responses[''], 0, $lmax).'...' : $state->responses['']; + $responses[] = shorten_text(stripslashes($state->responses['']), 45); } else { $responses[] = ''; } -- 2.39.5