[svn r13730] Minor - using constants instead of meaning-less numbers

Minor - added fifth parameter to exercise_attempt() calls to avoid warnings
skala
Yannick Warnier 18 years ago
parent 598219a11d
commit 275c51cfd5
  1. 18
      main/exercice/exercise_result.php

@ -25,7 +25,7 @@
* @package dokeos.exercise * @package dokeos.exercise
* @author Olivier Brouckaert, main author * @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring * @author Roan Embrechts, some refactoring
* @version $Id: exercise_result.php 13320 2007-09-27 09:59:13Z elixir_julian $ * @version $Id: exercise_result.php 13730 2007-11-21 15:14:12Z yannoo $
* *
* @todo split more code up in functions, move functions to library? * @todo split more code up in functions, move functions to library?
*/ */
@ -737,16 +737,16 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
if(empty($choice)){ if(empty($choice)){
$choice = 0; $choice = 0;
} }
if ($answerType==2 ) if ($answerType==MULTIPLE_ANSWER )
{ {
$reply = array_keys($choice); $reply = array_keys($choice);
for ($i=0;$i<sizeof($reply);$i++) for ($i=0;$i<sizeof($reply);$i++)
{ {
$ans = $reply[$i]; $ans = $reply[$i];
exercise_attempt($questionScore,$ans,$quesId,$exeId); exercise_attempt($questionScore,$ans,$quesId,$exeId,$i);
} }
} }
elseif ($answerType==4) elseif ($answerType==MATCHING)
{ {
$j=sizeof($matching)+1; $j=sizeof($matching)+1;
@ -765,21 +765,21 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
} }
} }
elseif ($answerType==5) elseif ($answerType==FREE_ANSWER)
{ {
$answer = $choice; $answer = $choice;
exercise_attempt($questionScore,$answer,$quesId,$exeId); exercise_attempt($questionScore,$answer,$quesId,$exeId,0);
} }
elseif ($answerType==1) elseif ($answerType==UNIQUE_ANSWER)
{ {
$sql = "select id from $table_ans where question_id=$questionId and position=$choice"; $sql = "select id from $table_ans where question_id=$questionId and position=$choice";
$res = api_sql_query($sql, __FILE__, __LINE__); $res = api_sql_query($sql, __FILE__, __LINE__);
$answer = mysql_result($res,0,"id"); $answer = mysql_result($res,0,"id");
exercise_attempt($questionScore,$answer,$quesId,$exeId); exercise_attempt($questionScore,$answer,$quesId,$exeId,0);
} }
else else
{ {
exercise_attempt($questionScore,$answer,$quesId,$exeId); exercise_attempt($questionScore,$answer,$quesId,$exeId,0);
} }
} }
} // end huge foreach() block that loops over all questions } // end huge foreach() block that loops over all questions

Loading…
Cancel
Save