0) {
echo str_repeat(' ',0).'Entered exercise_result.php'." \n";var_dump($_POST);
}
// general parameters passed via POST/GET
if ( empty ( $learnpath_id ) ) {
$learnpath_id = $_REQUEST['learnpath_id'];
}
if ( empty ( $learnpath_item_id ) ) {
$learnpath_item_id = $_REQUEST['learnpath_item_id'];
}
if ( empty ( $formSent ) ) {
$formSent= $_REQUEST['formSent'];
}
if ( empty ( $exerciseResult ) ) {
$exerciseResult = $_SESSION['exerciseResult'];
}
if ( empty ( $questionId ) ) {
$questionId = $_REQUEST['questionId'];
}
if ( empty ( $choice ) ) {
$choice = $_REQUEST['choice'];
}
if ( empty ( $questionNum ) ) {
$questionNum = $_REQUEST['questionNum'];
}
if ( empty ( $nbrQuestions ) ) {
$nbrQuestions = $_REQUEST['nbrQuestions'];
}
if ( empty ( $questionList ) ) {
$questionList = $_SESSION['questionList'];
}
if ( empty ( $objExercise ) ) {
$objExercise = $_SESSION['objExercise'];
}
if ( empty ( $exeId ) ) {
$exeId = $_REQUEST['id'];
}
if ( empty ( $action ) ) {
$action = $_GET['action'];
}
$current_user_id = api_get_user_id();
$current_user_id = "'".$current_user_id."'";
$current_attempt = $_SESSION['current_exercice_attempt'][$current_user_id];
//Is fraudulent exercice
$current_time = time();
$emailId = $_REQUEST['email'];
$user_name = $_REQUEST['user'];
$test = $_REQUEST['test'];
$dt = $_REQUEST['dt'];
$marks = $_REQUEST['res'];
$id = $_REQUEST['id'];
$sql_fb_type='SELECT feedback_type, exercises.id 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).'"';
$res_fb_type=Database::query($sql_fb_type);
$row_fb_type=Database::fetch_row($res_fb_type);
$feedback_type = $row_fb_type[0];
$exercise_id = intval($row_fb_type[1]);
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$current_expired_time_key = $course_code.'_'.$session_id.'_'.$exercise_id;
if (isset($_SESSION['expired_time'][$current_expired_time_key])) { //Only for exercice of type "One page"
$expired_date = $_SESSION['expired_time'][$current_expired_time_key];
$expired_time = strtotime($expired_date);
//Validation in case of fraud
$total_time_allowed = $expired_time + 30;
if ($total_time_allowed < $current_time) {
$sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks=0, position=0 WHERE exe_id = '$current_attempt' ";
Database::query($sql_fraud);
}
}
//Unset session for clock time
unset($_SESSION['current_exercice_attempt'][$current_user_id]);
unset($_SESSION['expired_time'][$current_expired_time_key]);
unset($_SESSION['end_expired_time'][$current_expired_time_key]);
$is_allowedToEdit=api_is_allowed_to_edit(null,true) || $is_courseTutor;
$nameTools=get_lang('CorrectTest');
if (isset($_SESSION['gradebook'])){
$gradebook= $_SESSION['gradebook'];
}
if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'],'name' => get_lang('Gradebook'));
}
$fromlink = '';
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') {
//$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"));
$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$_course['directory'], 'name' => $_course['title']);
$interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$cidReq.'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking"));
$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"));
$interbreadcrumb[] = array ("url" => "../mySpace/lp_tracking.php?action=stats&course=".$cidReq."&student_id=".Security::remove_XSS($_GET['student'])."&lp_id=".Security::remove_XSS($_GET['my_lp_id'])."&origin=".Security::remove_XSS($_GET['origin']) , "name" => get_lang("LearningPathDetails"));
$from_myspace = false;
if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
$fromlink = '&from=myspace';
$this_section = SECTION_TRACKING;
} else {
$this_section = SECTION_COURSES;
}
} elseif($origin=='student_progress') {
$this_section = SECTION_TRACKING;
$interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".Security::remove_XSS($_GET['id_session'])."&course=".$_cid, "name" => get_lang('MyProgress'));
unset($_cid);
} else {
$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
$this_section=SECTION_COURSES;
}
if ($origin != 'learnpath') {
Display::display_header($nameTools,"Exercise");
} else {
Display::display_reduced_header();
}
?>
1) {
$to = array();
foreach($teachers as $teacher) {
$to[] = $teacher['email'];
}
} elseif ($num>0){
foreach($teachers as $teacher) {
$to = $teacher['email'];
}
} else {
//this is a problem (it means that there is no admin for this course)
}
?>
0 && isset($id)) {
$test=Database::result($result,0,0);
$exerciseTitle=api_parse_tex($test);
$exerciseDescription=Database::result($result,0,1);
// 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();
$show_results = false;
//Display::display_warning_message(get_lang('CantViewResults'));
if ($origin!='learnpath') {
Display::display_warning_message(get_lang('ThankYouForPassingTheTest').''.(get_lang('BackToExercisesList')).' ', false);
echo '
';
}
}
}
if ($show_results == true) {
$user_restriction = $is_allowedToEdit ? '' : "AND user_id=".intval($_user['user_id'])." ";
$query = "SELECT attempts.question_id, answer from ".$TBL_TRACK_ATTEMPT." as attempts
INNER JOIN ".$TBL_TRACK_EXERCICES." as stats_exercices ON stats_exercices.exe_id=attempts.exe_id
INNER JOIN ".$TBL_EXERCICE_QUESTION." as quizz_rel_questions ON quizz_rel_questions.exercice_id=stats_exercices.exe_exo_id AND quizz_rel_questions.question_id = attempts.question_id
INNER JOIN ".$TBL_QUESTIONS." as questions ON questions.id=quizz_rel_questions.question_id
WHERE attempts.exe_id='".Database::escape_string($id)."' $user_restriction
GROUP BY quizz_rel_questions.question_order, attempts.question_id";
//GROUP BY questions.position, attempts.question_id";
$result =Database::query($query);
}
} else {
Display::display_warning_message(get_lang('CantViewResults'));
$show_results = false;
echo '
';
}
if ($origin == 'learnpath' && !isset($_GET['fb_type']) ) {
$show_results = false;
}
if ($show_results == true ) {
?>
0){echo "ExerciseResult: "; var_dump($exerciseResult); echo "QuestionList: ";var_dump($questionList);}
$arrques = array();
$arrans = array();
if ($show_results) {
$questionList = array();
$exerciseResult = array();
$k=0;
$counter=0;
while ($row = Database::fetch_array($result)) {
$questionList[] = $row['question_id'];
$exerciseResult[] = $row['answer'];
}
// for each question
foreach($questionList as $questionId) {
$counter++;
$k++;
$choice=$exerciseResult[$questionId];
// creates a temporary Question object
$objQuestionTmp = Question::read($questionId);
$questionName=$objQuestionTmp->selectTitle();
$questionDescription=$objQuestionTmp->selectDescription();
$questionWeighting=$objQuestionTmp->selectWeighting();
$answerType=$objQuestionTmp->selectType();
$quesId =$objQuestionTmp->selectId(); //added by priya saini
// destruction of the Question object
unset($objQuestionTmp);
if($answerType == UNIQUE_ANSWER || $answerType == MULTIPLE_ANSWER) {
$colspan=2;
}
if($answerType == MATCHING || $answerType == FREE_ANSWER) {
$colspan=2;
} else {
$colspan=2;
}
?>
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 = Database::query($queryans);
while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer'];
$choice[$ind] = 1;
}
$numAnswer=$objAnswerTmp->selectAutoId($answerId);
$studentChoice=$choice[$numAnswer];
if ($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
echo '';
if ($answerId==1) {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
} else {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
}
echo ' ';
$i++;
}
echo '
';
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
$choice=array();
?>
selectNbrAnswers();
$questionScore=0;
$real_answers = array();
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 = Database::query($queryans);
while ($row = Database::fetch_array($resultans)) {
$ind = $row['answer'];
$choice[$ind] = 1;
}
$numAnswer=$objAnswerTmp->selectAutoId($answerId);
$studentChoice=$choice[$numAnswer];
if ($answerCorrect == 1) {
if ($studentChoice) {
$real_answers[$answerId] = true;
} else {
$real_answers[$answerId] = false;
}
} else {
if ($studentChoice) {
$real_answers[$answerId] = false;
} else {
$real_answers[$answerId] = true;
}
}
echo '';
if ($answerId==1) {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
} else {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
}
echo ' ';
$i++;
}
$final_answer = true;
foreach($real_answers as $my_answer) {
if (!$my_answer) {
$final_answer = false;
}
}
if ($final_answer) {
//getting only the first score where we save the weight of all the question
$answerWeighting=$objAnswerTmp->selectWeighting(1);
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
echo '
';
} elseif ($answerType == UNIQUE_ANSWER) {
?>
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 answer from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resultans = Database::query($queryans);
$choice = Database::result($resultans,0,"answer");
$numAnswer=$objAnswerTmp->selectAutoId($answerId);
$studentChoice=($choice == $numAnswer)?1:0;
if ($studentChoice) {
$questionScore+=$answerWeighting;
$totalScore+=$answerWeighting;
}
echo '';
if ($answerId==1) {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,$answerId);
} else {
ExerciseShowFunctions::display_unique_or_multiple_answer($answerType, $studentChoice, $answer, $answerComment, $answerCorrect,$id,$questionId,"");
}
echo ' ';
$i++;
}
echo '
';
} elseif ($answerType == FILL_IN_BLANKS) {
?>
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);
// 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
$pre_array = explode('::', $answer);
// is switchable fill blank or not
$is_set_switchable = explode('@', $pre_array[1]);
$switchable_answer_set=false;
if ($is_set_switchable[1]==1) {
$switchable_answer_set=true;
}
$answer = $pre_array[0];
// splits weightings that are joined with a comma
$answerWeighting = explode(',',$is_set_switchable[0]);
//list($answer,$answerWeighting)=explode('::',$multiple[0]);
//$answerWeighting=explode(',',$answerWeighting);
// we save the answer because it will be modified
$temp=$answer;
// TeX parsing
// 1. find everything between the [tex] and [/tex] tags
$startlocations=api_strpos($temp,'[tex]');
$endlocations=api_strpos($temp,'[/tex]');
if ($startlocations !== false && $endlocations !== false) {
$texstring=api_substr($temp,$startlocations,$endlocations-$startlocations+6);
// 2. replace this by {texcode}
$temp=str_replace($texstring,'{texcode}',$temp);
}
$j=0;
// the loop will stop at the end of the text
$i=0;
//normal fill in blank
if (!$switchable_answer_set) {
while (1) {
// quits the loop if there are no more blanks
if (($pos = api_strpos($temp,'[')) === false) {
// adds the end of the text
$answer.=$temp;
// TeX parsing
$texstring = api_parse_tex($texstring);
break;
}
$temp=api_substr($temp,$pos+1);
// quits the loop if there are no more blanks
if (($pos = api_strpos($temp,']')) === false) {
break;
}
$queryfill = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resfill = Database::query($queryfill);
$str = Database::result($resfill,0,"answer");
preg_match_all('#\[([^[]*)\]#', $str, $arr);
$choice = $arr[1];
$tmp=strrpos($choice[$j],' / ');
$choice[$j]=substr($choice[$j],0,$tmp);
$choice[$j]=trim($choice[$j]);
// if the word entered by the student IS the same as the one defined by the professor
if (api_strtolower(api_substr($temp,0,$pos)) == api_strtolower($choice[$j])) {
// gives the related weighting to the student
$questionScore+=$answerWeighting[$j];
// increments total score
$totalScore+=$answerWeighting[$j];
}
// else if the word entered by the student IS NOT the same as the one defined by the professor
$j++;
$temp=api_substr($temp,$pos+1);
$i=$i+1;
}
$answer = stripslashes($str);
$answer = str_replace('rn', '', $answer);
} else {
//multiple fill in blank
while (1) {
// quits the loop if there are no more blanks
if (($pos = api_strpos($temp,'[')) === false) {
// adds the end of the text
$answer.=$temp;
// TeX parsing
$texstring = api_parse_tex($texstring);
//$answer=str_replace("{texcode}",$texstring,$answer);
break;
}
// adds the piece of text that is before the blank and ended by [
$real_text[]=api_substr($temp,0,$pos+1);
$answer.=api_substr($temp,0,$pos+1);
$temp=api_substr($temp,$pos+1);
// quits the loop if there are no more blanks
if (($pos = api_strpos($temp,']')) === false) {
// adds the end of the text
//$answer.=$temp;
break;
}
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resfill = Database::query($queryfill);
$str=Database::result($resfill,0,"answer");
preg_match_all ('#\[([^[/]*)/#', $str, $arr);
$choice = $arr[1];
$choice[$j]=trim($choice[$j]);
$user_tags[]=api_strtolower($choice[$j]);
$correct_tags[]=api_strtolower(api_substr($temp,0,$pos));
$j++;
$temp=api_substr($temp,$pos+1);
$i=$i+1;
}
$answer='';
for ($i=0;$i';
ExerciseShowFunctions::display_fill_in_blanks_answer($answer,$id,$questionId);
echo ' ';
$i++;
}
echo '
';
} elseif ($answerType == FREE_ANSWER) {$answer = $str;
?>
selectNbrAnswers();
$questionScore = 0;
$query = "select answer, marks from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$resq = Database::query($query);
$choice = Database::result($resq,0,"answer");
$choice = stripslashes($choice);
$choice = str_replace('rn', '', $choice);
$questionScore = Database::result($resq,0,"marks");
if ($questionScore==-1) {
$totalScore+=0;
} else {
$totalScore+=$questionScore;
}
$arrques[] = $questionName;
$arrans[] = $choice;
echo '
'.ExerciseShowFunctions::display_free_answer($choice, $id, $questionId).'
';
} 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);
$sql_answer = 'SELECT id, answer FROM '.$table_ans.' WHERE question_id="'.Database::escape_string($questionId).'" AND correct=0';
$res_answer = Database::query($sql_answer);
// getting the real answer
$real_list =array();
while ($real_answer = Database::fetch_array($res_answer)) {
$real_list[$real_answer['id']]= $real_answer['answer'];
}
$sql_select_answer = 'SELECT id, answer, correct, id_auto FROM '.$table_ans.' WHERE question_id="'.Database::escape_string($questionId).'" AND correct<>0';
$res_answers = Database::query($sql_select_answer);
echo '';
echo ' ';
echo '
'.get_lang("ElementList").'
'.get_lang("CorrespondsTo").'
';
echo ' ';
$questionScore=0;
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
$i_answer_correct_answer = $a_answers['correct']; //1 - 2
$i_answer_id_auto = $a_answers['id_auto']; // 3 - 4
$sql_user_answer = "SELECT answer
FROM $TBL_TRACK_ATTEMPT
WHERE exe_id = '$id' AND question_id = '$questionId' AND position='$i_answer_id_auto'";
$res_user_answer = Database::query($sql_user_answer);
if (Database::num_rows($res_user_answer)>0 ) {
$s_user_answer = Database::result($res_user_answer,0,0); // rich - good looking
} else {
$s_user_answer = 0;
}
$i_answerWeighting=$objAnswerTmp->selectWeighting($i_answer_id);
$user_answer = '';
if (!empty($s_user_answer)) {
if ($s_user_answer == $i_answer_correct_answer) {
$questionScore+=$i_answerWeighting;
$totalScore+=$i_answerWeighting;
$user_answer = ''.$real_list[$i_answer_correct_answer].' ';
} else {
$user_answer = ''.$real_list[$s_user_answer].' ';
}
}
echo '';
echo ''.$s_answer_label.' '.$user_answer.' / '.$real_list[$i_answer_correct_answer].' ';
echo ' ';
}
echo '
';
} elseif ($answerType == HOT_SPOT) {
?>
selectNbrAnswers();
$questionScore=0;
?>
selectAnswer($answerId);
$answerComment=$objAnswerTmp->selectComment($answerId);
$answerCorrect=$objAnswerTmp->isCorrect($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=Database::query($query);
$choice = Database::result($resq,0,"hotspot_correct");
ExerciseShowFunctions::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)."'";
$resfree = Database::query($queryfree);
$questionScore= Database::result($resfree,0,"marks");
$totalScore+=$questionScore;
echo '
';
echo '
'.
//
'
';
}
echo '';
if ($is_allowedToEdit) {
echo '';
$name = "fckdiv".$questionId;
$marksname = "marksName".$questionId;
?>
'.get_lang('EditIndividualComment');
} else {
echo get_lang('AddComments');
}
}
echo ' ';
$comnt = trim(ExerciseShowFunctions::get_comments($id,$questionId));
if (empty($comnt)) {
echo '
';
} else {
echo '
'.$comnt.'
';
}
echo '
';
$arrid[] = $questionId;
$feedback_form = new FormValidator('frmcomments'.$questionId,'post','');
$feedback_form->addElement('html','
');
$renderer =& $feedback_form->defaultRenderer();
$renderer->setFormTemplate('
');
$renderer->setElementTemplate('
{element}
');
$comnt = ExerciseShowFunctions::get_comments($id,$questionId);
${user.$questionId}['comments_'.$questionId] = $comnt;
$feedback_form->addElement('html_editor', 'comments_'.$questionId, null, null, array('ToolbarSet' => 'TestAnswerFeedback', 'Width' => '100%', 'Height' => '120'));
$feedback_form->addElement('html','
');
//$feedback_form->addElement('submit','submitQuestion',get_lang('Ok'));
$feedback_form->setDefaults(${user.$questionId});
$feedback_form->display();
echo '
';
} else {
$comnt = ExerciseShowFunctions::get_comments($id,$questionId);
echo ' ';
if (!empty($comnt)) {
echo ''.get_lang('Feedback').' ';
echo ''.$comnt.'
';
}
echo '';
}
if ($is_allowedToEdit) {
if ($answerType == FREE_ANSWER) {
$marksname = "marksName".$questionId;
?>
';
if ($questionScore==-1 ) {
$questionScore=0;
echo ' '.get_lang('notCorrectedYet');
}
} else {
$arrmarks[] = $questionId;
echo '
';
}
} else {
if ($questionScore==-1) {
$questionScore=0;
}
}
?>
';
echo get_lang('Score')." : $my_total_score/$my_total_weight";
echo '';
unset($objAnswerTmp);
$i++;
$totalWeighting+=$questionWeighting;
} // end of large foreach on questions
} //end of condition if $show_results
if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) {
//$query = "update ".$TBL_TRACK_EXERCICES." set exe_result = $totalScore where exe_id = '$id'";
//Database::query($query);
if ($show_results) {
echo ''.get_lang('YourTotalScore')." ";
if($dsp_percent == true) {
$my_result = number_format(($totalScore/$totalWeighting)*100,1,'.','');
$my_result = float_format($my_result,1);
echo $my_result."%";
} else {
$my_total_score = float_format($totalScore,1);
$my_total_weight = float_format($totalWeighting,1);
echo $my_total_score."/".$my_total_weight;
}
echo '!
';
}
}
if (is_array($arrid) && is_array($arrmarks)) {
$strids = implode(",",$arrid);
$marksid = implode(",",$arrmarks);
}
if ($is_allowedToEdit) {
if (in_array($origin, array('tracking_course','user_course'))) {
echo '
'.$href.''."\n";
//record the results in the learning path, using the SCORM interface (API)
echo ''."\n";
echo '