get_stat_track_exercise_info_by_exe_id($exe_id); if (!empty($exercise_stat_info) && isset($exercise_stat_info['exe_exo_id'])) { header("Location: overview.php?exerciseId=".$exercise_stat_info['exe_exo_id']); exit; } api_not_allowed(); } $gradebook = ''; if (isset($_SESSION['gradebook'])) { $gradebook= $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook=='view') { $interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook')); } $nameTools = get_lang('Exercice'); $interbreadcrumb[]= array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); if ($origin != 'learnpath') { //so we are not in learnpath tool Display::display_header($nameTools,get_lang('Exercise')); } else { Display::display_reduced_header(); } //Hide results $show_results = false; $show_only_score = false; if ($objExercise->results_disabled == 0) { $show_results = true; } if ($objExercise->results_disabled == 2) { $show_only_score = true; } /* DISPLAY AND MAIN PROCESS */ // I'm in a preview mode as course admin. Display the action menu. if (api_is_course_admin() && $origin != 'learnpath') { echo '
'; echo ''.Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32).''; echo ''.Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32).''; echo '
'; } $feedback_type = $objExercise->feedbacktype; $exercise_stat_info = $objExercise->get_stat_track_exercise_info_by_exe_id($exe_id); if (!empty($exercise_stat_info['data_tracking'])) { $question_list = explode(',', $exercise_stat_info['data_tracking']); } $safe_lp_id = $exercise_stat_info['orig_lp_id']; $safe_lp_item_id = $exercise_stat_info['orig_lp_item_id']; $safe_lp_item_view_id = $exercise_stat_info['orig_lp_item_view_id']; if ($origin == 'learnpath') { ?>
selectAttempts() > 0) { $attempt_count = get_attempt_count(api_get_user_id(), $objExercise->id, $safe_lp_id, $safe_lp_item_id, $safe_lp_item_view_id); if ($attempt_count >= $objExercise->selectAttempts()) { Display :: display_warning_message(sprintf(get_lang('ReachedMaxAttempts'), $objExercise->selectTitle(), $objExercise->selectAttempts()), false); if ($origin != 'learnpath') { //we are not in learnpath tool Display::display_footer(); } exit; } } $user_info = api_get_user_info(api_get_user_id()); if ($show_results || $show_only_score) { echo $exercise_header = $objExercise->show_exercise_result_header(api_get_person_name($user_info['firstName'], $user_info['lastName'])); } Display :: display_normal_message(get_lang('Saved').'
',false); // Display text when test is finished #4074 // Don't display the text when finished message if we are from a LP #4227 // but display it from page exercice_show.php $end_of_message = $objExercise->selectTextWhenFinished(); if (!empty($end_of_message) && ($origin != 'learnpath')) { Display::display_normal_message($end_of_message, false); echo "
 
"; } $counter = 1; $total_score = $total_weight = 0; // Loop over all question to show results for each of them, one by one if (!empty($question_list)) { if ($debug) { error_log('Looping question_list '.print_r($question_list,1));} foreach ($question_list as $questionId) { // destruction of the Question object unset($objQuestionTmp); // gets the student choice for this question $choice = $exerciseResult[$questionId]; // creates a temporary Question object $objQuestionTmp = Question :: read($questionId); //this variable commes from exercise_submit_modal.php //$hotspot_delineation_result = $_SESSION['hotspot_delineation_result'][$objExercise->selectId()][$quesId]; if ($show_results) { // show category Testcategory::displayCategoryAndTitle($objQuestionTmp->id); // show titles echo $objQuestionTmp->return_header($objExercise->feedback_type, $counter); $counter++; } // We're inside *one* question. Go through each possible answer for this question $result = $objExercise->manage_answer($exercise_stat_info['exe_id'], $questionId, null ,'exercise_result', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), $hotspot_delineation_result); $total_score += $result['score']; $total_weight += $result['weight']; } // end foreach() block that loops over all questions } if ($origin != 'learnpath') { if ($show_results || $show_only_score) { echo '
'; echo get_lang('YourTotalScore')." "; if ($objExercise->selectPropagateNeg() == 0 && $total_score < 0) { $total_score = 0; } echo show_score($total_score, $total_weight, false, true, true, $objExercise->selectPassPercentage()); echo '
'; } } // Tracking of results // Updates the empty exercise $quizDuration = (!empty($_SESSION['quizStartTime']) ? time() - $_SESSION['quizStartTime'] : 0); $feed = $objExercise->feedbacktype; if (api_is_allowed_to_session_edit()) { update_event_exercice($exercise_stat_info['exe_id'], $objExercise->selectId(), $total_score, $total_weight, api_get_session_id(), $safe_lp_id, $safe_lp_item_id, $safe_lp_item_view_id, $quiz_duration, $question_list, ''); } //If is not valid $session_control_key = get_session_time_control_key($objExercise->id); if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id)) { $TBL_TRACK_ATTEMPT = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $sql_fraud = "UPDATE $TBL_TRACK_ATTEMPT SET answer = 0, marks=0, position=0 WHERE exe_id = $exe_id "; Database::query($sql_fraud); } //Unset session for clock time exercise_time_control_delete($objExercise->id); if ($origin != 'learnpath') { Display::display_footer(); } else { $lp_mode = $_SESSION['lp_mode']; $url = '../newscorm/lp_controller.php?cidReq='.api_get_course_id().'&action=view&lp_id='.$safe_lp_id.'&lp_item_id='.$safe_lp_item_id.'&exeId='.$exercise_stat_info['exe_id'].'&fb_type='.$feed; //echo $total_score.','.$total_weight; exit; $href = ($lp_mode == 'fullscreen')?' window.opener.location.href="'.$url.'" ':' top.location.href="'.$url.'" '; echo ''."\n"; //record the results in the learning path, using the SCORM interface (API) echo ''."\n"; echo ''; } // Send notification.. if (!api_is_allowed_to_edit(null,true)) { $objExercise->send_notification($arrques, $arrans, $origin); } if (api_is_allowed_to_session_edit()) { Session::erase('objExercise'); Session::erase('exe_id'); }