</div> <div style="left:155px; top:-9px" class="label"><?php echo $string['studentsmark']; ?> </div> <div style="left:60px; top:-9px; width:160px" class="label"><?php echo $string['medianclassmark']; ?> </div> </div> <div style="position:absolute; top:0; left:0; width:100%"> <?php $demo = is_demo($userObject); $student_details = UserUtils::get_user_details($userID, $mysqli); $name = demo_replace($student_details['title'], $demo) . ' ' . demo_replace($student_details['surname'], $demo) . ', ' . demo_replace($student_details['first_names'], $demo) . ' (' . demo_replace($student_details['student_id'], $demo) . ')'; echo "<table class=\"header\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"font-size:90%\">\n"; echo "<tr><th><div style=\"padding-left:10px; font-size:200%; font-weight:bold\">" . $propertyObj->get_paper_title() . "</div><div style=\"padding-left:10px\">{$name}</div></th></tr>\n"; echo "</table>\n<ol>"; // Get the questions on the paper $q_no = 1; $result = $mysqli->prepare("SELECT q_id, theme, leadin, q_type FROM questions, papers WHERE papers.paper = ? AND papers.question = questions.q_id AND q_type != 'info' ORDER BY screen, display_pos"); $result->bind_param('i', $paperID); $result->execute(); $result->bind_result($q_id, $theme, $leadin, $q_type); while ($result->fetch()) { echo "<li>{$leadin}"; if (substr(strtolower($leadin), -4) == '</p>') { } elseif (substr(strtolower($leadin), -6) == '</div>') { echo '<br />'; } else {
if ($result->num_rows == 0) { header("HTTP/1.0 404 Not Found"); $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); } $result->close(); $start_seconds = substr($started, 0, 2) * 60 * 60 + substr($started, 3, 2) * 60 + substr($started, 6, 2); $updated = substr($updated, 0, 2) * 60 * 60 + substr($updated, 3, 2) * 60 + substr($updated, 6, 2); $time_spent = $updated - $start_seconds; $result = $mysqli->prepare("SELECT username, title, initials, surname FROM users WHERE id = ?"); $result->bind_param('i', $userID); $result->execute(); $result->bind_result($tmp_username, $title, $initials, $surname); $result->fetch(); $result->close(); $student_name = $title . ' ' . demo_replace($initials, $demo) . ' ' . demo_replace($surname, $demo); $textsize = 100; $font = 'Arial'; if ($userObject->is_special_needs()) { // Look up special_needs data $textsize = $userObject->get_textsize($textsize); $font = $userObject->get_font($font); } $textsize -= 10; ?> <!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');
$result->bind_result($student_id, $username, $uID, $title, $surname, $first_names, $grade, $gender, $year, $started, $question_ID, $user_answer, $q_type, $screen, $settings); $old_username = ''; while ($result->fetch()) { if ($old_username != $username or $old_started != $started) { $rowID++; } $log_array[$rowID][$screen][$question_ID] = $user_answer; $log_array[$rowID]['student_id'] = demo_replace_number($student_id, $demo); $log_array[$rowID]['userID'] = $uID; $log_array[$rowID]['username'] = $username; $log_array[$rowID]['course'] = $grade; $log_array[$rowID]['year'] = $year; $log_array[$rowID]['started'] = $started; $log_array[$rowID]['title'] = $title; $log_array[$rowID]['surname'] = demo_replace($surname, $demo); $log_array[$rowID]['first_names'] = demo_replace($first_names, $demo); $log_array[$rowID]['name'] = str_replace("'", "", $surname) . ',' . $first_names; $log_array[$rowID]['gender'] = $gender; $log_array[$rowID]['$questionID'] = json_decode($settings, true); $user_no++; $old_username = $username; $old_started = $started; } $result->close(); $sortby = 'name'; $ordering = 'asc'; $log_array = array_csort($log_array, $sortby, $ordering); //******************************** $exclusions = new Exclusion($paperID, $mysqli); $exclusions->load(); // Get any questions to exclude.
$notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true); } $killer_questions = new Killer_question($paperID, $mysqli); $killer_questions->load(); $killed = false; // Get the module ID and calendar year of the OSCE station. $result = $mysqli->prepare("SELECT username, title, surname, first_names, grade, yearofstudy, student_id FROM (users, sid) WHERE users.id = ? AND users.id = sid.userID"); $result->bind_param('i', $userID); $result->execute(); $result->bind_result($username, $title, $surname, $first_names, $grade, $year, $student_id); $result->fetch(); $result->close(); $original_username = $username; if (isset($demo) and $demo == true) { $surname = demo_replace($surname, $demo); $first_names = demo_replace($first_names, $demo); $student_id = demo_replace_number($student_id, $demo); } $paper_title = $propertyObj->get_paper_title(); $bgcolor = $propertyObj->get_bgcolor(); $fgcolor = $propertyObj->get_fgcolor(); $labelcolor = $propertyObj->get_labelcolor(); $themecolor = $propertyObj->get_themecolor(); $marking = $propertyObj->get_marking(); ?> <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'); ?>
echo '<td>' . $string[$lowertitle] . '</td>'; } else { echo '<td></td>'; } } else { echo '<td></td>'; } if ($tmp_first_names == '') { $tmp_first_names = ' '; } if ($tmp_surname == '') { $tmp_surname = ' '; } echo '<td>' . demo_replace($tmp_surname, $demo, true, $tmp_surname[0]) . '</td>'; echo '<td>' . demo_replace($tmp_first_names, $demo, true, $tmp_first_names[0]) . '</td>'; echo '<td>' . demo_replace($tmp_username, $demo, false) . '</td>'; if (strpos($tmp_roles, 'Student') !== false) { if ($tmp_student_id == NULL) { echo '<td class="fn">' . $string['unknown'] . '</td>'; } else { echo '<td>' . demo_replace_number($tmp_student_id, $demo) . '</td>'; } } elseif (strpos($tmp_roles, 'Staff') !== false) { echo "<td>Staff</td>"; } else { echo "<td class=\"fn\">" . $string['na'] . "</td>"; } echo "<td>{$tmp_yearofstudy}</td>"; echo "<td>{$tmp_grade}</td></tr>\n"; $x++; }
<body> <?php $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); } require '../tools/colour_picker/colour_picker.inc'; require '../include/user_search_options.inc'; require '../include/toprightmenu.inc'; echo draw_toprightmenu(); if ($demo == true) { // Hide the personal details. $user_details['surname'] = demo_replace($user_details['surname'], $demo); $user_details['first_names'] = demo_replace($user_details['first_names'], $demo); $user_details['initials'] = demo_replace($user_details['initials'], $demo); $user_details['student_id'] = demo_replace_number($user_details['student_id'], $demo); $user_details['email'] = demo_replace_username($user_details['email'], $demo); } $course_details = CourseUtils::get_course_details_by_name($user_details['grade'], $mysqli); if ($user_details['user_deleted'] == '') { $bg_color = '#EEF4FF'; } else { $bg_color = '#FFC0C0'; } ?> <div id="content"> <table cellpadding="0" cellspacing="0" border="0" style="background-color:<?php echo $bg_color; ?> ; width:100%; line-height:175%; padding-bottom:10px">
/** * Load user data from the log tables and store. * Calls 'writeUserResults' to write into an array. */ private function load_results() { if ($this->studentsonly == 0) { $roles_sql = ''; } else { $roles_sql = " AND (users.roles = 'Student' OR users.roles = 'graduate')"; } $data_array = array(); $metadataids = array(); // Load started records from 'log_metadata'. if ($this->paper_type == '2') { $time_int = 2; } else { $time_int = 0; } $result = $this->db->prepare("SELECT\n log_metadata.id,\n users.id,\n username,\n roles,\n year,\n title,\n surname,\n initials,\n first_names,\n email,\n gender,\n ipaddress,\n lab_name,\n student_id,\n attempt,\n DATE_FORMAT(started, '{$this->config->get('cfg_long_date_time')}') AS display_started,\n started,\n student_grade\n FROM\n log_metadata,\n users\n LEFT JOIN\n sid\n ON\n users.id = sid.userID\n WHERE\n log_metadata.userID = users.id AND\n paperID = ? AND\n grade LIKE ? {$roles_sql} AND\n DATE_ADD(started, INTERVAL {$time_int} MINUTE) >= ?\n AND started <= ?"); $result->bind_param('isss', $this->paperID, $this->repcourse, $this->startdate, $this->enddate); $result->execute(); $result->bind_result($metadataID, $userID, $username, $roles, $year, $title, $surname, $initials, $first_names, $email, $gender, $ipaddress, $lab_name, $student_id, $attempt, $display_started, $started, $student_grade); while ($result->fetch()) { $tmp_name = trim(str_replace("'", "", $surname) . ',' . $first_names); if ($lab_name == '') { $room = '<span style="color:#808080"><unknown></span>'; } else { $room = $lab_name; } if ($this->demo) { $surname = demo_replace($surname, true, true, $surname[0]); $initials = demo_replace($initials, true, true, $initials[0]); $first_names = demo_replace($first_names, true, true, $first_names[0]); $email = demo_replace($email); $student_id = demo_replace_number($student_id); } $this->user_results[$metadataID] = array('metadataID' => $metadataID, 'userID' => $userID, 'username' => $username, 'roles' => $roles, 'year' => $year, 'title' => $title, 'surname' => $surname, 'initials' => $initials, 'first_names' => $first_names, 'name' => $tmp_name, 'email' => $email, 'gender' => $gender, 'ipaddress' => $ipaddress, 'room' => $room, 'student_id' => $student_id, 'attempt' => $attempt, 'visible' => true, 'display_started' => $display_started, 'started' => $started, 'student_grade' => $student_grade, 'mark' => 0, 'percent' => 0, 'questions' => 0, 'duration' => 0, 'marking_complete' => true, 'module' => '', 'paper_type' => $this->paper_type); $metadataids[] = $metadataID; } $result->close(); if (count($metadataids) == 0) { $this->user_results = array(); return false; } $i = 0; $old_screen = 0; $old_duration = 0; $old_metadataID = 0; $user_duration = 0; $marking_complete = 1; $tmp_mark = 0; $tmp_user_mark_array = array(); $log_data = array(); $tmp_array = array(); // Load 'logX' data. if ($this->paper_type == '0' or $this->paper_type == '1') { $result = $this->db->prepare("(SELECT log0.id, metadataID, 0 AS paper_type, questions.q_id, screen, duration, user_answer, q_type, mark FROM log0, questions WHERE log0.q_id = questions.q_id AND metadataID IN (" . implode(',', $metadataids) . ")) UNION ALL (SELECT log1.id, metadataID, 1 AS paper_type, questions.q_id, screen, duration, user_answer, q_type, mark FROM log1, questions WHERE log1.q_id = questions.q_id AND metadataID IN (" . implode(',', $metadataids) . ")) ORDER BY metadataID, screen"); } elseif ($this->paper_type == '5') { $result = $this->db->prepare("SELECT log{$this->paper_type}.id, metadataID, {$this->paper_type} AS paper_type, questions.q_id, 1 AS screen, 0 AS duration, NULL AS user_answer, q_type, mark FROM log{$this->paper_type}, questions WHERE log{$this->paper_type}.q_id = questions.q_id AND metadataID IN (" . implode(',', $metadataids) . ")"); } else { $result = $this->db->prepare("SELECT log{$this->paper_type}.id, metadataID, {$this->paper_type} AS paper_type, questions.q_id, screen, duration, user_answer, q_type, mark FROM log{$this->paper_type}, questions WHERE log{$this->paper_type}.q_id = questions.q_id AND metadataID IN (" . implode(',', $metadataids) . ") ORDER BY metadataID, screen"); } $result->execute(); $result->bind_result($log_id, $metadataID, $paper_type, $q_id, $screen, $duration, $user_answer, $q_type, $mark); while ($result->fetch()) { $userID = $this->user_results[$metadataID]['userID']; if ($this->repmodule != '' and !isset($this->user_modules[$userID]['idMod'])) { continue; // This user is not on the module set in repmodule so don't put them in the array. } // We have passed the check this students should be displayed. $this->user_results[$metadataID]['visible'] = true; if ($old_screen != $screen or $old_metadataID != $metadataID) { $user_duration += $old_duration; } if ($old_metadataID != $metadataID and $old_metadataID != 0) { if (isset($this->user_modules[$userID]['idMod'])) { $this->user_results[$metadataID]['module'] = $this->user_modules[$userID]['idMod']; } else { // No module details set for this user. Perhaps it is an unassigned guest user account. $this->user_results[$metadataID]['module'] = ''; } // Write the user results for the user that was iterated over previously using $old_metadataID $this->writeUserResults($old_metadataID, $tmp_mark, $tmp_user_mark_array, $user_duration, $marking_complete); $tmp_mark = 0; $tmp_user_mark_array = array(); $user_duration = 0; $marking_complete = 1; } else { if (!$old_metadataID) { // This is the first record being iterated over so $old_metadataID is set to 0. if (isset($this->user_modules[$userID]['idMod'])) { $this->user_results[$metadataID]['module'] = $this->user_modules[$userID]['idMod']; } else { // No module details set for this user. Perhaps it is an unassigned guest user account. $this->user_results[$metadataID]['module'] = ''; } } } $this->user_results[$metadataID]['questions']++; $this->user_results[$metadataID]['paper_type'] = $paper_type; $single_mark = $this->getUserMark($q_id, $userID, $user_answer, $mark, $tmp_user_mark_array); $tmp_mark += $single_mark; if ($q_type == 'textbox' and !is_numeric($mark)) { $this->unmarked_textbox = true; $marking_complete = 0; } if ($q_type == 'enhancedcalc' and !is_numeric($mark)) { $this->unmarked_enhancedcalc = true; $marking_complete = 0; } $old_duration = $duration; $old_screen = $screen; $old_metadataID = $metadataID; $log_data[$i]['paper_type'] = $paper_type; $log_data[$i]['adjmark'] = $single_mark; $log_data[$i]['id'] = $log_id; $i++; } $result->close(); if ($old_metadataID != 0) { if ($this->repmodule == '' or isset($this->user_modules[$userID]['idMod']) and $this->user_modules[$userID]['idMod'] == $this->repmodule) { $user_duration += $old_duration; $this->writeUserResults($old_metadataID, $tmp_mark, $tmp_user_mark_array, $user_duration, $marking_complete); } } // Re-index the array. $tmp_array = $this->user_results; unset($this->user_results); $i = 0; foreach ($tmp_array as $metID => $row) { $this->user_results[$i] = $row; $i++; } if ($this->recache and count($log_data) > 0) { $this->db->autocommit(false); $log_query = $this->db->prepare("UPDATE log{$paper_type} SET adjmark = ? WHERE id = ?"); foreach ($log_data as $individual_log_data) { $paper_type = $individual_log_data['paper_type']; $adjmark = $individual_log_data['adjmark']; $log_id = $individual_log_data['id']; $log_query->bind_param('di', $adjmark, $log_id); $log_query->execute(); } $log_query->close(); $this->db->commit(); $this->db->autocommit(true); } }
$temp_userID = $userObject->get_user_ID(); $tmp_title = $userObject->get_title(); $tmp_initials = $userObject->get_initials(); $tmp_surname = $userObject->get_surname(); $tmp_student_id = ''; } $old_q_id = 0; $old_screen = 0; if (!isset($_GET['q_id'])) { echo $top_table_html; echo '<tr><td><div class="paper">' . $paper_title . '</div>'; if ($userObject->has_role('External Examiner')) { echo '<span style="margin-left:5px; font-size:90%; color:white; font-weight:bold">' . $string['student'] . ' ' . $tmp_student_id . '</span>'; } elseif ($paper_type < 2 or $userObject->has_role(array('Staff', 'Admin', 'SysAdmin', 'External Examiner'))) { echo '<span style="margin-left:5px; font-size:90%; color:white; font-weight:bold">' . $string['answersscreen']; $tmp_student_name = $tmp_title . ' ' . demo_replace($tmp_surname, $demo) . ', ' . demo_replace($tmp_initials, $demo); $tmp_student_id = demo_replace_number($tmp_student_id, $demo); echo ' ' . $tmp_student_name; if ($tmp_student_id != '') { echo " ({$tmp_student_id})"; } echo '</span>'; } echo '</td>'; echo $logo_html; echo '</table>'; } // Get any marking override for the paper $overrides = array(); $sql = "SELECT m.q_id, title, surname, date_marked, new_mark_type, adjmark\n FROM marking_override m INNER JOIN users u ON m.marker_id = u.id\n INNER JOIN log{$log_type} l ON m.log_id = l.id\n WHERE user_id = ? AND paper_id = ?"; $result = $mysqli->prepare($sql);