$i = $total_score = $total_weight = 0;
//We check if the user attempts before sending to the exercise_result.php
if ($objExercise->selectAttempts() > 0) {
    $attempt_count = get_attempt_count(api_get_user_id(), $objExercise->id, $learnpath_id, $learnpath_item_id, $learnpath_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;
    }
}
Display::display_normal_message(get_lang('Saved') . '<br />', false);
// Display and save questions
display_question_list_by_attempt($objExercise, $exe_id, true);
//If is not valid
/*
$session_control_key = get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_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, $learnpath_id, $learnpath_item_id);
delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
    echo '<hr>';
    echo Display::url(get_lang('ReturnToCourseHomepage'), api_get_course_url(), array('class' => 'btn btn-large'));
    if (api_is_allowed_to_session_edit()) {
Example #2
0
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = get_exercise_track_exercise_info($id);
//No track info
if (empty($track_exercise_info)) {
    api_not_allowed($show_headers);
}
$exercise_id = $track_exercise_info['exe_exo_id'];
$student_id = $track_exercise_info['exe_user_id'];
$current_user_id = api_get_user_id();
$objExercise = new Exercise();
if (!empty($exercise_id)) {
    $objExercise->read($exercise_id);
}
//Only users can see their own results
if (!$is_allowedToEdit) {
    if ($student_id != $current_user_id) {
        api_not_allowed($show_headers);
    }
}
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();
}
display_question_list_by_attempt($objExercise, $id, false);
if ($show_headers) {
    Display::display_footer();
}