$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 questions.
$objExercise->displayQuestionListByAttempt($exe_id, true);
// If is not valid.
/*
$session_control_key = ExerciseLib::get_session_time_control_key($objExercise->id, $learnpath_id, $learnpath_item_id);
if (isset($session_control_key) && !ExerciseLib::exercise_time_control_is_valid($objExercise->id, $learnpath_id, $learnpath_item_id)) {
    $TBL_TRACK_ATTEMPT = Database::get_main_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.
ExerciseLib::exercise_time_control_delete($objExercise->id, $learnpath_id, $learnpath_item_id);
ExerciseLib::delete_chat_exercise_session($exe_id);
if ($origin != 'learnpath') {
    echo '<hr>';
    echo $objExercise->returnEndButtonHTML();
    if (api_is_allowed_to_session_edit()) {
Esempio n. 2
0
}
$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $is_courseTutor;
//Getting results from the exe_id. This variable also contain all the information about the exercise
$track_exercise_info = ExerciseLib::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();
}
$objExercise->displayQuestionListByAttempt($id, false);
Display::display_footer();