0) { echo str_repeat(' ',0).'Entered exercise_result.php'."
\n";var_dump($_POST); } // general parameters passed via POST/GET if ( empty ( $origin ) ) { $origin = $_REQUEST['origin']; } if ( empty ( $learnpath_id ) ) { $learnpath_id = mysql_real_escape_string($_REQUEST['learnpath_id']); } if ( empty ( $learnpath_item_id ) ) { $learnpath_item_id = mysql_real_escape_string($_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 = mysql_real_escape_string($_REQUEST['questionNum']); } if ( empty ( $nbrQuestions ) ) { $nbrQuestions = mysql_real_escape_string($_REQUEST['nbrQuestions']); } if ( empty ( $questionList ) ) { $questionList = $_SESSION['questionList']; } if ( empty ( $objExercise ) ) { $objExercise = $_SESSION['objExercise']; } $is_allowedToEdit=api_is_allowed_to_edit() || $is_courseTutor; $nameTools=get_lang('CorrectTest'); if($origin=='user_course') { $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$_GET['course'], "name" => get_lang("Users")); $interbreadcrumb[] = array("url" => "../mySpace/myStudents.php?student=".$_GET['student']."&course=".$_course['id']."&details=true&origin=".$_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=".$_GET['student'].'&details=true&origin='.$origin.'&course='.$_GET['cidReq'], "name" => get_lang("DetailsStudentInCourse")); } else if($origin=='student_progress') { $interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".$_GET['id_session']."&course=".$_cid, "name" => get_lang('MyProgress')); unset($_cid); } else { $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')); $this_section=SECTION_COURSES; } Display::display_header($nameTools,"Exercise"); $emailId = $_REQUEST['email']; $user_name = $_REQUEST['user']; $test = $_REQUEST['test']; $dt = $_REQUEST['dt']; $marks = $_REQUEST['res']; $id = $_REQUEST['id']; ?>
:
:


0){echo "ExerciseResult: "; var_dump($exerciseResult); echo "QuestionList: ";var_dump($questionList);} // for each question $questionList = array(); $exerciseResult = array(); $k=0; $counter=0; while ($row = mysql_fetch_array($result)) { $questionList[] = $row['question_id']; $exerciseResult[] = $row['answer']; } 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 = $id and question_id= $questionId"; $resultans = api_sql_query($queryans, __FILE__, __LINE__); while ($row = mysql_fetch_array($resultans)) { $ind = $row['answer']; $choice[$ind] = 1; } $studentChoice=$choice[$answerId]; if($studentChoice) { $questionScore+=$answerWeighting; $totalScore+=$answerWeighting; } ?>
 
 
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 = $id and question_id= $questionId"; $resultans = api_sql_query($queryans, __FILE__, __LINE__); $choice = mysql_result($resultans,0,"answer"); $studentChoice=($choice == $answerId)?1:0; if($studentChoice) { $questionScore+=$answerWeighting; $totalScore+=$answerWeighting; }?>
 
 
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); list($answer,$answerWeighting)=explode('::',$answer); // splits weightings that are joined with a comma $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=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); } $j=0; // the loop will stop at the end of the text $i=0; while(1) { // quits the loop if there are no more blanks if(($pos = strpos($temp,'[')) === false) { // adds the end of the text $answer.=$temp; // TeX parsing $texstring = api_parse_tex($texstring); break; } $temp=substr($temp,$pos+1); // quits the loop if there are no more blanks if(($pos = strpos($temp,']')) === false) { break; } $queryfill = "select answer from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resfill = api_sql_query($queryfill, __FILE__, __LINE__); $str=mysql_result($resfill,0,"answer"); preg_match_all ('#\[([^[/]*)/#', $str, $arr); $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]))) { // 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=substr($temp,$pos+1); $i=$i+1; } $answer = $str; ?>
 
 
selectNbrAnswers(); $questionScore=0; $query = "select answer, marks from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resq=api_sql_query($query); $choice = mysql_result($resq,0,"answer"); $questionScore = mysql_result($resq,0,"marks"); if($questionScore==-1){ $totalScore+=0; } else{ $totalScore+=$questionScore; } ?>
 
 
0'; $res_answers = api_sql_query($sql_select_answer, __FILE__, __LINE__); echo ''; echo ''; echo ''; echo ''; $questionScore=0; while($a_answers = mysql_fetch_array($res_answers)){ $i_answer_id = $a_answers['id']; $s_answer_label = $a_answers['answer']; $i_answer_correct_answer = $a_answers['correct']; $i_answer_position = $a_answers['position']; $sql_user_answer = 'SELECT answers.answer FROM '.$table_ans.' as answers INNER JOIN '.$TBL_TRACK_ATTEMPT.' as track_e_attempt ON track_e_attempt.answer=answers.position AND track_e_attempt.position="'.$i_answer_position.'" AND exe_id = "'.$id.'" WHERE answers.question_id ="'.$questionId.'" AND correct=0'; $res_user_answer = api_sql_query($sql_user_answer, __FILE__, __LINE__); $s_user_answer = mysql_result($res_user_answer,0,0); $sql_correct_answer = 'SELECT answer FROM '.$table_ans.' WHERE position = "'.$i_answer_correct_answer.'" AND question_id="'.$questionId.'"'; $res_correct_answer = api_sql_query($sql_correct_answer, __FILE__, __LINE__); $s_correct_answer = mysql_result($res_correct_answer,0,0); $i_answerWeighting=$objAnswerTmp->selectWeighting($i_answer_id); if($s_user_answer == $s_correct_answer){ $questionScore+=$i_answerWeighting; $totalScore+=$i_answerWeighting; } else{ $s_user_answer = ''.$s_user_answer.''; } echo ''; echo ''; echo ''; } echo '
 
'.get_lang("ElementList").' '.get_lang("CorrespondsTo").'
 
'.$s_answer_label.''.$s_user_answer.' / '.$s_correct_answer.'
'; } else if($answerType == HOTSPOT){ ?> 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 = $id and hotspot_question_id= $questionId AND hotspot_answer_id=$answerId"; $resq=api_sql_query($query); $choice = mysql_result($resq,0,"hotspot_correct"); display_hotspot_answer($answerId,$answer,$choice,$answerComment); $i++; } $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." where exe_id = $id and question_id= $questionId"; $resfree = api_sql_query($queryfree, __FILE__, __LINE__); $questionScore= mysql_result($resfree,0,"marks"); $totalScore+=$questionScore; ?>
'; } ?>

".$comnt; ?>
".$comnt; } ?>
'.get_lang('notCorrectedYet'); } } else{ $arrmarks[] = $questionId; echo ''; } } else{ if($questionScore==-1){ $questionScore=0; } }?>
'.get_lang('YourTotalScore')." "; if($dsp_percent == true) { echo number_format(($totalScore/$totalWeighting)*100,1,'.','')."%"; } else { echo $totalScore."/".$totalWeighting; } ?> !

'; } else{ echo '
'; } ?>