} if ($debug) { error_log('7.3. $_SESSION[expired_time][$current_expired_time_key] ' . $_SESSION['expired_time'][$current_expired_time_key]); } if (!isset($_SESSION['expired_time'][$current_expired_time_key])) { //Timer - Get expired_time for a student if (!empty($exercise_stat_info)) { if ($debug) { error_log('7.4 Seems that the session ends and the user want to retake the exam'); } $expired_time_of_this_attempt = $exercise_stat_info['expired_time_control']; if ($debug) { error_log('7.5 $expired_time_of_this_attempt: ' . $expired_time_of_this_attempt); } // Get the last attempt of an exercise $last_attempt_date = Event::getLastAttemptDateOfExercise($exercise_stat_info['exe_id']); /* This means that the user enters the exam but do not answer the first question we get the date from the track_e_exercises not from the track_et_attempt see #2069 */ if (empty($last_attempt_date)) { $diff = $current_timestamp - api_strtotime($exercise_stat_info['start_date'], 'UTC'); $last_attempt_date = api_get_utc_datetime(api_strtotime($exercise_stat_info['start_date'], 'UTC') + $diff); } else { //Recalculate the time control due #2069 $diff = $current_timestamp - api_strtotime($last_attempt_date, 'UTC'); $last_attempt_date = api_get_utc_datetime(api_strtotime($last_attempt_date, 'UTC') + $diff); } if ($debug) { error_log('7.6. $last_attempt_date: ' . $last_attempt_date); } //New expired time - it is due to the possible closure of session