[svn r21172] Fixed partial Alerte aux accents avant release - see FS#4269

skala
Ronny Velasquez 16 years ago
parent 43e077e3e5
commit 394cdef964
  1. 15
      main/exercice/answer.class.php
  2. 42
      main/exercice/exercise_show.php

@ -23,7 +23,7 @@
* 5 arrays are created to receive the attributes of each answer belonging to a specified question
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: answer.class.php 20795 2009-05-18 18:05:02Z iflorespaz $
* @version $Id: answer.class.php 21172 2009-06-01 20:58:05Z darkvela $
*/
@ -399,10 +399,9 @@ class Answer
global $TBL_REPONSES;
$questionId=$this->questionId;
$sql = "UPDATE $TBL_REPONSES SET " .
"answer = '".Database::escape_string(Security::remove_XSS(api_html_entity_decode($answer),COURSEMANAGERLOWSECURITY))."', " .
"comment = '".Database::escape_string(Security::remove_XSS(api_html_entity_decode($comment),COURSEMANAGERLOWSECURITY))."', " .
"answer = '".Database::escape_string($answer)."', " .
"comment = '".Database::escape_string($comment)."', " .
"ponderation = '".Database::escape_string($weighting)."', " .
"position = '".Database::escape_string($position)."', " .
"destination = '".Database::escape_string($destination)."' " .
@ -434,9 +433,9 @@ class Answer
for($i=1;$i <= $this->new_nbrAnswers;$i++)
{
$answer = Database::escape_string(Security::remove_XSS(api_html_entity_decode($this->new_answer[$i]),COURSEMANAGERLOWSECURITY));
$answer = Database::escape_string($this->new_answer[$i]);
$correct = Database::escape_string($this->new_correct[$i]);
$comment = Database::escape_string(Security::remove_XSS(api_html_entity_decode($this->new_comment[$i]),COURSEMANAGERLOWSECURITY));
$comment = Database::escape_string($this->new_comment[$i]);
$weighting = Database::escape_string($this->new_weighting[$i]);
$position = Database::escape_string($this->new_position[$i]);
$hotspot_coordinates = Database::escape_string($this->new_hotspot_coordinates[$i]);
@ -484,9 +483,9 @@ class Answer
for($i=1;$i <= $this->nbrAnswers;$i++)
{
$answer = Database::escape_string(Security::remove_XSS(api_html_entity_decode($this->answer[$i]),COURSEMANAGERLOWSECURITY));
$answer = Database::escape_string($this->answer[$i]);
$correct = Database::escape_string($this->correct[$i]);
$comment = Database::escape_string(Security::remove_XSS(api_html_entity_decode($this->comment[$i]),COURSEMANAGERLOWSECURITY));
$comment = Database::escape_string($this->comment[$i]);
$weighting = Database::escape_string($this->weighting[$i]);
$position = Database::escape_string($this->position[$i]);
$hotspot_coordinates = Database::escape_string($this->hotspot_coordinates[$i]);

@ -4,7 +4,7 @@
*
* @package dokeos.exercise
* @author Julio Montoya Armas Added switchable fill in blank option added
* @version $Id: exercise_show.php 21160 2009-06-01 15:44:49Z aportugal $
* @version $Id: exercise_show.php 21172 2009-06-01 20:58:05Z darkvela $
*
* @todo remove the debug code and use the general debug library
* @todo use the Database:: functions
@ -270,13 +270,12 @@ function display_fill_in_blanks_answer($answer,$id,$questionId)
?>
<tr>
<td>
<?php echo Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY); ?>
<?php echo nl2br(Security::remove_XSS($answer,COURSEMANAGERLOWSECURITY)); ?>
</td><?php
if(!api_is_allowed_to_edit()) {?>
<td>
<?php
$comm = get_comments($id,$questionId);
//echo $comm;
?>
</td>
</tr>
@ -618,10 +617,10 @@ if ($show_results) {
$questionScore=0;
for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
$answerWeighting = $objAnswerTmp->selectWeighting($answerId);
// the question is encoded like this
// [A] B [C] D [E] F::10,10,10@1
@ -679,9 +678,9 @@ if ($show_results) {
$queryfill = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resfill = api_sql_query($queryfill, __FILE__, __LINE__);
$str=Database::result($resfill,0,"answer");
preg_match_all ('#\[([^[/]*)/#', $str, $arr);
$str = Database::result($resfill,0,"answer");
preg_match_all('#\[([^[/]*)/#', $str, $arr);
$choice = $arr[1];
$choice[$j]=trim($choice[$j]);
// if the word entered by the student IS the same as the one defined by the professor
@ -696,7 +695,10 @@ if ($show_results) {
$temp=api_substr($temp,$pos+1);
$i=$i+1;
}
$answer = $str;
$answer = stripslashes($str);
$answer = str_replace('rn', '', $answer);
} else {
//multiple fill in blank
while (1) {
@ -744,8 +746,9 @@ if ($show_results) {
$totalScore+=$answerWeighting[$i];
}
}
$answer = $str;
}
$answer = stripslashes($str);
$answer = str_replace('rn', '', $answer);
}
//echo $questionScore."-".$totalScore;
echo '<tr><td>';
display_fill_in_blanks_answer($answer,$id,$questionId);
@ -753,7 +756,7 @@ if ($show_results) {
$i++;
}
echo '</table>';
} elseif ($answerType == FREE_ANSWER) {
} elseif ($answerType == FREE_ANSWER) {$answer = $str;
?>
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
@ -767,12 +770,15 @@ if ($show_results) {
</tr>
<?php
$objAnswerTmp=new Answer($questionId);
$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
$questionScore=0;
$objAnswerTmp = new Answer($questionId);
$nbrAnswers = $objAnswerTmp->selectNbrAnswers();
$questionScore = 0;
$query = "select answer, marks from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resq=api_sql_query($query);
$resq = api_sql_query($query);
$choice = Database::result($resq,0,"answer");
$choice = stripslashes($choice);
$choice = str_replace('rn', '', $choice);
$questionScore = Database::result($resq,0,"marks");
if ($questionScore==-1) {
$totalScore+=0;

Loading…
Cancel
Save