Source for file answer_admin.inc.php
Documentation is available at answer_admin.inc.php
DOKEOS - elearning and course management software
For a full list of contributors, see documentation/credits.html
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See "documentation/licence.html" more details.
Rue des Palais 44 Paleizenstraat
B-1030 Brussels - Belgium
* This script allows to manage answers. It is included from the script admin.php
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: answer_admin.inc.php 13301 2007-09-27 03:47:39Z yannoo $
// ALLOWED_TO_INCLUDE is defined in admin.php
$questionName= $objQuestion->selectTitle();
$answerType= $objQuestion->selectType();
$pictureName= $objQuestion->selectPicture();
$debug = 0; // debug variable to get where we are
$okPicture= empty($pictureName)? false: true;
// if we come from the warning box "this question is used in serveral exercises"
if($debug> 0){echo '$modifyIn was set'. "<br />\n";}
// if the user has chosed to modify the question only in the current exercise
if($modifyIn == 'thisExercise')
// duplicates the question
$questionId= $objQuestion->duplicate();
// deletes the old question
$objQuestion->delete($exerciseId);
// removes the old question ID from the question list of the Exercise object
$objExercise->removeFromList($modifyAnswers);
// adds the new question ID into the question list of the Exercise object
$objExercise->addToList($questionId);
// construction of the duplicated Question
// adds the exercise ID into the exercise list of the Question object
$objQuestion->addToList($exerciseId);
// copies answers from $modifyAnswers to $questionId
$objAnswer->duplicate($questionId);
// construction of the duplicated Answers
$objAnswer= new Answer($questionId);
$hotspot_coordinates= unserialize($hotspot_coordinates);
// the answer form has been submitted
if($submitAnswers || $buttonBack)
if($debug> 0){echo '$submitAnswers or $buttonBack was set'. "<br />\n";}
if($debug> 0){echo ' $answerType is UNIQUE_ANSWER or MULTIPLE_ANSWER'. "<br />\n";}
$questionWeighting= $nbrGoodAnswers= 0;
for($i= 1;$i <= $nbrAnswers;$i++ )
$reponse[$i]= trim($reponse[$i]);
$comment[$i]= trim($comment[$i]);
$weighting[$i]= intval($weighting[$i]);
if($debug> 0){echo str_repeat(' ',4). '$answerType is UNIQUE_ANSWER'. "<br />\n";}
$goodAnswer= ($correct == $i)? 1: 0;
$goodAnswer= $correct[$i];
// a good answer can't have a negative weighting
$weighting[$i]= abs($weighting[$i]);
// calculates the sum of answer weighting only if it is different from 0 and the answer is good
$questionWeighting+= $weighting[$i];
if($debug> 0){echo str_repeat(' ',4). '$answerType is MULTIPLE_ANSWER'. "<br />\n";}
// a bad answer can't have a positive weighting
$weighting[$i]= 0- abs($weighting[$i]);
// checks if field is empty
if(empty($reponse[$i]) && $reponse[$i] != '0')
// clears answers already recorded into the Answer object
// adds the answer into the object
$objAnswer->createAnswer($reponse[$i],$goodAnswer,$comment[$i],$weighting[$i],$i);
//if($_REQUEST['myid']==1)
// $mainurl="question_pool.php";
window.location.href=' <?php echo $mainurl;?>';
// clears answers already recorded into the Answer object
// checks if the question is used in several exercises
elseif($exerciseId && !$modifyIn && $objQuestion->selectNbrExercises() > 1)
$usedInSeveralExercises= 1;
// saves the answers into the data base
// sets the total weighting of the question
$objQuestion->updateWeighting($questionWeighting);
$objQuestion->save($exerciseId);
$editQuestion= $questionId;
if($debug> 0){echo str_repeat(' ',2). '$answerType is FILL_IN_BLANKS'. "<br />\n";}
if($debug> 0){echo str_repeat(' ',4). '$buttonBack is not set'. "<br />\n";}
// checks if the question is used in several exercises
if($exerciseId && !$modifyIn && $objQuestion->selectNbrExercises() > 1)
$usedInSeveralExercises= 1;
// separates text and weightings by '::'
foreach($weighting as $val)
// a blank can't have a negative weighting
$questionWeighting+= $val;
// adds blank weighting at the end of the text
$reponse= substr($reponse,0,- 1);
$objAnswer->createAnswer($reponse,0,'',0,'');
//if($_REQUEST['myid']==1)
// $mainurl="question_pool.php";
window.location.href=' <?php echo $mainurl;?>';
// sets the total weighting of the question
$objQuestion->updateWeighting($questionWeighting);
$objQuestion->save($exerciseId);
$editQuestion= $questionId;
// if no text has been typed or the text contains no blank
elseif(!ereg('\[.+\]',$reponse))
// now we're going to give a weighting to each blank
// removes character '::' possibly inserted by the user in the text
// we save the answer because it will be modified
// 1. find everything between the [tex] and [/tex] tags
$startlocations= strpos($temp,'[tex]');
$endlocations= strpos($temp,'[/tex]');
if($startlocations !== false && $endlocations !== false)
$texstring= substr($temp,$startlocations,$endlocations- $startlocations+ 6);
// 2. replace this by {texcode}
// blanks will be put into an array
// the loop will stop at the end of the text
// quits the loop if there are no more blanks
if(($pos = strpos($temp,'[')) === false)
// removes characters till '['
// quits the loop if there are no more blanks
if(($pos = strpos($temp,']')) === false)
// stores the found blank into the array
$blanks[$i++ ]= substr($temp,0,$pos);
// removes the character ']'
if($debug> 0){echo str_repeat(' ',2). '$answerType is FREE_ANSWER'. "<br />\n";}
if ( empty ( $free_comment ) ) {
$free_comment = $_POST['comment'];
if ( empty ( $weighting ) ) {
$weighting = $_POST['weighting'];
$weightingtemp = $_POST['weighting'];
if($debug> 0){echo str_repeat(' ',4). '$buttonBack is not set'. "<br />\n";}
if($debug> 0){echo str_repeat(' ',6). '$setWeighting is set'. "<br />\n";}
// checks if the question is used in several exercises
if($exerciseId && !$modifyIn && $objQuestion->selectNbrExercises() > 1)
$usedInSeveralExercises= 1;
$objAnswer->createAnswer('',0,$free_comment,$weighting,'');
// sets the total weighting of the question
$objQuestion->updateWeighting($weighting);
$objQuestion->save($exerciseId);
$editQuestion= $questionId;
unset ($modifyAnswers);//added
//if($_REQUEST['myid']==1)
// $mainurl="question_pool.php";
window.location.href=' <?php echo $mainurl;?>';
// if no text has been typed or the text contains no blank
elseif(empty($free_comment))
if($debug> 0){echo str_repeat(' ',6). '$free_comment is empty'. "<br />\n";}
/*elseif(!ereg('\[.+\]',$reponse))
$msgErr=get_lang('DefineBlanks');
if($debug> 0){echo str_repeat(' ',6). '$setWeighting is not set and $free_comment is not empty'. "<br />\n";}
// now we're going to give a weighting to each blank
if($debug> 0){echo str_repeat(' ',2). '$answerType is MATCHING'. "<br />\n";}
for($i= 1;$i <= $nbrOptions;$i++ )
$option[$i]= trim($option[$i]);
// checks if field is empty
if(empty($option[$i]) && $option[$i] != '0')
// clears options already recorded into the Answer object
// adds the option into the object
$objAnswer->createAnswer($option[$i],0,'',0,$i);
for($j= 1;$j <= $nbrMatches;$i++ ,$j++ )
$match[$i]= trim($match[$i]);
$questionWeighting+= $weighting[$i];
// checks if field is empty
if(empty($match[$i]) && $match[$i] != '0')
// clears matches already recorded into the Answer object
// check if correct number
// adds the answer into the object
$objAnswer->createAnswer($match[$i],$sel[$i],'',$weighting[$i],$i);
//if($_REQUEST['myid']==1)
//$mainurl="question_pool.php";
window.location.href=' <?php echo $mainurl;?>';
// checks if the question is used in several exercises
if($exerciseId && !$modifyIn && $objQuestion->selectNbrExercises() > 1)
$usedInSeveralExercises= 1;
// all answers have been recorded, so we save them into the data base
// sets the total weighting of the question
$objQuestion->updateWeighting($questionWeighting);
$objQuestion->save($exerciseId);
$editQuestion= $questionId;
$questionWeighting= $nbrGoodAnswers= 0;
for($i= 1;$i <= $nbrAnswers;$i++ )
if($debug> 0){echo str_repeat(' ',4). '$answerType is HOT_SPOT'. "<br />\n";}
$reponse[$i]= trim($reponse[$i]);
$comment[$i]= trim($comment[$i]);
$weighting[$i]= intval($weighting[$i]);
// checks if field is empty
if(empty($reponse[$i]) && $reponse[$i] != '0')
// clears answers already recorded into the Answer object
$msgErr= get_lang('HotspotWeightingError');
// clears answers already recorded into the Answer object
if($hotspot_coordinates[$i] == '0;0|0|0' || empty($hotspot_coordinates[$i]))
// clears answers already recorded into the Answer object
if($exerciseId && !$modifyIn && $objQuestion->selectNbrExercises() > 1)
$usedInSeveralExercises= 1;
for($i= 1;$i <= $nbrAnswers;$i++ )
if($debug> 0){echo str_repeat(' ',4). '$answerType is HOT_SPOT'. "<br />\n";}
$reponse[$i]= trim($reponse[$i]);
$weighting[$i]= intval($weighting[$i]);
$questionWeighting+= $weighting[$i];
$objAnswer->createAnswer($reponse[$i], '',$comment[$i],$weighting[$i],$i,$hotspot_coordinates[$i],$hotspot_type[$i]);
// saves the answers into the data base
// sets the total weighting of the question
$objQuestion->updateWeighting($questionWeighting);
$objQuestion->save($exerciseId);
$editQuestion= $questionId;
if($debug> 0){echo '$modifyIn was set - end'. "<br />\n";}
if($debug> 0){echo str_repeat(' ',0). '$modifyAnswers is set'. "<br />\n";}
// construction of the Answer object
$objAnswer= new Answer($questionId);
if($debug> 0){echo str_repeat(' ',2). '$answerType is UNIQUE_ANSWER or MULTIPLE_ANSWER'. "<br />\n";}
$nbrAnswers= $objAnswer->selectNbrAnswers();
for($i= 1;$i <= $nbrAnswers;$i++ )
$reponse[$i]= $objAnswer->selectAnswer($i);
$comment[$i]= $objAnswer->selectComment($i);
$weighting[$i]= $objAnswer->selectWeighting($i);
$correct[$i]= $objAnswer->isCorrect($i);
elseif($objAnswer->isCorrect($i))
if($debug> 0){echo str_repeat(' ',2). '$answerType is FILL_IN_BLANKS'. "<br />\n";}
if(!$submitAnswers && !$buttonBack)
$reponse= $objAnswer->selectAnswer(1);
list ($reponse,$weighting)= explode('::',$reponse);
$weighting= explode(',',$weighting);
// keys of the array go from 1 to N and not from 0 to N-1
for($i= 0;$i < sizeof($weighting);$i++ )
$temp[$i+ 1]= $weighting[$i];
if($debug> 0){echo str_repeat(' ',2). '$answerType is FREE_ANSWER'. "<br />\n";}
if(!$submitAnswers && !$buttonBack)
if($debug> 0){echo str_repeat(' ',4). '$submitAnswers && $buttonsBack are unset'. "<br />\n";}
if($debug> 0){echo str_repeat(' ',6). '$setWeighting is unset'. "<br />\n";}
//YW: not quite sure about whether the comment has already been recovered,
// but as we have passed into the submitAnswers loop, this should be in the
$free_comment = $objAnswer->selectComment(1);
$weighting= $objAnswer->selectWeighting(1); //added
if($debug> 0){echo str_repeat(' ',6). '$setWeighting is set and $modifyIn is unset'. "<br />\n";}
if($debug> 0){echo str_repeat(' ',2). '$answerType is MATCHING'. "<br />\n";}
if(!$nbrOptions || !$nbrMatches)
$nbrOptions= $nbrMatches= 0;
// fills arrays with data from de data base
for($i= 1;$i <= $objAnswer->selectNbrAnswers();$i++ )
if($objAnswer->isCorrect($i))
$match[$i]= $objAnswer->selectAnswer($i);
$sel[$i]= $objAnswer->isCorrect($i);
$weighting[$i]= $objAnswer->selectWeighting($i);
$option[$i]= $objAnswer->selectAnswer($i);
// keeps the correct sequence of array keys when removing an option from the list
for($i= $nbrOptions+ 1,$j= 1;$nbrOptions > 2 && $j <= $nbrMatches;$i++ ,$j++ )
$weighting[$i- 1]= $weighting[$i];
// keeps the correct sequence of array keys when adding an option into the list
for($i= $nbrMatches+ $nbrOptions;$i > $nbrOptions;$i-- )
$weighting[$i+ 1]= $weighting[$i];
if($debug> 0){echo str_repeat(' ',2). '$answerType is HOT_SPOT'. "<br />\n";}
$nbrAnswers= $objAnswer->selectNbrAnswers();
$hotspot_coordinates= Array();
for($i= 1;$i <= $nbrAnswers;$i++ )
$reponse[$i]= $objAnswer->selectAnswer($i);
$comment[$i]= $objAnswer->selectComment($i);
$weighting[$i]= $objAnswer->selectWeighting($i);
$hotspot_coordinates[$i]= $objAnswer->selectHotspotCoordinates($i);
$hotspot_type[$i]= $objAnswer->selectHotspotType($i);
$_SESSION['tmp_answers'] = array();
$_SESSION['tmp_answers']['answer'] = $reponse;
$_SESSION['tmp_answers']['comment'] = $comment;
$_SESSION['tmp_answers']['weighting'] = $weighting;
$_SESSION['tmp_answers']['hotspot_coordinates'] = $hotspot_coordinates;
$_SESSION['tmp_answers']['hotspot_type'] = $hotspot_type;
// Remove the last answer
$tmp = array_pop($_SESSION['tmp_answers']['answer']);
$tmp = array_pop($_SESSION['tmp_answers']['comment']);
$tmp = array_pop($_SESSION['tmp_answers']['weighting']);
$tmp = array_pop($_SESSION['tmp_answers']['hotspot_coordinates']);
$tmp = array_pop($_SESSION['tmp_answers']['hotspot_type']);
$_SESSION['tmp_answers']['answer'][]= '';
$_SESSION['tmp_answers']['comment'][]= '';
$_SESSION['tmp_answers']['weighting'][]= '1';
$_SESSION['tmp_answers']['hotspot_coordinates'][]= '0;0|0|0';
$_SESSION['tmp_answers']['hotspot_type'][]= 'square';
if(!$usedInSeveralExercises)
if($debug> 0){echo str_repeat(' ',2). '$usedInSeveralExercises is untrue'. "<br />\n";}
if($debug> 0){echo str_repeat(' ',4). '$answerType is UNIQUE_ANSWER or MULTIPLE_ANSWER'. "<br />\n";}
<?php echo $questionName; ?>
<form method="post" action="<?php echo api_get_self(); ?>?modifyAnswers=<?php echo $modifyAnswers; ?>">
<form method="post" action="<?php echo api_get_self(); ?>?exerciseId=<?php echo $exerciseId; ?>">
<form method="post" action=" <?php echo api_get_self(); ?>?modifyAnswers= <?php echo $modifyAnswers; ?>">
<input type="hidden" name="formSent" value="1">
<input type="hidden" name="nbrAnswers" value=" <?php echo $nbrAnswers; ?>">
<input type="hidden" name="myid" value=" <?php echo $_REQUEST['myid']; ?>">
<table width="650" border="0" cellpadding="5">
<td colspan="5" align="center"><img src="../document/download.php?doc_url=%2Fimages%2F <?php echo $pictureName; ?>" border="0"></td>
<td colspan="5"> <?php echo get_lang('Answers'); ?> :</td>
<td> <?php echo get_lang('True'); ?></td>
<td> <?php echo get_lang('Answer'); ?></td>
<td> <?php echo get_lang('Comment'); ?></td>
<td> <?php echo get_lang('QuestionWeighting'); ?></td>
for($i= 1;$i <= $nbrAnswers;$i++ )
<td valign="top"> <?php echo $i; ?></td>
<td valign="top"><input class="checkbox" type="radio" value=" <?php echo $i; ?>" name="correct" <?php if($correct == $i) echo 'checked="checked"'; ?>></td>
<td valign="top"><input class="checkbox" type="checkbox" value="1" name="correct[ <?php echo $i; ?>]" <?php if($correct[$i]) echo 'checked="checked"'; ?>></td>
<td align="left"><textarea wrap="virtual" rows="7" cols="25" name="reponse[ <?php echo $i; ?>]"> <?php echo htmlentities($reponse[$i],ENT_QUOTES,$charset); ?></textarea></td>
<td align="left"><textarea wrap="virtual" rows="7" cols="25" name="comment[ <?php echo $i; ?>]"> <?php echo htmlentities($comment[$i],ENT_QUOTES,$charset); ?></textarea></td>
<td valign="top"><input type="text" name="weighting[ <?php echo $i; ?>]" size="5" value=" <?php echo isset ($weighting[$i])? $weighting[$i]: 0; ?>"></td>
<input type="submit" name="submitAnswers" value=" <?php echo get_lang('Ok'); ?>">
<input type="submit" name="lessAnswers" value=" <?php echo get_lang('LessAnswers'); ?>">
<input type="submit" name="moreAnswers" value=" <?php echo get_lang('MoreAnswers'); ?>">
<!-- <input type="submit" name="cancelAnswers" value=" <?php echo get_lang('Cancel'); ?>" onclick="javascript:if(!confirm(' <?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;"> //-->
if($debug> 0){echo str_repeat(' ',4). '$answerType is FILL_IN_BLANKS'. "<br />\n";}
<?php echo $questionName; ?>
<form name="formulaire" method="post" action=" <?php echo api_get_self(); ?>?modifyAnswers= <?php echo $modifyAnswers; ?>">
<input type="hidden" name="formSent" value="1">
<input type="hidden" name="setWeighting" value=" <?php echo $setWeighting; ?>">
<input type="hidden" name="myid" value=" <?php echo $_REQUEST['myid']; ?>">
<input type="hidden" name="weighting" value=" <?php echo $submitAnswers? htmlentities($weighting,ENT_QUOTES,$charset): htmlentities(serialize($weighting),ENT_QUOTES,$charset); ?>">
<table border="0" cellpadding="5" width="500">
<td align="center"><img src="../document/download.php?doc_url=%2Fimages%2F <?php echo $pictureName; ?>" border="0"></td>
<td><textarea wrap="virtual" name="reponse" cols="65" rows="6"> <?php if(!$submitAnswers && empty($reponse)) echo get_lang('DefaultTextInBlanks'); else echo htmlentities($reponse,ENT_QUOTES,$charset); ?></textarea></td>
<!-- <input type="submit" name="cancelAnswers" value=" <?php echo get_lang('Cancel'); ?>" onclick="javascript:if(!confirm(' <?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;">
//--> <input type="submit" name="submitAnswers" value=" <?php echo get_lang('Ok'); ?>">
<input type="hidden" name="blanks" value=" <?php echo htmlentities(serialize($blanks),ENT_QUOTES,$charset); ?>">
<input type="hidden" name="reponse" value=" <?php echo htmlentities($reponse,ENT_QUOTES,$charset); ?>">
<table border="0" cellpadding="5" width="500">
<td colspan="2"> <?php echo get_lang('WeightingForEachBlank'); ?> :</td>
<td colspan="2"> </td>
foreach($blanks as $i=> $blank)
<td width="50%"> <?php echo $blank; ?> :</td>
<td width="50%"><input type="text" name="weighting[ <?php echo $i; ?>]" size="5" value=" <?php echo intval($weighting[$i]); ?>"></td>
<td colspan="2"> </td>
<input type="submit" name="buttonBack" value="< <?php echo get_lang('Back'); ?>">
<input type="submit" name="submitAnswers" value=" <?php echo get_lang('Ok'); ?>">
<!-- <input type="submit" name="cancelAnswers" value=" <?php echo get_lang('Cancel'); ?>" onclick="javascript:if(!confirm(' <?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;"> //-->
elseif($answerType == FREE_ANSWER) //edited by Priya Saini
if($debug> 0){echo str_repeat(' ',4). '$answerType is FREE_ANSWER'. "<br />\n";}
<?php echo $questionName;?></h3> <?php
$sql = "select description from `". $TBL_QUESTIONS. "` where id = '$questionId'";
<form name="formulaire" method="post" action=" <?php echo api_get_self(); ?>?modifyAnswers= <?php echo $modifyAnswers; ?>">
<input type="hidden" name="formSent" value="1">
<input type="hidden" name="setWeighting" value="1">
<input type="hidden" name="myid" value=" <?php echo $_REQUEST['myid'];?>">
<table border="0" cellpadding="5" width="500">
<td align="center"><img src="../document/download.php?doc_url=%2Fimages%2F <?php echo $pictureName; ?>" border="0"></td>
if(!$submitAnswers && empty($free_comment))
<tr><td width="22%"> <?php echo get_lang('QuestionWeighting'); ?></td>
<td width="78%"><input type="text" size="4" name="weighting" value=" <?php if(!$submitAnswers && !isset ($weighting)) echo '0'; else echo $weighting; ?>"></td>
<input type="submit" name="submitAnswers" value=" <?php echo get_lang('Ok'); ?>">
//end of FREE_ANSWER type*/
<?php echo $questionName; ?>
<form method="post" action=" <?php echo api_get_self(); ?>?modifyAnswers= <?php echo $modifyAnswers; ?>">
<input type="hidden" name="formSent" value="1">
<input type="hidden" name="nbrOptions" value=" <?php echo $nbrOptions; ?>">
<input type="hidden" name="nbrMatches" value=" <?php echo $nbrMatches; ?>">
<input type="hidden" name="myid" value=" <?php echo $_REQUEST['myid'];?>">
<table border="0" cellpadding="5">
<td colspan="4" align="center"><img src="../document/download.php?doc_url=%2Fimages%2F <?php echo $pictureName; ?>" border="0"></td>
// creates an array with the option letters
for($i= 1,$j= 'A';$i <= $nbrOptions;$i++ ,$j++ )
<td colspan="3"> <?php echo get_lang('MakeCorrespond'); ?> :</td>
<td> <?php echo get_lang('QuestionWeighting'); ?> :</td>
for($j= 1;$j <= $nbrMatches;$i++ ,$j++ )
<td> <?php echo $j; ?></td>
<td><input type="text" name="match[ <?php echo $i; ?>]" size="58" value=" <?php if(!$formSent && !isset ($match[$i])) echo $ {"langDefaultMakeCorrespond$j"}; else echo htmlentities($match[$i],ENT_QUOTES,$charset); ?>"></td>
<td align="center"><select name="sel[ <?php echo $i; ?>]">
foreach($listeOptions as $key=> $val)
<option value=" <?php echo $key; ?>" <?php if((!$submitAnswers && !isset ($sel[$i]) && $j == 2 && $val == 'B') || $sel[$i] == $key) echo 'selected="selected"'; ?>> <?php echo $val; ?></option>
<td align="center"><input type="text" size="8" name="weighting[ <?php echo $i; ?>]" value=" <?php if(!$submitAnswers && !isset ($weighting[$i])) echo '5'; else echo $weighting[$i]; ?>"></td>
<input type="submit" name="lessMatches" value=" <?php echo get_lang('LessElements'); ?>">
<input type="submit" name="moreMatches" value=" <?php echo get_lang('MoreElements'); ?>">
<td colspan="4"> <?php echo get_lang('DefineOptions'); ?> :</td>
foreach($listeOptions as $key=> $val)
<td> <?php echo $val; ?></td>
<td colspan="3"><input type="text" name="option[ <?php echo $key; ?>]" size="80" value=" <?php if(!$formSent && !isset ($option[$key])) echo get_lang("DefaultMatchingOpt$val"); else echo htmlentities($option[$key],ENT_QUOTES,$charset); ?>"></td>
<input type="submit" name="lessOptions" value=" <?php echo get_lang('LessElements'); ?>">
<input type="submit" name="moreOptions" value=" <?php echo get_lang('MoreElements'); ?>">
<td colspan="4"> </td>
<!-- <input type="submit" name="cancelAnswers" value=" <?php echo get_lang('Cancel'); ?>" onclick="javascript:if(!confirm(' <?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;">
//--> <input type="submit" name="submitAnswers" value=" <?php echo get_lang('Ok'); ?>">
if($debug> 0){echo str_repeat(' ',4). '$answerType is HOT_SPOT'. "<br />\n";}
$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
<?php echo $langQuestion. ": ". $questionName; ?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<td colspan="2" style="border:1px solid #4271b5; border-bottom:none;"> <?php echo stripslashes(get_lang('HotspotChoose')); ?></td>
<td width="550" valign="top">
<script type="text/javascript">
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
// Check to see if the version meets the requirements for playback
if (hasReqestedVersion) { // if we've detected an acceptable version
var oeTags = '<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_admin.swf?modifyAnswers= <?php echo $modifyAnswers ?>" width="550" height="377">'
+ '<param name="movie" value="../plugin/hotspot/hotspot_admin.swf?modifyAnswers= <?php echo $modifyAnswers ?>" />'
+ '<param name="test" value="OOoowww fo shooww" />'
document.write(oeTags); // embed the Flash Content SWF when all tests are passed
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Error<br \/>'
+ 'This content requires the Macromedia Flash Player.<br \/>'
+ '<a href=http://www.macromedia.com/go/getflash/>Get Flash<\/a>';
document.write(alternateContent); // insert non-flash content
<form method="post" action=" <?php echo api_get_self(); ?>?modifyAnswers= <?php echo $modifyAnswers; ?>" name="frm_exercise">
<input type="hidden" name="formSent" value="1" />
<input type="hidden" name="nbrAnswers" value=" <?php echo $nbrAnswers; ?>" />
<table border="0" cellpadding="3" cellspacing="0" style="border: 1px solid #4271b5; border-left:none; width: 100%; ">
<td colspan="5"> <?php echo get_lang('AnswerHotspot'); ?> :</td>
<tr style="background-color: #E6E6E6; height: 37px">
<td style="width: 20px; border-bottom: 1px solid #4271b5"> <?php /* echo get_lang('Hotspot'); */ ?></td>
<td style="width: 100px; border-bottom: 1px solid #4271b5"> <?php echo get_lang('Description'); ?>*</td>
<td style="border-bottom: 1px solid #4271b5"> <?php echo get_lang('Comment'); ?></td>
<td style="width: 60px; border-bottom: 1px solid #4271b5"> <?php echo get_lang('QuestionWeighting'); ?>*</td>
for($i= 1;$i <= $nbrAnswers;$i++ )
<td valign="top"><div style="height: 15px; width: 15px; background-color: <?php echo $hotspot_colors[$i]; ?>"> </div></td>
<td valign="top" align="left"><input type="text" name="reponse[ <?php echo $i; ?>]" value=" <?php echo htmlentities($reponse[$i],ENT_QUOTES,$charset); ?>" size="12" /></td>
<td align="left"><textarea wrap="virtual" rows="3" cols="10" name="comment[ <?php echo $i; ?>]" style="width: 100%"> <?php echo htmlentities($comment[$i],ENT_QUOTES,$charset); ?></textarea></td>
<td valign="top"><input type="text" name="weighting[ <?php echo $i; ?>]" size="1" value=" <?php echo (isset ($weighting[$i]) ? $weighting[$i] : 1); ?>" />
<input type="hidden" name="hotspot_coordinates[ <?php echo $i; ?>]" value=" <?php echo (empty($hotspot_coordinates[$i]) ? '0;0|0|0' : $hotspot_coordinates[$i]); ?>" />
<input type="hidden" name="hotspot_type[ <?php echo $i; ?>]" value=" <?php echo (empty($hotspot_type[$i]) ? 'square' : $hotspot_type[$i]); ?>" /></td>
<input type="submit" name="lessAnswers" value=" <?php echo get_lang('LessHotspots'); ?>" />
<input type="submit" name="moreAnswers" value=" <?php echo get_lang('MoreHotspots'); ?>" />
<hr noshade="noshade" size="1" style="color: #4271b5" />
<input type="submit" name="submitAnswers" value=" <?php echo get_lang('Ok'); ?>" />
<input type="submit" name="cancelAnswers" value=" <?php echo get_lang('Cancel'); ?>" onclick="javascript:if(!confirm(' <?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)); ?>')) return false;" />
<table cellpadding="0" cellspacing="0">
<td style="text-align:center; vertical-align:top; width:20px;">*</td>
<td style="width:auto;"> <?php echo get_lang('HotspotRequired'); ?></td>
if($debug> 0){echo str_repeat(' ',0). '$modifyAnswers was set - end'. "<br />\n";}
|