$target_timezone = new DateTimeZone($timezone); $display_start_date = DateTime::createFromFormat('U', $paper_start, $UK_time); $display_end_date = DateTime::createFromFormat('U', $paper_end, $UK_time); $display_start_date->setTimezone($target_timezone); $display_end_date->setTimezone($target_timezone); $tmp_cfg_long_date_time = str_replace('%', '', $configObject->get('cfg_long_date_time')); $display_start_date = $display_start_date->format($tmp_cfg_long_date_time); $display_end_date = $display_end_date->format($tmp_cfg_long_date_time); } $previously_submitted = 0; $low_bandwidth = 0; if ($userObject->has_role('Student')) { // Check for additional password on the paper check_paper_password($password, $string, $mysqli, true); //Check this PC is registered for this exam $low_bandwidth = check_labs($test_type, $labs, $current_address, $password, $string, $mysqli); $attempt = check_modules($userObject, $modIDs, $calendar_year, $string, $mysqli); } $display_remaining_time = false; $remaining_minutes = ''; $remaining_seconds = ''; /* * BP If the duration is set then create a timer to calculate and display the remaining time */ $extra_time = null; $remaining_time = 0; $log_metadata = new LogMetadata($userObject->get_user_ID(), $propertyObj->get_property_id(), $mysqli); // $log_metadata->get_record will return true if this user has stared this exam. false otherwise $exam_started = $log_metadata->get_record('', false); if ($exam_duration !== null) { if ($test_type == '2') {
//store the original paper type - needed to retrieve answers from the correct log and functionality related decisions $attempt = 1; //default attempt to 1 overwritten if the student is resit candidate $modIDs = array_keys(Paper_utils::get_modules($property_id, $mysqli)); $current_address = NetworkUtils::get_client_address(); $moduleID = $propertyObj->get_modules(); if ($userObject->has_role('Staff') and check_staff_modules($moduleID, $userObject)) { // No further security checks. } else { // Treat as student with extra security checks. // Check for additional password on the paper check_paper_password($password, $string, $mysqli); // Check time security check_datetime($start_date, $end_date, $string, $mysqli); // Check room security $low_bandwidth = check_labs($propertyObj->get_paper_type(), $propertyObj->get_labs(), $current_address, $propertyObj->get_password(), $string, $mysqli); // Get modules if the user is a student and the paper is not formative $attempt = check_modules($userObject, $modIDs, $calendar_year, $string, $mysqli); // Check for any metadata security restrictions check_metadata($property_id, $userObject, $modIDs, $string, $mysqli); } // Get lab info used in log metadata $lab_factory = new LabFactory($mysqli); if ($lab_object = $lab_factory->get_lab_based_on_client($current_address)) { $lab_name = $lab_object->get_name(); $lab_id = $lab_object->get_id(); } if (time() > $end_date and ($paper_type == '1' or $paper_type == '2')) { $paper_type = '_late'; } // Lookup previous sessionid from log_metadata.started property_id