Ejemplo n.º 1
0
    // Adjust for timezones.
    $UK_time = new DateTimeZone("Europe/London");
    $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);
Ejemplo n.º 2
0
// Default overwritten by (check_labs)
$current_address = NetworkUtils::get_client_address();
$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();
}
$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.
    // Get the module IDs for this paper
    $modIDs = array_keys(Paper_utils::get_modules($propertyObj->get_property_id(), $mysqli));
    // Check for additional password on the paper
    check_paper_password($propertyObj->get_password(), $string, $mysqli);
    // Check time security
    check_datetime($propertyObj->get_start_date(), $propertyObj->get_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);
    // Check modules if the user is a student and the paper is not formative
    $attempt = check_modules($userObject, $modIDs, $propertyObj->get_calendar_year(), $string, $mysqli);
    // Check for any metadata security restrictions
    check_metadata($propertyObj->get_property_id(), $userObject, $modIDs, $string, $mysqli);
    $summative_exam_session_started = false;
}
$is_preview = (isset($_POST['mode']) and $_POST['mode'] == 'preview');
$paper_scheduled = $propertyObj->get_start_date() !== null;
if ($propertyObj->get_exam_duration() != null and $propertyObj->get_paper_type() == '2') {
    $log_lab_end_time = new LogLabEndTime($lab_id, $propertyObj, $mysqli);
    $summative_exam_session_started = $log_lab_end_time->get_session_end_date_datetime();