@ -33,7 +33,7 @@
* the administrator
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: exercice_submit.php 14930 2008-04-16 21:41:35Z juliomontoya $
* @version $Id: exercice_submit.php 15251 2008-05-08 20:28:28Z yannoo $
*/
@ -100,7 +100,7 @@ if ( empty ( $exerciseType ) ) {
$exerciseType = $_REQUEST['exerciseType'];
}
if ( empty ( $exerciseId ) ) {
$exerciseId = $_REQUEST['exerciseId'];
$exerciseId = intval( $_REQUEST['exerciseId']) ;
}
if ( empty ( $choice ) ) {
$choice = $_REQUEST['choice'];
@ -114,6 +114,7 @@ if ( empty ( $nbrQuestions ) ) {
if ( empty ($buttonCancel) ) {
$buttonCancel = $_REQUEST['buttonCancel'];
}
$error = '';
// if the user has clicked on the "Cancel" button
if($buttonCancel)
@ -199,24 +200,26 @@ if($formSent)
}
// if the object is not in the session
if(!isset($_SESSION['objExercise']) || $origin == 'learnpath')
if(!isset($_SESSION['objExercise']) || $origin == 'learnpath' || $_SESSION['objExercise']->id != $_REQUEST['exerciseId'] )
{
if($debug>0){echo str_repeat(' ',0).'$_SESSION[objExercise] was unset'."< br / > \n";}
// construction of Exercise
$objExercise=new Exercise();
#$sql="SELECT title,description,sound,type,random,active FROM `$TBL_EXERCICES` WHERE id='$exerciseId'";
unset($_SESSION['questionList']);
// if the specified exercise doesn't exist or is disabled
if(!$objExercise->read($exerciseId) || (!$objExercise->selectStatus() & & !$is_allowedToEdit & & ($origin != 'learnpath') ))
{
die(get_lang('ExerciseNotFound'));
unset($objExercise);
$error = get_lang('ExerciseNotFound');
//die(get_lang('ExerciseNotFound'));
}
else
{
// saves the object into the session
api_session_register('objExercise');
if($debug>0){echo str_repeat(' ',0).'$_SESSION[objExercise] was unset - set now - end'."< br / > \n";}
}
}
if(!isset($objExcercise) & & isset($_SESSION['objExercise'])){
@ -410,7 +413,7 @@ else
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = " <?php echo $document_language ; ?> " lang = " <?php echo $document_language ; ?> " >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" / >
< meta http-equiv = "Content-Type" content = "text/html; charset= <?php echo $charset ; ?> " />
< / head >
< body >
@ -423,6 +426,13 @@ else
echo "< h3 > ".$exerciseTitle."< / h3 > ";
if(!empty($error))
{
Display::display_error_message($error,false);
}
else
{
if(!empty($exerciseSound))
{
echo "< a href = \"../document/download.php?doc_url=%2Faudio%2F".$exerciseSound."\" target = \"_blank\" > ",
@ -567,6 +577,7 @@ $s="</table>
$b=2;
echo $s;
}
if ($origin != 'learnpath') { //so we are not in learnpath tool
Display::display_footer();