Skip to content

Commit

Permalink
Use the right string processing when outputting question text on impo…
Browse files Browse the repository at this point in the history
…rt/export. Backported from HEAD
  • Loading branch information
tjhunt committed Mar 13, 2007
1 parent 8f8f6e7 commit 01d0a4f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions question/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function importprocess() {

$count++;

echo "<hr /><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
echo "<hr /><p><b>$count</b>. ".$this->format_question_text($question)."</p>";

// check for answer grades validity (must match fixed list of grades)
if (!empty($question->fraction) and (is_array($question->fraction))) {
Expand Down Expand Up @@ -396,7 +396,7 @@ function exportprocess() {

// export the question displaying message
$count++;
echo "<hr /><p><b>$count</b>. ".stripslashes($question->questiontext)."</p>";
echo "<hr /><p><b>$count</b>. ".$this->format_question_text($question)."</p>";
$expout .= $this->writequestion( $question ) . "\n";
}

Expand Down Expand Up @@ -438,6 +438,17 @@ function question_get_export_dir() {
return $path;
}

function format_question_text($question) {
$formatoptions = new stdClass;
$formatoptions->noclean = true;
$formatoptions->para = false;
if (empty($question->questiontextformat)) {
$format = FORMAT_MOODLE;
} else {
$format = $question->questiontextformat;
}
return format_text(stripslashes($question->questiontext), $format, $formatoptions);
}
}

?>

0 comments on commit 01d0a4f

Please sign in to comment.