diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php
index d3c1da6b77..f45e801040 100644
--- a/main/exercice/exercise_result.php
+++ b/main/exercice/exercise_result.php
@@ -27,7 +27,7 @@
* @package dokeos.exercise
* @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring
-* @version $Id: exercise_result.php 11921 2007-04-06 15:08:29Z elixir_inter $
+* @version $Id: exercise_result.php 12050 2007-04-18 13:05:09Z elixir_julian $
*
* @todo split more code up in functions, move functions to library?
*/
@@ -740,6 +740,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
if (preg_match_all ('#([0-9a-z ]*)#', $val, $arr1))
$val = $arr1[1][0];
$val=addslashes($val);
+ $val=strip_tags($val);
$sql = "select position from $table_ans where question_id=$questionId and answer='$val'";
$res = api_sql_query($sql, __FILE__, __LINE__);
$answer = mysql_result($res,0,"position");
diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php
index 16b6662fcb..d7cf5e3a33 100644
--- a/main/exercice/exercise_show.php
+++ b/main/exercice/exercise_show.php
@@ -598,99 +598,68 @@ $result =api_sql_query($query, __FILE__, __LINE__);
-
-
- | |
-
-
- | |
- |
-
-
-
- | |
-
- selectNbrAnswers();
- $questionScore=0;
- for($answerId=1;$answerId <= $nbrAnswers;$answerId++)
- {
- $answer=$objAnswerTmp->selectAnswer($answerId);
- $answerComment=$objAnswerTmp->selectComment($answerId);
- $answerCorrect=$objAnswerTmp->isCorrect($answerId);
- $answerWeighting=$objAnswerTmp->selectWeighting($answerId);
- $querymatch = "select * from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId";
- $resmatch = api_sql_query($querymatch, __FILE__, __LINE__);
- while ($row = mysql_fetch_array($resmatch))
- {
- $ind = $row['position'];
- $answ = $row['answer'];
- $choice[$ind] = $answ;
- }
-
- if($answerCorrect)
- {
- if($answerCorrect == $choice[$answerId])
- {
- $questionScore+=$answerWeighting;
- $totalScore+=$answerWeighting;
- $choice[$answerId]=$matching[$choice[$answerId]];
- }
- elseif(!$choice[$answerId])
- {
- $choice[$answerId]=' ';
- }
- else
- {
- $choice[$answerId]=''.$matching[$choice[$answerId]].'';
- }
- }
- else
- {
- $matching[$answerId]=$answer;
- }
- ?>
-
-
-
-
-
- $v)
- {
- if($key==$answerId)
- {
- echo "| ".$answer." | ";
- echo "";
- echo $v.'/';
-
- }
- }
-
- ?>
-
- |
-
-
-
- 0';
+ $res_answers = api_sql_query($sql_select_answer, __FILE__, __LINE__);
+
+ echo '';
+ echo '| |
';
+ echo '
+ | '.get_lang("ElementList").' |
+ '.get_lang("CorrespondsTo").' |
+
';
+ echo '| |
';
+
+ $questionScore=0;
+
+ while($a_answers = mysql_fetch_array($res_answers)){
+
+ $i_answer_id = $a_answers['id'];
+ $s_answer_label = $a_answers['answer'];
+ $i_answer_correct_answer = $a_answers['correct'];
+ $i_answer_position = $a_answers['position'];
+
+ $sql_user_answer = 'SELECT answers.answer
+ FROM `'.$TABLETRACK_ATTEMPT.'` as track_e_attempt, '.$table_ans.' as answers
+ WHERE track_e_attempt.answer=answers.position
+ AND track_e_attempt.position="'.$i_answer_position.'"
+ AND answers.question_id ="'.$questionId.'"
+ AND exe_id = "'.$id.'"';
+
+ $res_user_answer = api_sql_query($sql_user_answer, __FILE__, __LINE__);
+ $s_user_answer = mysql_result($res_user_answer,0,0);
+
+ $sql_correct_answer = 'SELECT answer FROM '.$table_ans.' WHERE position = "'.$i_answer_correct_answer.'" AND question_id="'.$questionId.'"';
+ $res_correct_answer = api_sql_query($sql_correct_answer, __FILE__, __LINE__);
+ $s_correct_answer = mysql_result($res_correct_answer,0,0);
+
+ $i_answerWeighting=$objAnswerTmp->selectWeighting($i_answer_id);
+
+ if($s_user_answer == $s_correct_answer){
+ $questionScore+=$i_answerWeighting;
+ $totalScore+=$i_answerWeighting;
+ }
+ else{
+ $s_user_answer = ''.$s_user_answer.'';
+ }
+
+ echo '';
+ echo '| '.$s_answer_label.' | '.$s_user_answer.' / '.$s_correct_answer.' | ';
+ echo '
';
+
+ }
+
+ echo '
';
+
+ }
else if($answerType == HOTSPOT){