Exemplo n.º 1
0
*/
require '../include/staff_auth.inc';
require_once '../include/errors.inc';
require_once '../classes/logmetadata.class.php';
require_once '../classes/userutils.class.php';
require_once '../classes/paperproperties.class.php';
$metadataID = check_var('metadataID', 'GET', true, false, true);
$userID = check_var('userID', 'GET', true, false, true);
$paperID = check_var('paperID', 'GET', true, false, true);
$properties = PaperProperties::get_paper_properties_by_id($paperID, $mysqli, $string);
if ($properties->get_paper_type() != '1') {
    // Only allow timer reset of Progress Test papers.
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$log_metadata = new LogMetadata($userID, $paperID, $mysqli);
if ($log_metadata->get_record($metadataID) === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$dateObj = $log_metadata->get_start_datetime();
$user_details = UserUtils::get_user_details($userID, $mysqli);
if ($user_details === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$name = $user_details['title'] . ' ' . $user_details['surname'] . ', ' . $user_details['first_names'] . ' (' . $user_details['student_id'] . ')';
$display_format = $configObject->get('cfg_long_date_php') . ' ' . $configObject->get('cfg_short_time_php');
$started = $dateObj->format($display_format);
?>
<!DOCTYPE html>
Exemplo n.º 2
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') {
        $student_object['special_needs_percentage'] = $special_needs_percentage;
        $student_object['user_ID'] = $userObject->get_user_ID();
        $log_lab_end_time = new LogLabEndTime($lab_id, $propertyObj, $mysqli);
        $log_extra_time = new LogExtraTime($log_lab_end_time, $student_object, $mysqli);
        $extra_time_secs = $log_extra_time->get_extra_time_secs();
        $extra_time_mins = $extra_time_secs / 60;
        $summative_timer = new SummativeTimer($log_extra_time);
        $remaining_time = $summative_timer->calculate_remaining_time_secs();
        if ($remaining_time !== false) {
            $display_remaining_time = true;
            if ($exam_started == false and $remaining_time == 0) {
Exemplo n.º 3
0
*/
require '../include/staff_auth.inc';
require_once '../include/errors.inc';
require_once '../classes/logmetadata.class.php';
require_once '../classes/userutils.class.php';
require_once '../classes/paperproperties.class.php';
$metadataID = check_var('metadataID', 'POST', true, false, true);
$userID = check_var('userID', 'POST', true, false, true);
$paperID = check_var('paperID', 'POST', true, false, true);
$properties = PaperProperties::get_paper_properties_by_id($paperID, $mysqli, $string);
if ($properties->get_paper_type() != '1') {
    // Only allow timer reset of Progress Test papers.
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$log_metadata = new LogMetadata($userID, $paperID, $mysqli);
if ($log_metadata->get_record($metadataID) === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$user_details = UserUtils::get_user_details($userID, $mysqli);
if ($user_details === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$log_metadata->set_started_to_null();
$mysqli->close();
?>
<!DOCTYPE html>
<html>
<head>
Exemplo n.º 4
0
    // 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
$log_metadata = new LogMetadata($userObject->get_user_ID(), $propertyObj->get_property_id(), $mysqli);
$sessionid = $log_metadata->get_session_id();
$metadataID = $log_metadata->get_metadata_id();
/*
* Save any posted answers
*
* N.B if Ajax saving is enabled: After a successful Ajax save the form is posted as the user moves to the next screen
*                                with dont_record set to true so this is not executed
*/
if ($is_question_preview_mode == false) {
    if (isset($_POST['old_screen']) and $_POST['old_screen'] != '' and (!isset($_GET['dont_record']) or $_GET['dont_record'] != true)) {
        record_marks($propertyObj->get_property_id(), $mysqli, $propertyObj->get_paper_type(), $metadataID);
    }
}
?>
<!DOCTYPE html>
Exemplo n.º 5
0
    $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();
}
if (!$is_preview and time() > $propertyObj->get_end_date() and ($propertyObj->get_paper_type() == '1' or $propertyObj->get_paper_type() == '2' and $paper_scheduled and $summative_exam_session_started == false)) {
    $propertyObj->set_paper_type('_late');
}
$preview_q_id = isset($_GET['q_id']) ? $_GET['q_id'] : null;
$log_metadata = new LogMetadata($userObject->get_user_ID(), $propertyObj->get_property_id(), $mysqli);
if ($log_metadata->get_record() === false) {
    $notice->access_denied($mysqli, $string, $string['error_paper'], false);
}
$metadataid = $log_metadata->get_metadata_id();
if ($_GET['submitType'] == 'userSubmit') {
    $log_metadata->set_highest_screen($_POST['old_screen']);
}
try {
    $ret = record_marks($propertyObj->get_property_id(), $mysqli, $propertyObj->get_paper_type(), $metadataid, $preview_q_id);
} catch (RandomQuestionNotFound $ex) {
    $ret = false;
}
if ($ret === true) {
    // Everthing worked.
    echo $_POST['randomPageID'];
Exemplo n.º 6
0
/*
* Extract the posted variables.
*/
if (!$is_first_launch) {
    if ($_POST['button_pressed'] == 'next') {
        $current_screen = $_POST['current_screen'];
    } elseif ($_POST['button_pressed'] == 'previous') {
        $current_screen = $_POST['current_screen'] - 2;
    } elseif ($_POST['button_pressed'] == 'jump_screen') {
        $current_screen = $_POST['jump_screen'];
    } elseif ($is_fire_alarm) {
        $current_screen = $_POST['current_screen'];
    }
}
// Set up new metadata record or get existing one.
$log_metadata = new LogMetadata($userObject->get_user_ID(), $paperID, $mysqli);
if ($is_preview_mode_first_launch == true or $is_first_launch and !$do_restart) {
    //in preview mode or for non-restartable papers always start a new session if we have relaunched the window
    $log_metadata->create_new_record($current_address, $userObject->get_grade(), $userObject->get_year(), $attempt, $lab_name);
} elseif ($log_metadata->get_record() == false) {
    //load the data and check for no records
    //we have no log_metadata record so make one
    $log_metadata->create_new_record($current_address, $userObject->get_grade(), $userObject->get_year(), $attempt, $lab_name);
}
$metadataID = $log_metadata->get_metadata_id();
// Foramtive or Progressive papers that have a duration set should use the timer.
if ($propertyObj->get_paper_type() == '0' || $propertyObj->get_paper_type() == '1') {
    if ($propertyObj->get_exam_duration() != null) {
        $allow_timing = true;
    }
    // Summative exams only allow timing if ALL the modules of the paper allow it.
Exemplo n.º 7
0
$bgcolor = $fgcolor = $textsize = $marks_color = $themecolor = $labelcolor = $font = $unanswered_color = $dismiss_color = '';
$propertyObj->set_paper_colour_scheme($userObject, $bgcolor, $fgcolor, $textsize, $marks_color, $themecolor, $labelcolor, $font, $unanswered_color, $dismiss_color);
// Check if paper can be released date wise
if (!$propertyObj->is_question_fb_released()) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
//lookup previous sessionid from log_metadata.started property_id
if (isset($_GET['userid'])) {
    if ($userObject->has_role(array('SysAdmin', 'Admin', 'Staff'))) {
        $log_metadata = new LogMetadata($_GET['userid'], $paperID, $mysqli);
    } else {
        $notice->access_denied($mysqli, $string, $string['norights'], true, true);
    }
} else {
    $log_metadata = new LogMetadata($userObject->get_user_ID(), $paperID, $mysqli);
}
$log_metadata->get_record();
$metadataid = $log_metadata->get_metadata_id();
if ($metadataid === null) {
    $notice->access_denied($mysqli, $string, $string['nottaken'], true, true);
}
$preview_q_id = isset($_GET['q_id']) ? $_GET['q_id'] : null;
$moduleID = Paper_utils::get_modules($paperID, $mysqli);
if ($userObject->has_role('Student')) {
    // Check for additional password on the paper
    check_paper_password($propertyObj->get_password(), $string, $mysqli, true);
    $display_correct_answer = 1;
    $display_question_mark = 1;
    $display_students_response = 1;
    $display_feedback = 1;
Exemplo n.º 8
0
    $display_question_mark = 1;
    $display_students_response = 1;
    $display_feedback = 1;
    $hide_if_unanswered = 0;
    $is_exam_review_mode = true;
}
if (isset($_GET['userID'])) {
    if ($userObject->has_role(array('SysAdmin', 'Admin', 'Staff', 'External Examiner'))) {
        $log_metadata = new LogMetadata($_GET['userID'], $paperID, $mysqli);
    } else {
        // Student is hacking the userid parameter.
        $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
        $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
    }
} else {
    $log_metadata = new LogMetadata($userObject->get_user_ID(), $paperID, $mysqli);
}
if (isset($_GET['metadataID'])) {
    $log_metadata->get_record($_GET['metadataID']);
    $metadataid = $_GET['metadataID'];
} else {
    $log_metadata->get_record();
    $metadataid = $log_metadata->get_metadata_id();
}
if (!$is_exam_review_mode and !$is_question_preview_mode and !$is_formative_review) {
    // Only update log metadata if we are ending an exam.
    $log_metadata->set_completed_to_now();
}
require '../config/finish.inc';
?>
<!DOCTYPE html>