예제 #1
0
            //New expired time - it is due to the possible closure of session
            $new_expired_time_in_seconds = api_strtotime($expired_time_of_this_attempt, 'UTC') - api_strtotime($last_attempt_date, 'UTC');
            if ($debug) {
                error_log('7.7. $new_expired_time_in_seconds: ' . $new_expired_time_in_seconds);
            }
            $expected_time = $current_timestamp + $new_expired_time_in_seconds;
            if ($debug) {
                error_log('7.8. $expected_time: ' . $expected_time);
            }
            $clock_expired_time = api_get_utc_datetime($expected_time);
            if ($debug) {
                error_log('7.9. $clock_expired_time: ' . $clock_expired_time);
            }
            // First we update the attempt to today
            // How the expired time is changed into "track_e_exercices" table,then the last attempt for this student should be changed too,so
            ExerciseLib::update_attempt_date($exercise_stat_info['exe_id'], $last_attempt_date);
            // Sessions that contain the expired time
            $expiredTimeInSession[$current_expired_time_key] = $clock_expired_time;
            Session::write('expired_time', $expiredTimeInSession);
            if ($debug) {
                error_log('7.11. Setting the $expiredTimeInSession: ' . $expiredTimeInSession[$current_expired_time_key]);
            }
        }
    } else {
        if ($debug) {
            error_log('7.3. $expiredTimeInSession[$current_expired_time_key]: ' . $expiredTimeInSession[$current_expired_time_key]);
        }
        $clock_expired_time = $expiredTimeInSession[$current_expired_time_key];
    }
} else {
    if ($debug) {