[svn r19955] Now we show the feedback in one question by page or all questions in page see FS#4034

skala
Julio Montoya 17 years ago
parent 77e8f4cd3e
commit eb934ca961
  1. 502
      main/exercice/exercise_result.php
  2. 670
      main/exercice/exercise_show.php
  3. 13
      main/exercice/question.class.php
  4. 3
      main/inc/lib/fckeditor/myconfig.js

@ -29,7 +29,7 @@
* @author Olivier Brouckaert, main author
* @author Roan Embrechts, some refactoring
* @author Julio Montoya Armas switchable fill in blank option added
* @version $Id: exercise_result.php 19897 2009-04-20 17:21:18Z cfasanando $
* @version $Id: exercise_result.php 19955 2009-04-21 21:04:23Z juliomontoya $
*
* @todo split more code up in functions, move functions to library?
*/
@ -343,9 +343,10 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
border="0" alt=" " />
</td>
<td width="45%" style="border-bottom: 1px solid #4171B5;">
<?php
<?php
$answer=api_parse_tex($answer);
echo $answer; ?>
echo $answer;
?>
</td>
<td width="45%" style="border-bottom: 1px solid #4171B5;">
<?php
@ -481,8 +482,8 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
}
$counter=0;
foreach($questionList as $questionId)
{
foreach($questionList as $questionId) {
$counter++;
// gets the student choice for this question
$choice=$exerciseResult[$questionId];
@ -498,21 +499,14 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
// destruction of the Question object
unset($objQuestionTmp);
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER)
{
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
$colspan=4;
}
elseif($answerType == MATCHING || $answerType == FREE_ANSWER)
{
} elseif($answerType == MATCHING || $answerType == FREE_ANSWER) {
$colspan=2;
}
elseif($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER)
{
} elseif($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER) {
$colspan=4;
$rowspan=$nbrAnswers+1;
}
else
{
} else {
$colspan=1;
}
?>
@ -524,15 +518,12 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
</td>
</tr>
<tr>
<td colspan="<?php echo $colspan; ?>">
<i>
<?php echo $questionDescription; ?>
</i>
<td colspan="<?php echo $colspan; ?>">
<i><?php echo $questionDescription; ?></i>
</td>
</tr>
<?php
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER)
{
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER){
?>
<tr>
<td width="5%" valign="top" align="center" nowrap="nowrap">
@ -549,9 +540,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
</td>
</tr>
<?php
}
elseif($answerType == FILL_IN_BLANKS)
{
} elseif($answerType == FILL_IN_BLANKS) {
?>
<tr>
<td>
@ -559,9 +548,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
</td>
</tr>
<?php
}
elseif($answerType == FREE_ANSWER)
{
} elseif($answerType == FREE_ANSWER) {
?>
<tr>
<td width="55%">
@ -572,9 +559,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
</td>
</tr>
<?php
}
elseif($answerType == HOT_SPOT)
{
} elseif($answerType == HOT_SPOT) {
?>
<tr>
<td valign="top" colspan="2">
@ -594,9 +579,7 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
</td>
</tr>
<?php
}
else
{
} else {
?>
<tr>
<td width="50%">
@ -616,257 +599,244 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
$questionScore=0;
if($answerType == FREE_ANSWER)
$nbrAnswers = 1;
for($answerId=1;$answerId <= $nbrAnswers;$answerId++)
{
for($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
switch($answerType)
{
switch($answerType) {
// for unique answer
case UNIQUE_ANSWER :
$studentChoice=($choice == $answerId)?1:0;
if($studentChoice)
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
break;
$studentChoice=($choice == $answerId)?1:0;
if($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
break;
// for multiple answers
case MULTIPLE_ANSWER :
$studentChoice=$choice[$answerId];
if($studentChoice)
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
break;
$studentChoice=$choice[$answerId];
if($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
break;
// for fill in the blanks
case FILL_IN_BLANKS :
// the question is encoded like this
// [A] B [C] D [E] F::10,10,10@1
// number 1 before the "@" means that is a switchable fill in blank question
// [A] B [C] D [E] F::10,10,10@ or [A] B [C] D [E] F::10,10,10
// means that is a normal fill blank question
// first we explode the "::"
$pre_array = explode('::', $answer);
// is switchable fill blank or not
$last = count($pre_array)-1;
$is_set_switchable = explode('@', $pre_array[$last]);
$switchable_answer_set=false;
if (isset($is_set_switchable[1]) && $is_set_switchable[1]==1)
{
$switchable_answer_set=true;
}
$answer = '';
for ($k=0; $k<$last; $k++)
{
$answer .= $pre_array[$k];
}
// splits weightings that are joined with a comma
$answerWeighting = explode(',',$is_set_switchable[0]);
// we save the answer because it will be modified
$temp=$answer;
// TeX parsing
// 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}
$temp=str_replace($texstring,'{texcode}',$temp);
}
$answer='';
$j=0;
//initialise answer tags
$user_tags=array();
$correct_tags=array();
$real_text=array();
// the loop will stop at the end of the text
while(1)
{
// quits the loop if there are no more blanks (detect '[')
if(($pos = strpos($temp,'[')) === false)
{
// adds the end of the text
$answer=$temp;
// TeX parsing - replacement of texcode tags
$texstring = api_parse_tex($texstring);
$answer=str_replace("{texcode}",$texstring,$answer);
$real_text[] = $answer;
break; //no more "blanks", quit the loop
}
// adds the piece of text that is before the blank
//and ends with '[' into a general storage array
$real_text[]=substr($temp,0,$pos+1);
$answer.=substr($temp,0,$pos+1);
//take the string remaining (after the last "[" we found)
$temp=substr($temp,$pos+1);
// quit the loop if there are no more blanks, and update $pos to the position of next ']'
if(($pos = strpos($temp,']')) === false)
{
// adds the end of the text
$answer.=$temp;
break;
}
$choice[$j]=trim($choice[$j]);
$user_tags[]=stripslashes(strtolower($choice[$j]));
//put the contents of the [] answer tag into correct_tags[]
$correct_tags[]=strtolower(substr($temp,0,$pos));
$j++;
$temp=substr($temp,$pos+1);
//$answer .= ']';
}
$answer='';
$real_correct_tags = $correct_tags;
$chosen_list=array();
for($i=0;$i<count($real_correct_tags);$i++)
{
if ($i==0)
{
$answer.=$real_text[0];
}
if (!$switchable_answer_set)
{
if ($correct_tags[$i]==$user_tags[$i])
{
// gives the related weighting to the student
$questionScore+=$answerWeighting[$i];
// increments total score
$totalScore+=$answerWeighting[$i];
// adds the word in green at the end of the string
$answer.=stripslashes($correct_tags[$i]);
}
// else if the word entered by the student IS NOT the same as the one defined by the professor
elseif(!empty($user_tags[$i]))
{
// adds the word in red at the end of the string, and strikes it
$answer.='<font color="red"><s>'.stripslashes($user_tags[$i]).'</s></font>';
}
else
{
// adds a tabulation if no word has been typed by the student
$answer.='&nbsp;&nbsp;&nbsp;';
}
}
else
{ // switchable fill in the blanks
if (in_array($user_tags[$i],$correct_tags))
{
$chosen_list[]=$user_tags[$i];
$correct_tags=array_diff($correct_tags,$chosen_list);
// gives the related weighting to the student
$questionScore+=$answerWeighting[$i];
// increments total score
$totalScore+=$answerWeighting[$i];
// adds the word in green at the end of the string
$answer.=stripslashes($user_tags[$i]);
} // else if the word entered by the student IS NOT the same as the one defined by the professor
elseif(!empty($user_tags[$i]))
{
// adds the word in red at the end of the string, and strikes it
$answer.='<font color="red"><s>'.stripslashes($user_tags[$i]).'</s></font>';
}
else
{
// adds a tabulation if no word has been typed by the student
$answer.='&nbsp;&nbsp;&nbsp;';
}
}
// adds the correct word, followed by ] to close the blank
$answer.=' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
if ( isset( $real_text[$i+1] ) ) {
$answer.=$real_text[$i+1];
}
}
break;
case FILL_IN_BLANKS :
// the question is encoded like this
// [A] B [C] D [E] F::10,10,10@1
// number 1 before the "@" means that is a switchable fill in blank question
// [A] B [C] D [E] F::10,10,10@ or [A] B [C] D [E] F::10,10,10
// means that is a normal fill blank question
// first we explode the "::"
$pre_array = explode('::', $answer);
// is switchable fill blank or not
$last = count($pre_array)-1;
$is_set_switchable = explode('@', $pre_array[$last]);
$switchable_answer_set=false;
if (isset($is_set_switchable[1]) && $is_set_switchable[1]==1)
{
$switchable_answer_set=true;
}
$answer = '';
for ($k=0; $k<$last; $k++)
{
$answer .= $pre_array[$k];
}
// splits weightings that are joined with a comma
$answerWeighting = explode(',',$is_set_switchable[0]);
// we save the answer because it will be modified
$temp=$answer;
// TeX parsing
// 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}
$temp=str_replace($texstring,'{texcode}',$temp);
}
$answer='';
$j=0;
//initialise answer tags
$user_tags=array();
$correct_tags=array();
$real_text=array();
// the loop will stop at the end of the text
while(1)
{
// quits the loop if there are no more blanks (detect '[')
if(($pos = strpos($temp,'[')) === false)
{
// adds the end of the text
$answer=$temp;
// TeX parsing - replacement of texcode tags
$texstring = api_parse_tex($texstring);
$answer=str_replace("{texcode}",$texstring,$answer);
$real_text[] = $answer;
break; //no more "blanks", quit the loop
}
// adds the piece of text that is before the blank
//and ends with '[' into a general storage array
$real_text[]=substr($temp,0,$pos+1);
$answer.=substr($temp,0,$pos+1);
//take the string remaining (after the last "[" we found)
$temp=substr($temp,$pos+1);
// quit the loop if there are no more blanks, and update $pos to the position of next ']'
if(($pos = strpos($temp,']')) === false)
{
// adds the end of the text
$answer.=$temp;
break;
}
$choice[$j]=trim($choice[$j]);
$user_tags[]=stripslashes(strtolower($choice[$j]));
//put the contents of the [] answer tag into correct_tags[]
$correct_tags[]=strtolower(substr($temp,0,$pos));
$j++;
$temp=substr($temp,$pos+1);
//$answer .= ']';
}
$answer='';
$real_correct_tags = $correct_tags;
$chosen_list=array();
for($i=0;$i<count($real_correct_tags);$i++) {
if ($i==0)
{
$answer.=$real_text[0];
}
if (!$switchable_answer_set)
{
if ($correct_tags[$i]==$user_tags[$i])
{
// gives the related weighting to the student
$questionScore+=$answerWeighting[$i];
// increments total score
$totalScore+=$answerWeighting[$i];
// adds the word in green at the end of the string
$answer.=stripslashes($correct_tags[$i]);
}
// else if the word entered by the student IS NOT the same as the one defined by the professor
elseif(!empty($user_tags[$i]))
{
// adds the word in red at the end of the string, and strikes it
$answer.='<font color="red"><s>'.stripslashes($user_tags[$i]).'</s></font>';
}
else
{
// adds a tabulation if no word has been typed by the student
$answer.='&nbsp;&nbsp;&nbsp;';
}
} else {
// switchable fill in the blanks
if (in_array($user_tags[$i],$correct_tags)) {
$chosen_list[]=$user_tags[$i];
$correct_tags=array_diff($correct_tags,$chosen_list);
// gives the related weighting to the student
$questionScore+=$answerWeighting[$i];
// increments total score
$totalScore+=$answerWeighting[$i];
// adds the word in green at the end of the string
$answer.=stripslashes($user_tags[$i]);
} // else if the word entered by the student IS NOT the same as the one defined by the professor
elseif(!empty($user_tags[$i]))
{
// adds the word in red at the end of the string, and strikes it
$answer.='<font color="red"><s>'.stripslashes($user_tags[$i]).'</s></font>';
}
else
{
// adds a tabulation if no word has been typed by the student
$answer.='&nbsp;&nbsp;&nbsp;';
}
}
// adds the correct word, followed by ] to close the blank
$answer.=' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
if ( isset( $real_text[$i+1] ) ) {
$answer.=$real_text[$i+1];
}
}
break;
// for free answer
case FREE_ANSWER :
$studentChoice=$choice;
$studentChoice=$choice;
if($studentChoice)
{
//Score is at -1 because the question has'nt been corected
$questionScore=-1;
$totalScore+=0;
}
if($studentChoice)
{
//Score is at -1 because the question has'nt been corected
$questionScore=-1;
$totalScore+=0;
}
break;
break;
// for matching
case MATCHING :
if($answerCorrect)
{
if($answerCorrect == $choice[$answerId])
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
$choice[$answerId]=$matching[$choice[$answerId]];
}
elseif(!$choice[$answerId])
{
$choice[$answerId]='&nbsp;&nbsp;&nbsp;';
}
else
{
$choice[$answerId]='<font color="red"><s>'.$matching[$choice[$answerId]].'</s></font>';
}
}
else
{
$matching[$answerId]=$answer;
}
break;
if($answerCorrect)
{
if($answerCorrect == $choice[$answerId])
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
$choice[$answerId]=$matching[$choice[$answerId]];
}
elseif(!$choice[$answerId])
{
$choice[$answerId]='&nbsp;&nbsp;&nbsp;';
}
else
{
$choice[$answerId]='<font color="red"><s>'.$matching[$choice[$answerId]].'</s></font>';
}
}
else
{
$matching[$answerId]=$answer;
}
break;
// for hotspot with no order
case HOT_SPOT : $studentChoice=$choice[$answerId];
if($studentChoice)
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
case HOT_SPOT :
$studentChoice=$choice[$answerId];
if($studentChoice)
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
break;
break;
// for hotspot with fixed order
case HOT_SPOT_ORDER : $studentChoice=$choice['order'][$answerId];
if($studentChoice == $answerId)
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
$studentChoice = true;
}
else
{
$studentChoice = false;
}
break;
case HOT_SPOT_ORDER :
$studentChoice=$choice['order'][$answerId];
if($studentChoice == $answerId)
{
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
$studentChoice = true;
}
else
{
$studentChoice = false;
}
break;
} // end switch Answertype
if($answerType != MATCHING || $answerCorrect)

@ -4,7 +4,7 @@
*
* @package dokeos.exercise
* @author Julio Montoya Armas Added switchable fill in blank option added
* @version $Id: exercise_show.php 19897 2009-04-20 17:21:18Z cfasanando $
* @version $Id: exercise_show.php 19955 2009-04-21 21:04:23Z juliomontoya $
*
* @todo remove the debug code and use the general debug library
* @todo use the Database:: functions
@ -45,13 +45,11 @@ $TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTE
$dsp_percent = false;
$debug=0;
if($debug>0)
{
if($debug>0) {
echo str_repeat('&nbsp;',0).'Entered exercise_result.php'."<br />\n";var_dump($_POST);
}
// general parameters passed via POST/GET
if ( empty ( $origin ) )
{
if ( empty ( $origin ) ) {
$origin = $_REQUEST['origin'];
}
if ( empty ( $learnpath_id ) ) {
@ -91,22 +89,16 @@ if ( empty ( $exeId ) ) {
$is_allowedToEdit=api_is_allowed_to_edit() || $is_courseTutor;
$nameTools=get_lang('CorrectTest');
if($origin=='user_course')
{
if($origin=='user_course') {
$interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".Security::remove_XSS($_GET['course']), "name" => get_lang("Users"));
$interbreadcrumb[] = array("url" => "../mySpace/myStudents.php?student=".Security::remove_XSS($_GET['student'])."&course=".$_course['id']."&details=true&origin=".Security::remove_XSS($_GET['origin']) , "name" => get_lang("DetailsStudentInCourse"));
}
else if($origin=='tracking_course')
{
} else if($origin=='tracking_course') {
$interbreadcrumb[] = array ("url" => "../mySpace/index.php", "name" => get_lang('MySpace'));
$interbreadcrumb[] = array ("url" => "../mySpace/myStudents.php?student=".Security::remove_XSS($_GET['student']).'&details=true&origin='.$origin.'&course='.Security::remove_XSS($_GET['cidReq']), "name" => get_lang("DetailsStudentInCourse"));
}
else if($origin=='student_progress')
{
} else if($origin=='student_progress') {
$interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".Security::remove_XSS($_GET['id_session'])."&course=".$_cid, "name" => get_lang('MyProgress'));
unset($_cid);
}
else {
} else {
$interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
$this_section=SECTION_COURSES;
}
@ -180,7 +172,7 @@ function get_comments($id,$question_id)
{
global $TBL_TRACK_ATTEMPT;
//$sql = "select teacher_comment from ".$TBL_TRACK_ATTEMPT." where exe_id='".Database::escape_string($id and question_id)."' = '".Database::escape_string($question_id)."' order by question_id";
$sql = "select teacher_comment from ".$TBL_TRACK_ATTEMPT." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' order by question_id";
$sql = "SELECT teacher_comment FROM ".$TBL_TRACK_ATTEMPT." where exe_id='".Database::escape_string($id)."' and question_id = '".Database::escape_string($question_id)."' order by question_id";
$sqlres = api_sql_query($sql, __FILE__, __LINE__);
$comm = Database::result($sqlres,0,"teacher_comment");
return $comm;
@ -201,7 +193,7 @@ function get_comments($id,$question_id)
function display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect, $id, $questionId, $ans)
{
?>
<tr valign="top">
<tr>
<td width="5%" align="center">
<img src="../img/<?php echo ($answerType == UNIQUE_ANSWER)?'radio':'checkbox'; echo $studentChoice?'_on':'_off'; ?>.gif"
border="0" alt="" />
@ -210,16 +202,36 @@ function display_unique_or_multiple_answer($answerType, $studentChoice, $answer,
<img src="../img/<?php echo ($answerType == UNIQUE_ANSWER)?'radio':'checkbox'; echo $answerCorrect?'_on':'_off'; ?>.gif"
border="0" alt=" " />
</td>
<td width="45%">
<td width="40%" style="border-bottom: 1px solid #4171B5;">
<?php
$answer=api_parse_tex($answer);
echo $answer; ?><hr style="border-top: 0.5px solid #4171B5;">
</td>
<?php
if ($ans==1) {
$comm = get_comments($id,$questionId);
}
?>
echo $answer;
?>
</td>
<td width="20%" style="border-bottom: 1px solid #4171B5;">
<?php
$answerComment=api_parse_tex($answerComment);
if($studentChoice)
{
if(!$answerCorrect)
{
echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br(make_clickable(stripslashes($answerComment))).'</span>';
}
else{
echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable(stripslashes($answerComment))).'</span>';
}
}
else
{
echo '&nbsp;';
}
?>
</td>
<?php
if ($ans==1) {
$comm = get_comments($id,$questionId);
}
?>
</tr>
<?php
}
@ -262,8 +274,7 @@ function display_free_answer($answer,$id,$questionId) {
<?php echo nl2br(stripslashes($answer)); ?>
</td> <?php if(!api_is_allowed_to_edit()) {?>
<td>
<?php
<?php
$comm = get_comments($id,$questionId);
?>
</td>
@ -296,25 +307,32 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
"#45C7F0",
"#F7BDE2");
?>
<tr>
<td valign="top" align="left">
<div style="width:100%;">
<div style="height:11px; width:11px; background-color:<?php echo $hotspot_colors[$answerId]; ?>; float:left; margin:3px;"></div>
<div><?php echo $answer ?></div>
</div>
</td>
<td valign="top" align="left"><?php echo $answerId; ?></td>
<td valign="top" align="left">
<?php $studentChoice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); echo $studentChoice; ?>
</td>
<td valign="top">
<?php echo stripslashes($answerComment); ?>
</td>
</tr>
<tr>
<td valign="top" align="left">
<div style="width:100%;">
<div style="height:11px; width:11px; background-color:<?php echo $hotspot_colors[$answerId]; ?>; float:left; margin:3px;"></div>
<div><?php echo $answer ?></div>
</div>
</td>
<td valign="top" align="left"><?php echo $answerId; ?></td>
<td valign="top" align="left">
<?php $studentChoice = ($studentChoice)?get_lang('Correct'):get_lang('Fault'); echo $studentChoice; ?>
</td>
<td valign="top" align="left" >
<?php
$answerComment=api_parse_tex($answerComment);
if($studentChoice) {
echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br(make_clickable(stripslashes($answerComment))).'</span>';
} else {
echo '<span style="font-weight: bold; color: #008000;">'.nl2br(make_clickable(stripslashes($answerComment))).'</span>';
}
?>
</td>
</tr>
<?php
}
/*
==============================================================================
MAIN CODE
@ -328,7 +346,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
<?php
$sql_test_name='SELECT title, description, results_disabled FROM '.$TBL_EXERCICES.' as exercises, '.$TBL_TRACK_EXERCICES.' as track_exercises WHERE exercises.id=track_exercises.exe_exo_id AND track_exercises.exe_id="'.Database::escape_string($id).'"';
$result=api_sql_query($sql_test_name);
$show_results = false;
$show_results = true;
// Avoiding the "Score 0/0" message when the exe_id is not set
if (Database::num_rows($result)>0 && isset($id)) {
$test=Database::result($result,0,0);
@ -338,8 +356,10 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
// if the results_disabled of the Quiz is 1 when block the script
$result_disabled=Database::result($result,0,2);
if (!(api_is_platform_admin() || api_is_course_admin()) ) {
if ($result_disabled==1) {
api_not_allowed();
if ($result_disabled==1) {
//api_not_allowed();
$show_results = false;
Display::display_warning_message(get_lang('CantViewResults'));
}
}
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($_user['user_id'])." ";
@ -357,33 +377,30 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
echo '</td>
</tr>
</table>';
}
if ($origin != 'learnpath') {
$show_results = true;
?>
<table>
<tr>
<td style="font-weight:bold"><?php echo get_lang('CourseTitle')?> : </td>
<td><?php echo $_course['name'] ?></td>
</tr>
<tr>
<td style="font-weight:bold"><?php echo get_lang('User')?> : </td>
<td><?php echo $user_name ?></td>
</tr>
<tr>
<td style="font-weight:bold">
<?php echo get_lang("Exercise"); ?>
</td>
<td>
<?php echo stripslashes($test)?><br />
<?php echo $exerciseDexcription; ?>
</td>
</tr>
</table>
<br />
<?php
}
if ($show_results) {
?>
<table>
<tr>
<td style="font-weight:bold"><?php echo get_lang('CourseTitle')?> : </td>
<td><?php echo $_course['name'] ?></td>
</tr>
<tr>
<td style="font-weight:bold"><?php echo get_lang('User')?> : </td>
<td><?php echo $user_name ?></td>
</tr>
<tr>
<td style="font-weight:bold">
<?php echo get_lang("Exercise"); ?>
</td>
<td>
<?php echo stripslashes($test)?><br />
<?php echo $exerciseDexcription; ?>
</td>
</tr>
</table>
<br />
<?php
}
$i=$totalScore=$totalWeighting=0;
if($debug>0){echo "ExerciseResult: "; var_dump($exerciseResult); echo "QuestionList: ";var_dump($questionList);}
@ -398,9 +415,10 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$exerciseResult[] = $row['answer'];
}
//echo '<pre>';print_R($questionList);
//we hide the results
if ($show_results)
foreach($questionList as $questionId) {
foreach($questionList as $questionId) {
$counter++;
$k++;
$choice=$exerciseResult[$questionId];
@ -428,78 +446,80 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$colspan=2;
}?>
<tr>
<td colspan="2" height="24px"><div id="question_title" class="sectiontitle"><?php echo get_lang("Question").' '.($counter).' : '.$questionName; ?> </div></td>
</tr>
<tr>
<td colspan="2"><?php echo $questionDescription; ?> </td>
</tr>
<tr>
<td width="200" height="90" valign="top">
<?php
if($answerType == MULTIPLE_ANSWER)
{
$choice=array();
?>
<table width="355" border="0" cellspacing="3" cellpadding="3">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><i><?php echo get_lang("Choice"); ?></i> </td>
<td><i><?php echo get_lang("ExpectedChoice"); ?></i></td>
<td><i><?php echo get_lang("Answer"); ?></i></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<?php
// construction of the Answer object
$objAnswerTmp=new Answer($questionId);
$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
$questionScore=0;
for($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
$queryans = "select * from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resultans = api_sql_query($queryans, __FILE__, __LINE__);
while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer'];
$choice[$ind] = 1;
}
$studentChoice=$choice[$answerId];
if($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
?>
<tr>
<td> <?php
if($answerId==1)
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
else
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
<tr>
<td colspan="2" height="24px"><div id="question_title" class="sectiontitle"><?php echo get_lang("Question").' '.($counter).' : '.$questionName; ?> </div></td>
</tr>
<tr>
<td colspan="2"><?php echo $questionDescription; ?> </td>
</tr>
<tr>
<td width="100%" height="90" valign="top">
<?php
if($answerType == MULTIPLE_ANSWER) {
$choice=array();
?>
</td>
</tr>
<?php
$i++;
}?>
</table>
<?php }
elseif ($answerType == UNIQUE_ANSWER)
{?>
<table width="355" border="0">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><i><?php echo get_lang("Choice"); ?></i> </td>
<td><i><?php echo get_lang("ExpectedChoice"); ?></i></td>
<td><i><?php echo get_lang("Answer"); ?></i></td>
<td><i><?php echo get_lang("Comment"); ?></i></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<?php
// construction of the Answer object
$objAnswerTmp=new Answer($questionId);
$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
$questionScore=0;
for($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
$queryans = "select * from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resultans = api_sql_query($queryans, __FILE__, __LINE__);
while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer'];
$choice[$ind] = 1;
}
$studentChoice=$choice[$answerId];
if($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
?>
<tr>
<td> <?php
if($answerId==1)
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
else
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
?>
</td>
</tr>
<?php
$i++;
}?>
</table>
<?php
} elseif ($answerType == UNIQUE_ANSWER) {
?>
<table width="100%" border="0">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td><i><?php echo get_lang("Choice"); ?></i> </td>
<td><i><?php echo get_lang("ExpectedChoice"); ?></i></td>
<td><i><?php echo get_lang("Answer"); ?></i></td>
<td><i><?php echo get_lang("Choice"); ?></i> </td>
<td><i><?php echo get_lang("ExpectedChoice"); ?></i></td>
<td><i><?php echo get_lang("Answer"); ?></i></td>
<td><i><?php echo get_lang("Comment"); ?></i></td>
</tr>
<tr>
<td>&nbsp;</td>
@ -508,8 +528,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$objAnswerTmp=new Answer($questionId);
$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
$questionScore=0;
for($answerId=1;$answerId <= $nbrAnswers;$answerId++)
{
for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
@ -518,29 +537,31 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$resultans = api_sql_query($queryans, __FILE__, __LINE__);
$choice = Database::result($resultans,0,"answer");
$studentChoice=($choice == $answerId)?1:0;
if($studentChoice)
{
if ($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}?>
}
?>
<tr>
<td><?php if($answerId==1)
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
<td>
<?php
if($answerId==1)
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
else
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
?>
display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
?>
</td>
</tr><?php
$i++;
}?>
</tr>
<?php
$i++;
}
?>
</table>
<?php }
elseif($answerType == FILL_IN_BLANKS)
{?>
<table width="355" border="0">
<?php
} elseif($answerType == FILL_IN_BLANKS){
?>
<table width="100%" border="0">
<tr>
<td>&nbsp;</td>
</tr>
@ -555,8 +576,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
$questionScore=0;
for($answerId=1;$answerId <= $nbrAnswers;$answerId++)
{
for ($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
@ -573,8 +593,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
// is switchable fill blank or not
$is_set_switchable = explode('@', $pre_array[1]);
$switchable_answer_set=false;
if ($is_set_switchable[1]==1)
{
if ($is_set_switchable[1]==1) {
$switchable_answer_set=true;
}
@ -592,8 +611,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
// 1. find everything between the [tex] and [/tex] tags
$startlocations=strpos($temp,'[tex]');
$endlocations=strpos($temp,'[/tex]');
if($startlocations !== false && $endlocations !== false)
{
if($startlocations !== false && $endlocations !== false) {
$texstring=substr($temp,$startlocations,$endlocations-$startlocations+6);
// 2. replace this by {texcode}
$temp=str_replace($texstring,'{texcode}',$temp);
@ -602,13 +620,10 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
// the loop will stop at the end of the text
$i=0;
//normal fill in blank
if (!$switchable_answer_set)
{
while(1)
{
if (!$switchable_answer_set) {
while(1) {
// quits the loop if there are no more blanks
if(($pos = strpos($temp,'[')) === false)
{
if(($pos = strpos($temp,'[')) === false) {
// adds the end of the text
$answer.=$temp;
// TeX parsing
@ -617,8 +632,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
}
$temp=substr($temp,$pos+1);
// quits the loop if there are no more blanks
if(($pos = strpos($temp,']')) === false)
{
if(($pos = strpos($temp,']')) === false) {
break;
}
@ -630,8 +644,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$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
if(strtolower(substr($temp,0,$pos)) == stripslashes(strtolower($choice[$j])))
{
if(strtolower(substr($temp,0,$pos)) == stripslashes(strtolower($choice[$j]))) {
// gives the related weighting to the student
$questionScore+=$answerWeighting[$j];
// increments total score
@ -643,11 +656,9 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$i=$i+1;
}
$answer = $str;
}
else
{ //multiple fill in blank
while(1)
{
} else {
//multiple fill in blank
while(1) {
// quits the loop if there are no more blanks
if(($pos = strpos($temp,'[')) === false)
{
@ -698,20 +709,21 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
}
$answer = $str;
}
//echo $questionScore."-".$totalScore;
//echo $questionScore."-".$totalScore;
?>
<tr>
<td> <?php display_fill_in_blanks_answer($answer,$id,$questionId); ?> </td>
</tr><?php
<td>
<?php display_fill_in_blanks_answer($answer,$id,$questionId); ?> </td>
</tr>
<?php
$i++;
}
?>
</table>
<?php }
elseif($answerType == FREE_ANSWER)
{?>
<table width="355" border="0" cellspacing="0" cellpadding="0">
<?php
} elseif($answerType == FREE_ANSWER) {
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
@ -741,10 +753,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
<td valign="top"><?php display_free_answer($choice, $id, $questionId);?> </td>
</tr>
</table>
<?php }
elseif($answerType == MATCHING)
{
<?php } elseif($answerType == MATCHING) {
$objAnswerTmp=new Answer($questionId);
$table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER);
$TBL_TRACK_ATTEMPT= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
@ -754,14 +763,13 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$res_answer = api_sql_query($sql_answer, __FILE__, __LINE__);
// getting the real answer
$real_list =array();
while($real_answer = Database::fetch_array($res_answer))
{
while($real_answer = Database::fetch_array($res_answer)) {
$real_list[$real_answer['position']]= $real_answer['answer'];
}
$res_answers = api_sql_query($sql_select_answer, __FILE__, __LINE__);
echo '<table width="355" height="71" border="0">';
echo '<table width="100%" height="71" border="0">';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
echo '<tr>
<td><span style="font-style: italic;">'.get_lang("ElementList").'</span> </td>
@ -771,8 +779,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$questionScore=0;
while($a_answers = Database::fetch_array($res_answers))
{
while($a_answers = Database::fetch_array($res_answers)) {
$i_answer_id = $a_answers['id']; //3
$s_answer_label = $a_answers['answer']; // your dady - you mother
@ -817,45 +824,36 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
}
echo '<tr>';
echo '<td>'.$s_answer_label.'</td><td>'.$s_user_answer.' / <b><span style="color: #008000;">'.$s_correct_answer.'</span></b></td>';
echo '</tr>';
}
echo '</table>';
}
else if($answerType == HOTSPOT){
echo '</tr>';
}
echo '</table>';
} else if($answerType == HOTSPOT) {
?>
<table width="355" border="0" cellspacing="0" cellpadding="0">
<table width="355" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
<?php
$objAnswerTmp=new Answer($questionId);
$nbrAnswers=$objAnswerTmp->selectNbrAnswers();
$questionScore=0;
?>
<tr>
<td valign="top" align="left">
<table style="border: 1px solid #4271b5;border-bottom:none" width="556">
<td valign="top" align="left" style="padding-left:0px;" >
<table style="border: 1px solid #4271b5;border-bottom:none" width="556px">
<?php
for($answerId=1;$answerId <= $nbrAnswers;$answerId++)
{
for($answerId=1;$answerId <= $nbrAnswers;$answerId++) {
$answer=$objAnswerTmp->selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
$answerWeighting=$objAnswerTmp->selectWeighting($answerId);
$TBL_TRACK_HOTSPOT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
$query = "select hotspot_correct from ".$TBL_TRACK_HOTSPOT." where hotspot_exe_id = '".Database::escape_string($id)."' and hotspot_question_id= '".Database::escape_string($questionId)."' AND hotspot_answer_id='".Database::escape_string($answerId)."'";
$resq=api_sql_query($query);
$choice = Database::result($resq,0,"hotspot_correct");
display_hotspot_answer($answerId,$answer,$choice,$answerComment);
display_hotspot_answer($answerId,$answer,$choice,$answerComment);
$i++;
}
$queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
@ -873,133 +871,144 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
<object type="application/x-shockwave-flash" data="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=0" width="556" height="421">
<param name="movie" value="../plugin/hotspot/hotspot_solution.swf?modifyAnswers='.$questionId.'&exe_id='.$id.'&from_db=1" />
</object>
</td>
</tr>
</table>';
</table><br/>';
}
?>
</td>
<td width="346" valign = "top"><i>
<?php echo get_lang("Comment"); ?></i>
<?php if($is_allowedToEdit)
{
//if (isset($_REQUEST['showdiv']) && $questionId==$_REQUEST['ques_id'])
//{
$name = "fckdiv".$questionId;
$marksname = "marksName".$questionId;
?>
<a href="javascript://" onclick="showfck('<?php echo $name; ?>','<?php echo $marksname; ?>');"><?php if ($answerType == FREE_ANSWER) echo "&nbsp;".get_lang('EditCommentsAndMarks'); else echo "&nbsp;".get_lang('AddComments');?></a>
<?php
$comnt = get_comments($id,$questionId);
echo "<br> <br>".$comnt;
?>
<div id="<?php echo $name; ?>" style="visibility:hidden">
<?php
$arrid[] = $questionId;
$fck_attribute['Width'] = '400';
$fck_attribute['Height'] = '150';
$fck_attribute['ToolbarSet'] = 'CommentAnswers';
$$questionId = new FormValidator('frmcomments'.$questionId,'post','');
$renderer =& $$questionId->defaultRenderer();
$renderer->setFormTemplate(
'<form{attributes}><div align="left">{content}</div></form>');
$renderer->setElementTemplate(
'<div align="left">{element}</div>'
);
$comnt =get_comments($id,$questionId);
${user.$questionId}['comments_'.$questionId] = $comnt;
$$questionId->addElement('html_editor','comments_'.$questionId,false);
//$$questionId->addElement('submit','submitQuestion',get_lang('Ok'));
$$questionId->setDefaults(${user.$questionId});
$$questionId->display();
?>
</div>
<td width="320" height="90" valign = "top">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
<?php
if($is_allowedToEdit) {
?>
<tr>
<td height="28px"></td>
</tr>
<tr>
<td>
<?php
//if (isset($_REQUEST['showdiv']) && $questionId==$_REQUEST['ques_id'])
//{
$name = "fckdiv".$questionId;
$marksname = "marksName".$questionId;
?>
<i><?php echo get_lang('MoreFeedback'); ?></i>
<br /><br />
<a href="javascript://" onclick="showfck('<?php echo $name; ?>','<?php echo $marksname; ?>');"><?php if ($answerType == FREE_ANSWER) echo "&nbsp;".get_lang('EditCommentsAndMarks'); else echo "&nbsp;".get_lang('AddComments');?></a>
<?php
}
else
{
$comnt = get_comments($id,$questionId);
echo "<br> <br>".$comnt;
}
?>
echo "<br /><br />".$comnt;
?>
<div id="<?php echo $name; ?>" style="visibility:hidden">
<?php
$arrid[] = $questionId;
$fck_attribute['Width'] = '270';
$fck_attribute['Height'] = '120';
$fck_attribute['ToolbarSet'] = 'CommentAnswers';
$fck_attribute['Config']['ToolbarStartExpanded']='false';
$$questionId = new FormValidator('frmcomments'.$questionId,'post','');
$renderer =& $$questionId->defaultRenderer();
$renderer->setFormTemplate('<form{attributes}><div align="left">{content}</div></form>');
$renderer->setElementTemplate('<div align="left">{element}</div>');
$comnt =get_comments($id,$questionId);
${user.$questionId}['comments_'.$questionId] = $comnt;
$$questionId->addElement('html_editor','comments_'.$questionId,false);
//$$questionId->addElement('submit','submitQuestion',get_lang('Ok'));
$$questionId->setDefaults(${user.$questionId});
$$questionId->display();
echo '</div>';
} else {
$comnt = get_comments($id,$questionId);
?>
<tr>
<td height="28px"></td>
</tr>
<tr>
<td><i><?php if (!empty($comnt)) echo get_lang('MoreFeedback'); ?></i></td>
</tr>
<tr>
<td>
<br /> <br />
<?php echo $comnt;
echo '</td><td>';
}
?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td></td>
<td align= "left" >
<?php
if($is_allowedToEdit)
{
if ($answerType == FREE_ANSWER)
{
$marksname = "marksName".$questionId;
?>
<div id="<?php echo $marksname; ?>" style="visibility:hidden">
<form name="marksform_<?php echo $questionId; ?>" method="post" action="">
<?php
$arrmarks[] = $questionId;
echo get_lang("AssignMarks");
echo "<select name='marks' id='marks'>";
for($i=0;$i<=$questionWeighting;$i++)
{?>
<option <?php if ($i==$questionScore) echo "selected='selected'";?>>
<?php echo $i;
?></option>
<?php } ?>
</select>
</form></div><?php
if($questionScore==-1){
$questionScore=0;
echo '<br>'.get_lang('notCorrectedYet');
}
}
else{
$arrmarks[] = $questionId;
echo '<div id="'.$marksname.'" style="visibility:hidden"><form name="marksform_'.$questionId.'" method="post" action=""><select name="marks" id="marks" style="display:none;"><option>'.$questionScore.'</option></select></form></div>';
}
} else {
if($questionScore==-1) {
$questionScore=0;
}
}?>
</td><tr><td align="left"><b><?php echo get_lang('Score')." : $questionScore/$questionWeighting"; ?></b><br /><br /></td>
if($is_allowedToEdit) {
if ($answerType == FREE_ANSWER) {
$marksname = "marksName".$questionId;
?>
<div id="<?php echo $marksname; ?>" style="visibility:hidden">
<form name="marksform_<?php echo $questionId; ?>" method="post" action="">
<?php
$arrmarks[] = $questionId;
echo get_lang("AssignMarks");
echo "<select name='marks' id='marks'>";
for($i=0;$i<=$questionWeighting;$i++) {
?>
<option <?php if ($i==$questionScore) echo "selected='selected'";?>>
<?php echo $i;
?></option>
<?php } ?>
</select>
</form></div><?php
if($questionScore==-1) {
$questionScore=0;
echo '<br>'.get_lang('notCorrectedYet');
}
} else {
$arrmarks[] = $questionId;
echo '<div id="'.$marksname.'" style="visibility:hidden"><form name="marksform_'.$questionId.'" method="post" action=""><select name="marks" id="marks" style="display:none;"><option>'.$questionScore.'</option></select></form></div>';
}
} else {
if($questionScore==-1) {
$questionScore=0;
}
}
?>
</td><tr><td align="left"><b>
<?php echo get_lang('Score')." : $questionScore/$questionWeighting"; ?></b><br /><br /></td>
</tr>
<?php unset($objAnswerTmp);
$i++;
$totalWeighting+=$questionWeighting;
}
?>
<?php if($origin!='learnpath') {?>
<tr><td align="left"><b><?php
if($origin!='learnpath') {?>
<tr><td align="left"><b>
<?php
//$query = "update ".$TBL_TRACK_EXERCICES." set exe_result = $totalScore where exe_id = '$id'";
//api_sql_query($query,__FILE__,__LINE__);
echo '<br/>'.get_lang('YourTotalScore')." ";
if($dsp_percent == true)
{
echo number_format(($totalScore/$totalWeighting)*100,1,'.','')."%";
}
else
{
echo $totalScore."/".$totalWeighting;
if ($show_results) {
echo '<br/>'.get_lang('YourTotalScore')." ";
if($dsp_percent == true) {
echo number_format(($totalScore/$totalWeighting)*100,1,'.','')."%";
} else {
echo $totalScore."/".$totalWeighting;
}
?> !</b>
echo '!</b>';
}
?>
</td></tr>
<?php } else {?>
<tr><td><br /><br /><?php Display::display_normal_message(get_lang('ExerciseFinished')) ?></td></tr>
<?php } ?>
<?php } else {?>
<tr><td><br /><br /><?php Display::display_normal_message(get_lang('ExerciseFinished')) ?></td></tr>
<?php } ?>
<tr>
<td align="left">
<br />
@ -1008,11 +1017,7 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
$strids = implode(",",$arrid);
$marksid = implode(",",$arrmarks);
}
if($is_allowedToEdit)
{
?>
<?php
if($is_allowedToEdit) {
if (in_array($origin, array('tracking_course','user_course'))) {
echo ' <form name="myform" id="myform" action="exercice.php?show=result&comments=update&exeid='.$id.'&test='.urlencode($test).'&emailid='.$emailId.'&origin='.$origin.'&student='.$_GET['student'].'&details=true&course='.$_GET['cidReq'].'" method="post">';
if (isset($_GET['myid']) && isset($_GET['my_lp_id']) && isset($_GET['student'])) {
@ -1027,16 +1032,14 @@ function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComme
}
} else {
echo ' <form name="myform" id="myform" action="exercice.php?show=result&comments=update&exeid='.$id.'&test='.$test.'&emailid='.$emailId.'" method="post">';
}
}
if ($origin!='learnpath' && $origin!='student_progress') {
?>
<button type="submit" class="save" value="<?php echo get_lang('Ok'); ?>" onclick="getFCK('<?php echo $strids; ?>','<?php echo $marksid; ?>');"><?php echo get_lang('FinishTest'); ?></button>
</form>
<?php }
}
if ($origin=='learnpath' || $origin=='student_progress') {?>
if ($origin=='learnpath' || $origin=='student_progress') {?>
<button type="button" class="save" onclick="top.location.href='../newscorm/lp_controller.php?cidReq=<?php echo api_get_course_id()?>&amp;action=view&amp;lp_id=<?php echo $learnpath_id ?>&amp;lp_item_id=<?php echo $learnpath_item_id ?>&amp;exeId=<?php echo $exeId ?>'" value="<?php echo get_lang('Finish'); ?>" ><?php echo get_lang('Finish');?></button>
<?php } else if($origin=='myprogress') {?>
<button type="button" class="save" onclick="top.location.href='../auth/my_progress.php?course=<?php echo api_get_course_id()?>'" value="<?php echo get_lang('Finish'); ?>" ><?php echo get_lang('Finish');?></button>
@ -1059,5 +1062,4 @@ unset ($questionList);
api_session_unregister('exerciseResult');
unset ($exerciseResult);
?>

@ -1,4 +1,4 @@
<?php // $Id: question.class.php 19797 2009-04-15 22:32:11Z juliomontoya $
<?php // $Id: question.class.php 19955 2009-04-21 21:04:23Z juliomontoya $
/*
==============================================================================
@ -28,7 +28,7 @@
* File containing the Question class.
* @package dokeos.exercise
* @author Olivier Brouckaert
* @version $Id: question.class.php 19797 2009-04-15 22:32:11Z juliomontoya $
* @version $Id: question.class.php 19955 2009-04-21 21:04:23Z juliomontoya $
*/
@ -1058,7 +1058,6 @@ abstract class Question
static function display_type_menu ($feedbacktype = 0)
{
global $exerciseId;
echo '<div>';
// 1. by default we show all the question types
$question_type_custom_list = self::$questionTypes;
@ -1066,8 +1065,7 @@ abstract class Question
if ($feedbacktype==1) {
//2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
$question_type_custom_list = array ( UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER]);
}
}
echo '<table>';
echo '<tr>';
foreach ($question_type_custom_list as $i=>$a_type) {
@ -1098,10 +1096,7 @@ abstract class Question
echo '<br>';
echo get_lang('GetExistingQuestion');
echo '</a>';
echo '</td>';
echo '</div>';
echo '</td>';
echo '</table>';
}

@ -415,9 +415,10 @@ FCKConfig.ToolbarSets["FreeAnswer"] = [
] ;
FCKConfig.ToolbarSets["CommentAnswers"] = [
['FitWindow','Link','Unlink','Image','flvPlayer','Table','Bold','Italic','TextColor','BGColor','Source']
['Link','Unlink','Image','flvPlayer','Bold','Italic','TextColor','BGColor']
] ;
//Wiki
FCKConfig.ToolbarSets["Wiki"] = [
['NewPage','Templates','Save','PageBreak','Preview','FitWindow','-','PasteWord','-','Undo','Redo','-','SelectAll','-','Find'],

Loading…
Cancel
Save