[svn r11548] Fix the bug with question number

skala
Julian Prud'homme 19 years ago
parent 2384e178dc
commit 51c1cc9927
  1. 8
      main/exercice/exercise_result.php
  2. 4
      main/exercice/exercise_show.php

@ -27,7 +27,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 11546 2007-03-12 15:52:51Z guim_led $ * @version $Id: exercise_result.php 11548 2007-03-12 16:03:43Z elixir_julian $
* *
* @todo split more code up in functions, move functions to library? * @todo split more code up in functions, move functions to library?
*/ */
@ -298,9 +298,11 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$res = api_sql_query($sql, __FILE__, __LINE__); $res = api_sql_query($sql, __FILE__, __LINE__);
$exeId =mysql_result($res,0,"id"); $exeId =mysql_result($res,0,"id");
$exeId=$exeId+1; $exeId=$exeId+1;
$counter=0;
foreach($questionList as $questionId) foreach($questionList as $questionId)
{ {
$counter++;
// gets the student choice for this question // gets the student choice for this question
$choice=$exerciseResult[$questionId]; $choice=$exerciseResult[$questionId];
// creates a temporary Question object // creates a temporary Question object
@ -336,7 +338,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
<table width="100%" border="0" cellpadding="3" cellspacing="2"> <table width="100%" border="0" cellpadding="3" cellspacing="2">
<tr bgcolor="#E6E6E6"> <tr bgcolor="#E6E6E6">
<td colspan="<?php echo $colspan; ?>"> <td colspan="<?php echo $colspan; ?>">
<?php echo get_lang("Question").' '.($i+1); ?> <?php echo get_lang("Question").' '.($counter); ?>
</td> </td>
</tr> </tr>
<tr> <tr>

@ -306,6 +306,7 @@ $result =api_sql_query($query, __FILE__, __LINE__);
$questionList = array(); $questionList = array();
$exerciseResult = array(); $exerciseResult = array();
$k=0; $k=0;
$counter=0;
while ($row = mysql_fetch_array($result)) while ($row = mysql_fetch_array($result))
{ {
$questionList[] = $row['question_id']; $questionList[] = $row['question_id'];
@ -313,6 +314,7 @@ $result =api_sql_query($query, __FILE__, __LINE__);
} }
foreach($questionList as $questionId) foreach($questionList as $questionId)
{ {
$counter++;
$k++; $k++;
$choice=$exerciseResult[$questionId]; $choice=$exerciseResult[$questionId];
// creates a temporary Question object // creates a temporary Question object
@ -341,7 +343,7 @@ $result =api_sql_query($query, __FILE__, __LINE__);
}?> }?>
<tr bgcolor="#E6E6E6"> <tr bgcolor="#E6E6E6">
<td colspan="2" > <?php echo get_lang("Question").' '.($i+1); ?> </td> <td colspan="2" > <?php echo get_lang("Question").' '.($counter); ?> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"><?php echo $questionName; ?> </td> <td colspan="2"><?php echo $questionName; ?> </td>

Loading…
Cancel
Save