Showing images and links in answers in a question

skala
Julio Montoya 15 years ago
parent 7fa4a4d148
commit e2ea48a2e0
  1. 15
      main/exercice/exercise.lib.php

@ -105,7 +105,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
// construction of the Answer object // construction of the Answer object
$objAnswerTmp=new Answer($questionId); $objAnswerTmp=new Answer($questionId);
$nbrAnswers=$objAnswerTmp->selectNbrAnswers(); $nbrAnswers=$objAnswerTmp->selectNbrAnswers();
// only used for the answer type "Matching" // only used for the answer type "Matching"
if($answerType == MATCHING) if($answerType == MATCHING)
@ -232,7 +232,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
<p style='float:left; padding-right:4px;'> <p style='float:left; padding-right:4px;'>
<span><input class='checkbox' type='radio' name='choice[".$questionId."]' value='".$numAnswer."'></p></span>"; <span><input class='checkbox' type='radio' name='choice[".$questionId."]' value='".$numAnswer."'></p></span>";
$answer=api_parse_tex($answer); $answer=api_parse_tex($answer);
$s.=strip_tags($answer); $s.=Security::remove_XSS($answer, STUDENT);
$s.="</div></td></tr>"; $s.="</div></td></tr>";
} elseif($answerType == MULTIPLE_ANSWER) { } elseif($answerType == MULTIPLE_ANSWER) {
@ -244,7 +244,7 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
<p style='float:left; padding-right:4px;'> <p style='float:left; padding-right:4px;'>
<span><input class='checkbox' type='checkbox' name='choice[".$questionId."][".$numAnswer."]' value='1'></p></span>"; <span><input class='checkbox' type='checkbox' name='choice[".$questionId."][".$numAnswer."]' value='1'></p></span>";
$answer = api_parse_tex($answer); $answer = api_parse_tex($answer);
$s.=strip_tags($answer); $s.=Security::remove_XSS($answer, STUDENT);
$s.="</div></td></tr>"; $s.="</div></td></tr>";
} elseif($answerType == MULTIPLE_ANSWER_COMBINATION) { } elseif($answerType == MULTIPLE_ANSWER_COMBINATION) {
@ -256,20 +256,17 @@ function showQuestion($questionId, $onlyAnswers=false, $origin=false,$current_it
<p style='float:left; padding-right:4px;'> <p style='float:left; padding-right:4px;'>
<span><input class='checkbox' type='checkbox' name='choice[".$questionId."][".$numAnswer."]' value='1'></p></span>"; <span><input class='checkbox' type='checkbox' name='choice[".$questionId."][".$numAnswer."]' value='1'></p></span>";
$answer = api_parse_tex($answer); $answer = api_parse_tex($answer);
$s.=strip_tags($answer); $s.=Security::remove_XSS($answer, STUDENT);
$s.="</div></td></tr>"; $s.="</div></td></tr>";
} }
// fill in blanks // fill in blanks
elseif($answerType == FILL_IN_BLANKS) elseif($answerType == FILL_IN_BLANKS) {
{
$s.="<tr><td colspan='2'>$answer</td></tr>"; $s.="<tr><td colspan='2'>$answer</td></tr>";
} }
// free answer // free answer
// matching // TODO: replace $answerId by $numAnswer // matching // TODO: replace $answerId by $numAnswer
else { else {
if ($answerCorrect) { if ($answerCorrect) {
$s.=" $s.="
<tr> <tr>

Loading…
Cancel
Save