read($exercise_id); } //Only users can see their own results if (!$is_allowedToEdit) { if ($student_id != $current_user_id) { api_not_allowed(); } } if ($show_headers) { $interbreadcrumb[] = array("url" => "exercice.php","name" => get_lang('Exercices')); $interbreadcrumb[] = array("url" => "#","name" => get_lang('Result')); $this_section = SECTION_COURSES; Display::display_header(); } else { Display::display_reduced_header(); } $show_results = true; $show_only_total_score = false; $display_category_name = 1; // Avoiding the "Score 0/0" message when the exe_id is not set if (!empty($track_exercise_info)) { $exerciseTitle = $track_exercise_info['title']; $exerciseDescription = $track_exercise_info['description']; // if the results_disabled of the Quiz is 1 when block the script $result_disabled = $track_exercise_info['results_disabled']; $display_category_name = $track_exercise_info['display_category_name']; if (!(api_is_platform_admin() || api_is_course_admin()) ) { if ($result_disabled == EXERCISE_FEEDBACK_TYPE_DIRECT) { $show_results = false; Display::display_warning_message(get_lang('CantViewResults')); } elseif ($result_disabled == EXERCISE_FEEDBACK_TYPE_EXAM) { $show_results = false; $show_only_total_score = true; } } } if ($show_results || $show_only_total_score) { $user_info = api_get_user_info($student_id); //Shows exercise header $objExercise->description = ''; echo $objExercise->show_exercise_result_header(api_get_person_name($user_info['firstName'], $user_info['lastName']), api_convert_and_format_date($exercise_date, DATE_TIME_FORMAT_LONG)); } $i = $totalScore = $totalWeighting = 0; $result = get_exercise_results_by_attempt($id); $question_list = $result[$id]['question_list']; // for each question $total_weighting = 0; $counter = 1; if (!empty($question_list)) { foreach ($question_list as $question_item) { $objQuestionTmp = Question::read($question_item['question_id'], api_get_course_int_id()); $total_weighting += $objQuestionTmp->selectWeighting(); } foreach ($question_list as $question_item) { $choice = $question_item['answer']; // creates a temporary Question object $questionId = $question_item['question_id']; $objQuestionTmp = Question::read($questionId, api_get_course_int_id()); $questionName = $objQuestionTmp->selectTitle(); $questionDescription= $objQuestionTmp->selectDescription(); $questionWeighting = $objQuestionTmp->selectWeighting(); $answerType = $objQuestionTmp->selectType(); $quesId = $objQuestionTmp->selectId(); if ($show_results) { // display question category, if any Testcategory::displayCategoryAndTitle($questionId, $display_category_name ); echo $objQuestionTmp->return_header($objExercise->feedback_type, $counter); } $counter++; if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) { $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); $questionScore = $question_result['score']; $totalScore += $question_result['score']; } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) { $choice = array(); $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); $questionScore = $question_result['score']; $totalScore += $question_result['score']; } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) { $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); $questionScore = $question_result['score']; $totalScore += $question_result['score']; } elseif ($answerType == FILL_IN_BLANKS) { $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); $questionScore = $question_result['score']; $totalScore += $question_result['score']; } elseif ($answerType == FREE_ANSWER) { $answer = $str; $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); $questionScore = $question_result['score']; $totalScore += $question_result['score']; } elseif ($answerType == MATCHING) { $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg()); $questionScore = $question_result['score']; $totalScore += $question_result['score']; } elseif ($answerType == HOT_SPOT) { //@todo move this in the manage_answer function if ($show_results) { echo '
| |
'. ' |
'.get_lang('Requirements').' | '.get_lang('YourAnswer').' | |
'.get_lang('Overlap').' | '.get_lang('Min').' '.$threadhold1.' | '.(($final_overlap < 0)?0:intval($final_overlap)).' |
'.get_lang('Excess').' | '.get_lang('Max').' '.$threadhold2.' | '.(($final_excess < 0)?0:intval($final_excess)).' |
'.get_lang('Missing').' | '.get_lang('Max').' '.$threadhold3.' | '.(($final_missing < 0)?0:intval($final_missing)).' |
'.get_lang('OARHit').'
'; } else { $message=''.get_lang('YourDelineation').'
'; $message.=$table_resume; $message.=''.$comment.'
'; echo $message; } else { echo ''.$comment.'
'; } //showing the score /* $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;*/ ?>