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=$is_courseAdmin; $nameTools=get_lang('Exercice'); $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices')); Display::display_header($nameTools,"Exercise"); //echo "
";
//print_r($_SESSION);
//echo "
"; $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; while ($row = mysql_fetch_array($result)) { $questionList[] = $row['question_id']; $exerciseResult[] = $row['answer']; } foreach($questionList as $questionId) { $k++; $choice=$exerciseResult[$questionId]; // creates a temporary Question object $objQuestionTmp = Question::read($questionId); $questionName=$objQuestionTmp->selectTitle(); $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 `".$TABLETRACK_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 `".$TABLETRACK_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 `".$TABLETRACK_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 `".$TABLETRACK_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"); ?>
 
 
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); $querymatch = "select * from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; $resmatch = api_sql_query($querymatch, __FILE__, __LINE__); while ($row = mysql_fetch_array($resmatch)) { $ind = $row['position']; $answ = $row['answer']; $choice[$ind] = $answ; } if($answerCorrect) { if($answerCorrect == $choice[$answerId]) { $questionScore+=$answerWeighting; $totalScore+=$answerWeighting; $choice[$answerId]=$matching[$choice[$answerId]]; } elseif(!$choice[$answerId]) { $choice[$answerId]='   '; } else { $choice[$answerId]=''.$matching[$choice[$answerId]].''; } } else { $matching[$answerId]=$answer; } ?> $v) { if($key==$answerId) { echo ""; echo "
 
 
".$answer.""; echo $v.'/'; } } ?>
selectNbrAnswers(); $questionScore=0; echo '
 
 
'; for($answerId=1;$answerId <= $nbrAnswers;$answerId++) { $answer=$objAnswerTmp->selectAnswer($answerId); $answerComment=$objAnswerTmp->selectComment($answerId); $answerCorrect=$objAnswerTmp->isCorrect($answerId); $answerWeighting=$objAnswerTmp->selectWeighting($answerId); $query = "select answer from `".$TABLETRACK_ATTEMPT."` where exe_id = $id and question_id= $questionId"; $resq=api_sql_query($query); $choice = mysql_result($resq,0,"answer"); display_hotspot_answer($answerId,$answer,$choice,$answerComment); $i++; } $queryfree = "select marks from `".$TABLETRACK_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; } ?>
'; } }?>
!