$paper_id = check_var('paper_id', 'POST', true, false, true); $marker_id = check_var('marker_id', 'POST', true, false, true); $mark_type = check_var('mark_type', 'POST', true, false, true); $log = check_var('log', 'POST', true, false, true); $reason = isset($_POST['reason']) ? $_POST['reason'] : ''; $mysqli->autocommit(false); // Read question from database. $result = $mysqli->prepare("SELECT leadin, settings FROM questions WHERE q_id = ?"); $result->bind_param('i', $q_id); $result->execute(); $result->bind_result($leadin, $settings); $result->fetch(); $result->close(); $question_obj = new enhancedcalc($configObject); $question_obj->set_settings($settings); $q_marks = $question_obj->get_question_marks(); //$q_marks_rev = array_flip($q_marks); if ($q_marks !== false) { // Get user's current mark $sql = "SELECT mark FROM log{$log} WHERE id = ?"; $result = $mysqli->prepare($sql); $result->bind_param('i', $log_id); $result->execute(); $result->bind_result($orig_mark); $result->fetch(); $result->close(); $sql = <<<QUERY INSERT INTO marking_override (log_id, log_type, user_id, q_id, paper_id, marker_id, date_marked, new_mark_type, reason) VALUES (?, ?, ?, ?, ?, ?, NOW(), ?, ?) ON DUPLICATE KEY UPDATE marker_id = ?, new_mark_type = ?, date_marked = NOW(), reason = ? QUERY;
} $result->close(); // Get any existing overrides $overrides = array(); $sql = 'SELECT log_id, new_mark_type, reason FROM marking_override WHERE q_id = ? AND paper_id = ?'; $result = $mysqli->prepare($sql); $result->bind_param('ii', $q_id, $paperID); $result->execute(); $result->bind_result($log_id, $new_mark_type, $reason); while ($result->fetch()) { $overrides[$log_id] = array('type' => $new_mark_type, 'reason' => $reason); } $question_obj = new enhancedcalc($configObject); $question_obj->set_settings($settings); $q_vars = $question_obj->get_question_vars(); $marks_arr = $question_obj->get_question_marks(); if ($marks_arr == false) { $marks_arr = array(); } $q_marks = array_flip($marks_arr); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="content-type" content="text/html;charset=<?php echo $configObject->get('cfg_page_charset'); ?> " /> <title><?php