function listtreemodules($mysqli, $moduleid, $block_id, $plk, $flat = false, $explode = false) { $icons = array('formative', 'progress', 'summative', 'survey', 'osce', 'offline', 'peer_review'); $configObject = Config::get_instance(); $moduleidorig = $moduleid; $moduleid = module_utils::get_idMod($moduleid, $mysqli); $sql = "SELECT DISTINCT crypt_name, paper_type, paper_title, retired, idMod FROM properties, properties_modules WHERE idMod = ? and properties.property_id = properties_modules.property_id AND deleted IS NULL AND paper_type IN ('0','1','3','4') ORDER BY paper_type, paper_title"; $results2 = $mysqli->prepare($sql); $results2->bind_param('i', $moduleid); $results2->execute(); $results2->bind_result($crypt_name, $paper_type, $paper_title, $retired, $moduleID); $results2->store_result(); if ($results2->num_rows() > 0) { $rt = $results2->num_rows(); echo '<div>'; while ($results2->fetch()) { if (strtolower($_SESSION['_lti_context']['resource_link_title']) == strtolower($paper_title)) { $checked = ' checked'; } else { $checked = ''; } $extra = "<input type=\"radio\" name=\"paperlinkID\" id=\"paperlinkID-{$plk}\" value=\"{$plk}\"{$checked}><label for=\"paperlinkID-{$plk}\">"; $extra1 = "</label>"; echo "<div style=\"padding-left:20px\">{$extra}<img src=\"../artwork/" . $icons[$paper_type] . "_16.gif\" width=\"16\" height=\"16\" alt=\"" . $paper_type . "\" /> " . $paper_title . "{$extra1}</div>\n"; $_SESSION['postlookup'][$plk] = array($crypt_name, $moduleid); $plk++; } echo '</div>'; $block_id++; } else { // no papers } $results2->close(); return array($block_id, $plk); }
function getModules($userID, $mysqlidb) { $modules = array(); $session = date_utils::get_current_academic_year(); $result = $mysqlidb->prepare("SELECT idmod FROM modules_student WHERE calendar_year = ? AND userID = ?"); $result->bind_param('si', $session, $userID); $result->execute(); $result->bind_result($moduleid); $result->store_result(); while ($result->fetch()) { $modules[] = module_utils::get_moduleid_from_id($moduleid, $mysqlidb); } $result->close(); return $modules; }
function createaccount($preauthobj) { //only run if if (!(isset($this->form['std']->username) or isset($this->form['std']->username)) and isset($this->request['createnewdemoaccount'])) { $this->savetodebug('Create Account button pressed'); } $unique_username = true; $unique_module = true; $new_moduleid = ''; for ($a = 0; $a < strlen($this->request['new_grade2']); $a++) { print "RT"; $b = substr($this->request['new_grade2'], $a, 1); print $b; if (ctype_upper($b) or ctype_digit($b)) { print "i"; $new_moduleid = $new_moduleid . $b; } } if ($new_moduleid == '') { $new_moduleid = $this->request['new_grade2']; } module_utils::add_modules($new_moduleid, $_POST['new_grade2'], 1, $this->settings['school']); return $preauthobj; }
/** * Test to see if a student is on a module by name. * * @param int $tmp_userID ID of the student. * @param int $idMod Module ID for the enrolement. * @param string $session The academic year. * @param object $db $mysqli database connection. * * @return bool return true if successful. * */ static function is_user_on_module_by_name($tmp_userID, $idMod, $session, $db) { if (is_array($idMod)) { foreach ($idMod as $idmods) { $modid[] = module_utils::get_idMod($idmods, $db); } } else { $modid = module_utils::get_idMod($idMod, $db); } if ($modid === false) { return false; } return self::is_user_on_module($tmp_userID, $modid, $session, $db); }
if (ctype_upper($b) or ctype_digit($b)) { $new_moduleid = $new_moduleid . $b; } } $new_moduleid = $new_moduleid . $maxmodid; // Check for unique username if (UserUtils::username_exists($_POST['new_username'], $mysqli) or UserUtils::username_exists($_POST['new_username'] . '-stu', $mysqli)) { $unique_username = false; } else { $unique_username = true; } $schoolID = SchoolUtils::add_school(1, 'School of Practice', $mysqli); // Make sure the 'School of Practice' school exists. CourseUtils::add_course($schoolID, 'A10DEMO', 'Demonstration BSc', $mysqli); // Make sure demo course exists. $new_modid = module_utils::add_modules($new_moduleid, $_POST['new_grade2'], 1, $schoolID, NULL, NULL, true, true, true, false, false, true, false, $mysqli, 0, 0, 1, 1, '07/01'); if ($unique_username == true) { $_POST['new_grade'] = $new_moduleid; $session = date_utils::get_current_academic_year(); // Add staff account $new_username = trim($_POST['new_username']); $useridstf = adduser('Staff', 'Staff', $new_username, $mysqli); UserUtils::add_staff_to_module_by_modulecode($useridstf, $new_moduleid, $mysqli); // Add staff to the new module UserUtils::add_staff_to_module_by_modulecode($useridstf, 'DEMO', $mysqli); // Add staff to the general DEMO module // Add student account $max_sid = 0; $new_username = $new_username . '-stu'; $userid = adduser('A10DEMO', 'Student', $new_username, $mysqli); $result = $mysqli->prepare("SELECT MAX(id) as a FROM users");
} if (isset($_GET['userid'])) { $userid = $_GET['userid']; } else { $userid = ''; } if (isset($_GET['keyword'])) { $keyword = $_GET['keyword']; } else { $keyword = ''; } if (isset($_GET['module'])) { $module = $_GET['module']; if ($module != '0') { if (!isset($module_details)) { $module_details = module_utils::get_full_details_by_ID($module, $mysqli); } $module_code = $module_details['moduleid']; if (!$module_code) { $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 { $module_code = 'Unassigned'; } } else { $module = ''; } $qbank = new QuestionBank($module, $module_code, $string, $notice, $mysqli); ?> <!DOCTYPE html>
public function getAvailableFeedback($username, $moduleID) { $allowaccess = false; $tmp_userID = $this->getUserID($username, false); $userObject = UserObject::get_instance(); if ($userObject->has_role('SysAdmin')) { $allowaccess = true; } else { if ($userObject->has_role('Staff')) { $allowaccess = true; } else { if ($userObject->has_role('Student') and $tmp_userID == $userObject->get_user_ID()) { // Students can only list their own feedabck $allowaccess = true; } } } if ($allowaccess == false) { return ''; } if ($moduleID != '') { $idMod = module_utils::get_idMod($moduleID, $this->db); if ($idMod == false) { return "Unknown Module"; } } $paper_no = 0; $old_yearID = -1; $papers = array(); if ($moduleID == '') { $sql = "SELECT \n paper_id, \n date, \n UNIX_TIMESTAMP(date) AS is_live, \n paper_type, \n paper_title, \n start_date, \n end_date, \n properties.calendar_year, \n crypt_name, \n moduleId \n FROM feedback_release \n LEFT JOIN properties ON feedback_release.paper_id = properties.property_id \n LEFT JOIN properties_modules ON properties.property_id = properties_modules.property_id \n LEFT JOIN modules_student ON modules_student.idMod = properties_modules.idMod\n LEFT JOIN modules ON modules.id = properties_modules.idMod \n WHERE \n modules_student.userID=?"; $res = $this->db->prepare($sql); $res->bind_param('i', $tmp_userID); } else { $sql = "SELECT \n paper_id, \n date, \n UNIX_TIMESTAMP(date) AS is_live, \n paper_type, \n paper_title, \n start_date, \n end_date, \n properties.calendar_year, \n crypt_name,\n moduleId \n FROM feedback_release \n LEFT JOIN properties ON feedback_release.paper_id = properties.property_id \n LEFT JOIN properties_modules ON properties.property_id = properties_modules.property_id \n LEFT JOIN modules_student ON modules_student.idMod = properties_modules.idMod \n LEFT JOIN modules ON modules.id = properties_modules.idMod \n WHERE \n modules_student.userID=? AND \n modules_student.idMod=?"; $res = $this->db->prepare($sql); $res->bind_param('ii', $tmp_userID, $idMod); } $res->execute(); $res->store_result(); $res->bind_result($paperID, $date, $is_live, $paper_type, $paper_title, $start_date, $end_date, $calendar_year, $crypt_name, $moduleID); while ($res->fetch()) { if ($is_live < time()) { // Have they sat the paper? $log = $this->db->prepare("SELECT userID FROM log_metadata WHERE userID=? AND paperID=? LIMIT 1"); $log->bind_param('ii', $tmp_userID, $paperID); $log->execute(); $log->store_result(); $log->bind_result($log_userID); if ($log->num_rows != 1) { $log->close(); continue; } else { if ($userObject->has_role('Student')) { $papers[$paper_no]['feedback_url'] = 'https://' . $_SERVER['SERVER_NAME'] . '/mapping/user_feedback.php?id=' . $crypt_name; } else { $papers[$paper_no]['feedback_url'] = 'https://' . $_SERVER['SERVER_NAME'] . '/mapping/user_feedback.php?id=' . $crypt_name . '&userID=' . $tmp_userID; } $log->close(); } } else { $papers[$paper_no]['feedback_url'] = ''; } $papers[$paper_no]['title'] = $paper_title; $papers[$paper_no]['type'] = $this->qtypes[$paper_type]; $papers[$paper_no]['start_date'] = $start_date; $papers[$paper_no]['release_date'] = $date; $papers[$paper_no]['calendar_year'] = $calendar_year; $papers[$paper_no]['moduleID'] = $moduleID; $paper_no++; } $res->close(); return $papers; }
// paper_options.inc modifies result! Store it temporarily $import_result = $result; require '../include/paper_options.inc'; require '../include/toprightmenu.inc'; echo draw_toprightmenu(); $result = $import_result; ?> <div id="content"> <div class="head_title"> <div><img src="../artwork/toprightmenu.gif" id="toprightmenu_icon" /></div> <?php echo "<div class=\"breadcrumb\">"; echo '<a href="../index.php">' . $string['home'] . '</a>'; if ($module != '') { echo '<img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../module/index.php?module=' . $module . '">' . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . '</a>'; } elseif ($folder != '') { echo '<img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../folder/index.php?folder=' . $folder . '">' . $folder_name . '</a>'; } echo "</div><div class=\"page_title\">{$paper_title}</div>"; echo "</div>"; ?> <br/> <br/> <br/> <br/> <table border="0" cellpadding="0" cellspacing="0" class="dialog_border" style="width:500px; text-align:left"> <tr> <td class="dialog_header" style="width:55px"><img src="../artwork/ims_logo.png" width="47" height="44" alt="IMS Logo" /></td><td class="dialog_header" style="width:445px; font-size:160%; font-weight:bold; color:#5582D2"><?php echo $string['qtiimport'];
foreach ($bank_types as $type_name => $url) { echo "<div class=\"f2\"><div class=\"f_icon\"><a href=\"{$url}\"><img src=\"../artwork/yellow_folder.png\" alt=\"Folder\" /></a></div><div class=\"f_details\"><a href=\"{$url}\">" . $type_name . "</a></div></div>\n"; } echo "<br clear=\"left\">\n"; echo "<div class=\"f2\"><div class=\"f_icon\"><a href=\"../question/search.php?module={$module}\"><img src=\"../artwork/search_48.png\" alt=\"Folder\" /></a></div><div class=\"f_details\"><a href=\"../question/search.php?module={$module}\">" . $string['search'] . "</a><br /><span class=\"grey\">" . $string['forquestions'] . "</span></div></div>\n"; if ($module != 0) { // Don't want new questions created from the Unassigned folder. echo "<div class=\"f2\"><div class=\"f_icon\"><a href=\"#\" onclick=\"newQuestion({$module}); return false;\"><img src=\"../artwork/new_question.png\" alt=\"" . $string['newquestion'] . "\" /></a></div><div class=\"f_details\"><a href=\"\" onclick=\"newQuestion({$module}); return false;\">" . $string['newquestion'] . "</a></div></div>\n"; } // User section echo "<br clear=\"left\">\n"; echo "<div class=\"subsect_table\" style=\"clear:both\"><div class=\"subsect_title\">" . $string['users'] . "</div><div class=\"subsect_hr\"><hr noshade=\"noshade\" /></div></div>\n"; echo "<div class=\"f2\"><div class=\"f_icon\"><a href=\"../users/search.php?module={$module}\"><img src=\"../artwork/search_48.png\" alt=\"Folder\" /></a></div><div class=\"f_details\"><a href=\"../users/search.php?module={$module}\">" . $string['search'] . "</a><br /><span class=\"grey\">" . $string['forusers'] . "</span></div></div>\n"; if ($_GET['module'] != '0') { $current_year = date_utils::get_current_academic_year($module_details['academic_year_start']); $student_cohort = module_utils::get_student_members($current_year, $module, $mysqli); $url = '../users/search.php?submit=Search&module=' . $module . '&calendar_year=' . $current_year . '&students=on&search_username=&student_id='; $student_no = count($student_cohort); if ($student_no == 0) { $student_class = 'red'; } else { $student_class = 'grey'; } echo "<div class=\"f2\"><div class=\"f_icon\"><a href=\"{$url}\"><img src=\"../artwork/user_accounts_icon.png\" alt=\"Folder\" /></a></div><div class=\"f_details\"><a href=\"{$url}\">" . sprintf($string['studentlist'], $current_year) . "</a><br /><span class=\"{$student_class}\">" . number_format($student_no) . " " . $string['students'] . "</span></div></div>\n"; $url = '../users/import_users_metadata.php?module=' . $module; echo "<div class=\"f2\"><div class=\"f_icon\"><a href=\"{$url}\"><img src=\"../artwork/user_metadata_48.png\" alt=\"Folder\" /></a></div><div class=\"f_details\"><a href=\"{$url}\">" . $string['addmetadata'] . "</a><br /><span class=\"grey\">" . sprintf($string['extradataaboutstudents'], $module_details['moduleid']) . "</span></div></div>\n"; } $mysqli->close(); ?> </div>
}); updatePaperCount(); }); </script> </head> <body> <?php require '../include/module_options.inc'; require '../include/toprightmenu.inc'; echo draw_toprightmenu(); if (isset($state['showretired']) and $state['showretired'] == 'true') { $types_used = module_utils::paper_types($module, true, $mysqli); } else { $types_used = module_utils::paper_types($module, false, $mysqli); } ?> <div id="content"> <div class="head_title"> <div><img src="../artwork/toprightmenu.gif" id="toprightmenu_icon" /></div> <?php echo "<div style=\"position:absolute; right: 6px; top: 24px\"><label><input class=\"chk\" type=\"checkbox\" name=\"showretired\" id=\"showretired\" value=\"on\"\""; if (isset($state['showretired']) and $state['showretired'] == 'true') { echo ' checked="checked"'; } echo " />" . $string['showretired'] . "</label></div>\n"; ?> <div class="breadcrumb"><a href="../index.php"><?php echo $string['home'];
} } $cols = count($table_order); echo "<div style=\"font-size:80%\">\n"; echo "<div class=\"head_title\">\n"; echo "<div><img src=\"../artwork/toprightmenu.gif\" id=\"toprightmenu_icon\" /></div>\n"; echo '<div class="breadcrumb"><a href="../index.php">' . $string['home'] . '</a>'; if (isset($_GET['folder']) and $_GET['folder'] != '') { echo '<img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../folder/index.php?folder=' . $_GET['folder'] . '">' . folder_utils::get_folder_name($_GET['folder'], $mysqli) . '</a>'; } elseif (isset($_GET['module']) and $_GET['module'] != '') { echo '<img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../module/index.php?module=' . $_GET['module'] . '">' . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . '</a>'; } echo '<img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../paper/details.php?paperID=' . $paperID . '">' . $paper . '</a></div>'; $report_title = $string['classtotals']; if (isset($_GET['repmodule']) and $_GET['repmodule'] != '') { $report_title .= ' <span style="font-weight: normal">(' . module_utils::get_moduleid_from_id($_GET['repmodule'], $mysqli) . ' ' . $string['studentsonly'] . ')</span>'; } elseif (isset($_GET['percent']) and $_GET['percent'] < 100) { if ($ordering == 'desc') { $report_title .= ' <span style="font-weight: normal">(' . $string['top'] . ' ' . $_GET['percent'] . '%)</span>'; } else { $report_title .= ' <span style="font-weight: normal">(' . $string['bottom'] . ' ' . $_GET['percent'] . '%)</span>'; } } echo "<div class=\"page_title\">{$report_title}</div>"; echo "</div>\n"; // Warning display banners $report->check_late_submission_warnings(); $report->check_unmarked_textbox_warnings(); $report->check_unmarked_enhancedcalc_warnings(); $report->check_temp_account_warnings(); // Output table header
} ?> <div class="form"> <h2 class="midblue_header"><?php echo $string['metadata']; ?> </h2> </div> <?php $q_teams = array(); if (count($question->get_teams()) > 0) { $q_teams = $question->get_teams(); } elseif (isset($module)) { $q_teams[$module] = module_utils::get_moduleid_from_id($module, $mysqli); } echo render_metadata($mysqli, $question, $question->use_bloom(), $q_teams, $q_disabled, $string, $userObject); ?> </div> </div> <div id="changes" class="tab-area"> <?php $changes = $question->get_changes(); echo render_changes($changes, $string); ?> </div> <div id="comments" class="tab-area"> <?php
* @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ require_once '../include/staff_auth.inc'; require_once '../include/errors.inc'; require_once '../include/mapping.inc'; require_once '../classes/moduleutils.class.php'; $errors = array(); if (empty($_POST['source_y']) or empty($_POST['dest_y']) or empty($_POST['moduleID'])) { $errors[] = "Undefined source or destination year"; } elseif ($_POST['source_y'] == $_POST['dest_y']) { $errors[] = "Source and destination years cannot be the same"; } else { // Get the sessions for the source year $module_code = module_utils::get_moduleid_from_id($_POST['moduleID'], $mysqli); $modules_array = array($_POST['moduleID'] => $module_code); $objectives = getObjectives($modules_array, $_POST['source_y'], '', '', $mysqli); try { copyObjectives($objectives, $_POST['moduleID'], $module_code, $_POST['dest_y'], $mysqli); } catch (Exception $ex) { $errors[] = "An error occured when copying the objectives. Please try again."; } } ?> <!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');
$updateData['checklist'] = substr($checklist, 1); $updateData['fullname'] = $fullname; $updateData['vle_api'] = $vle_api; $updateData['sms'] = $sms_api; $updateData['schoolid'] = $schoolID; $updateData['active'] = $active; $updateData['selfenroll'] = $selfEnrol; $updateData['neg_marking'] = $neg_marking; $updateData['timed_exams'] = $timed_exams; $updateData['exam_q_feedback'] = $exam_q_feedback; $updateData['add_team_members'] = $add_team_members; $updateData['academic_year_start'] = $academic_year_start; module_utils::update_module_by_code($moduleid, $updateData, $mysqli); echo "<li class=\"existing\">{$moduleid} - " . $string['alreadyexists'] . "</li>\n"; } else { $success = module_utils::add_modules($moduleid, $fullname, $active, $schoolID, $vle_api, $sms_api, $selfEnrol, $peer, $external, $stdset, $mapping, $neg_marking, $ebel_grid_template, $mysqli, 0, $timed_exams, $exam_q_feedback, 1, $academic_year_start); if ($success) { echo "<li class=\"added\">{$moduleid} - " . $string['added'] . "</li>\n"; $modulesAdded++; } else { echo "<li class=\"fail\">{$moduleid} - " . $string['failed'] . "</li>\n"; } } } } } } } unlink($configObject->get('cfg_tmpdir') . $userObject->get_user_ID() . "_module_create.csv"); echo "</ul>"; echo "<div style=\"text-align:center\"><input type=\"button\" name=\"ok\" value=\"" . $string['ok'] . "\" onclick=\"window.location='list_modules.php'\" class=\"ok\" /></div>\n";
if ($line_no == 0) { // Read the header row $heading = $cols; $col_no = count($cols); echo "<tr><th></th><th>Username</th><th colspan=\"3\">Student Name</th>"; for ($i = 1; $i < $col_no; $i++) { echo "<th>" . trim($heading[$i]) . "</th>"; } echo "</tr>\n"; } else { // 'username' can be either the real username or sid $username = trim($cols[0]); // Check see if user was found if (!isset($student_id_array[$username])) { if (UserUtils::userid_exists($username, $mysqli) or UserUtils::username_exists($username, $mysqli)) { echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$username}</td><td colspan=\"" . (3 + $col_no) . "\" class=\"failed\" style=\"text-align:center\"><user not registered on " . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . "></td>"; } else { echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$username}</td><td colspan=\"" . (3 + $col_no) . "\" class=\"failed\" style=\"text-align:center\"><unknown user></td>"; } } else { $student_id = $student_id_array[$username]; echo "<tr><td><img src=\"../artwork/green_plus_16.png\" wodth=\"16\" height=\"16\" alt=\"Add\" /></td><td>{$username}</td><td>" . $student_data[$student_id]['title'] . "</td><td>" . $student_data[$student_id]['surname'] . "</td><td>" . $student_data[$student_id]['first_names'] . "</td>"; for ($i = 1; $i < $col_no; $i++) { $type = trim($heading[$i]); $value = trim($cols[$i]); echo "<td>{$value}</td>"; if ($type != '') { $stmt->execute(); } } echo "</tr>\n";
* Delete a module - SysAdmin only. * * @author Simon Wilkinson * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ require '../include/sysadmin_auth.inc'; require_once '../include/errors.inc'; require_once '../classes/moduleutils.class.php'; $idMod = check_var('idMod', 'POST', true, false, true); if (!module_utils::get_moduleid_from_id($idMod, $mysqli)) { $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); } module_utils::delete_module($idMod, $mysqli); $mysqli->close(); ?> <!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>Module Deleted</title> <link rel="stylesheet" type="text/css" href="../css/body.css" /> <link rel="stylesheet" type="text/css" href="../css/check_delete.css" />
$lab_details = array($string['default'] => array('-1' => $string['alllabs'])); $stmt = $mysqli->prepare("SELECT id, building, room_no, campus FROM labs ORDER BY campus, building, room_no"); $stmt->execute(); $stmt->bind_result($id, $building, $room_no, $campus); while ($stmt->fetch()) { $lab_details[$campus][$id] = $building . ' - ' . $room_no; } $stmt->close(); ?> <form action="" method="get" id="theform"> <table class="header"> <tr><th> <?php if (isset($_GET['module'])) { echo '<div class="breadcrumb"><a href="../index.php">' . $string['home'] . '</a><img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../module/index.php?module=' . $_GET['module'] . '">' . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . '</a></div>'; } else { if ($userObject->has_role('SysAdmin')) { echo '<div class="breadcrumb"><a href="../index.php">' . $string['home'] . '</a><img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="./index.php">' . $string['administrativetools'] . '</a></div>'; } else { echo '<div class="breadcrumb"><a href="../index.php">' . $string['home'] . '</a></div>'; } } ?> <div class="page_title"><?php echo $string['calendar']; ?> : <span style="font-weight:normal"><?php echo $current_year; ?> </span></div></th>
/** * Update any part of a modules DB record. * * @param integer $orig_moduleid - the code of the module to update * @param type $updateData - an array of key value pairs to update e.g 'fullname'=>'New full Name' * @param object $db - MySQLi database connection. * @return boolean */ public function update_module_by_code($orig_moduleid, $updateData, $db) { global $string; if ($orig_moduleid == '') { return false; } $orig_modinfo = $modinfo = module_utils::get_full_details_by_name($orig_moduleid, $db); if ($modinfo === false) { // The module must exist to update it! return false; } $orig_school_name = $modinfo['school']; $orig_school_id = $modinfo['schoolid']; $changed = false; foreach ($updateData as $key => $val) { $key = strtolower($key); if ($key == 'idmod') { //never change the id :-) continue; } if ($modinfo[$key] != $val) { $modinfo[$key] = $val; $changed = true; } } if (!$changed) { // Nothing has changed return return true; } // Check mandatory fields if ($modinfo['moduleid'] == '' and $modinfo['fullname'] == '') { return false; } if ($orig_school_name != $modinfo['school']) { // We have updated the school so we need to get the new id from the schools table if ($orig_school_id != $modinfo['schoolid']) { // Do nothing as the id has already been updated } else { // Lookup the schoolID $modinfo['schoolid'] = SchoolUtils::get_school_id_by_name($modinfo['school'], $db); if ($modinfo['schoolid'] === false) { // School not found ERROR return false; } } } $sql = "UPDATE modules SET \n moduleid = ?,\n fullname = ?,\n active = ?, \n vle_api = ?, \n checklist = ?, \n sms = ?, \n selfenroll = ?, \n schoolid = ?, \n neg_marking = ?, \n ebel_grid_template = ?, \n timed_exams = ?, \n exam_q_feedback = ?, \n add_team_members = ?,\n map_level = ?,\n academic_year_start = ?\n WHERE \n id = ?\n LIMIT 1\n "; $result = $db->prepare($sql); $result->bind_param('ssisssiiiiiiiisi', $modinfo['moduleid'], $modinfo['fullname'], $modinfo['active'], $modinfo['vle_api'], $modinfo['checklist'], $modinfo['sms'], $modinfo['selfenroll'], $modinfo['schoolid'], $modinfo['neg_marking'], $modinfo['ebel_grid_template'], $modinfo['timed_exams'], $modinfo['exam_q_feedback'], $modinfo['add_team_members'], $modinfo['map_level'], $modinfo['academic_year_start'], $modinfo['idMod']); $res = $result->execute(); // An array to convert DB fields to lang strings argghhh!!!! $lang_mappings = array('moduleid' => 'moduleid', 'fullname' => 'name', 'schoolid' => 'school', 'active' => 'active', 'vle_api' => 'objapi', 'checklist' => 'summativechecklist', 'sms' => 'smsapi', 'selfenroll' => 'allowselfenrol', 'neg_marking' => 'negativemarking', 'ebel_grid_template' => 'ebelgrid', 'timed_exams' => 'timedexams', 'exam_q_feedback' => 'questionbasedfeedback', 'add_team_members' => 'addteammembers', 'map_level' => 'map_level', 'academic_year_start' => 'academicyearstart'); if ($res === true) { // Log any changes $logger = new Logger($db); $userObject = UserObject::get_instance(); foreach ($modinfo as $key => $val) { $key = strtolower($key); if ($key == 'idmod') { continue; } if ($orig_modinfo[$key] != $val) { $logger->track_change('Module', $modinfo['idMod'], $userObject->get_user_ID(), $orig_modinfo[$key], $modinfo[$key], $string[$lang_mappings[$key]]); } } } return true; }
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Rogō. If not, see <http://www.gnu.org/licenses/>. /** * * @author Simon Wilkinson * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ require '../../include/staff_auth.inc'; require_once '../../classes/moduleutils.class.php'; if (isset($_GET['teamID'])) { if (!module_utils::get_moduleid_from_id($_GET['teamID'], $mysqli)) { $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); } } ?> <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>by Paper</title> <link rel="stylesheet" type="text/css" href="../../css/body.css" />
function Save($params, &$data) { global $mysqli, $string; echo "<h4>{$string['params']}</h4>"; print_p($params); echo "<h4>{$string['othherdebug']}</h4>"; $this->db = new Database(); if (count($data->questions) == 0) { $this->AddError($string['noquestions']); return; } $paperid = $params->paper; $userObj = UserObject::get_instance(); $userID = $userObj->get_user_ID(); $db = new Database(); $db->SetTable('properties'); $db->AddField('*'); $db->AddWhere('property_id', $paperid, 'i'); $paper_row = $db->GetSingleRow(); $ownerid = $userID; $data->ownerID = $userID; $nextscreen = 1; $nextid = 1; if ($paperid) { echo "{$string['addingtopaper']} {$paperid}<br>"; $this->db->SetTable('papers'); $this->db->AddField("max(screen) as screen"); $this->db->AddField("max(display_pos) as display_pos"); $this->db->AddWhere('paper', $paperid, 'i'); $curpos = $this->db->GetSingleRow(); $nextscreen = $curpos['screen'] + 1; $nextid = $curpos['display_pos'] + 1; } /* // Get the actual ID of the module $this->db->SetTable('modules'); $this->db->AddField('id'); // Temp fix - if more than one team just get the first. Avoids error but doesn't fix the problem completely if (strpos($q_group, ',') !== false) { $q_group = strstr($q_group, ',', true); } $this->db->AddWhere('moduleid', $q_group, 's'); $module_row = $this->db->GetSingleRow(); */ $module_id = -1; $paperutils = Paper_utils::get_instance(); $module_id1 = $paperutils->get_modules($paper_row['property_id'], $mysqli); if ($module_id1 !== false) { $module_id = $module_id1; } $modutils = module_utils::get_instance(); $q_group = $modutils->get_moduleid_from_id($module_id, $mysqli); if ($module_id !== false) { // Get a list of the team and user's keywords $user_keywords = array(); if (is_array($module_id)) { foreach (array_keys($module_id) as $mod_id) { $user_keywordsl = $this->GetExistingKeywords($mod_id); $user_keywords = array_merge($user_keywords, $user_keywordsl); } } else { $user_keywords = $this->GetExistingKeywords($module_id); } } foreach ($data->questions as &$question) { $this->q_row = $this->db->GetBlankTableRow("questions"); $this->o_row = $this->db->GetBlankTableRow("options"); $this->o_rows = array(); // stuff from parameters $this->q_row['ownerID'] = $ownerid; // general stuff that needs to be done for every qtype $this->q_row['creation_date'] = date("Y-m-d H:i:s"); $this->q_row['last_edited'] = date("Y-m-d H:i:s"); $this->q_row['q_type'] = $question->type; $this->q_row['status'] = isset($this->statuses[$question->status]) ? $this->statuses[$question->status] : $this->default_status; $this->q_row['theme'] = $question->theme; $this->q_row['notes'] = $question->notes; $this->q_row['leadin'] = $question->leadin; $this->q_row['bloom'] = $question->bloom; $this->q_row['q_media'] = $question->media; $this->q_row['q_media_width'] = $question->media_width; $this->q_row['q_media_height'] = $question->media_height; $this->q_row['deleted'] = null; $this->q_row['locked'] = null; $this->q_row['std'] = null; $this->q_row['q_option_order'] = $question->q_option_order; if (isset($question->settings)) { $this->q_row['settings'] = $question->settings; } $oiii = print_r($question, true); $t = 8; if ($question->type == "blank") { $this->SaveBlank($question); } elseif ($question->type == "calculation") { $this->SaveCalculation($question); $this->q_row['q_type'] = 'enhancedcalc'; } elseif ($question->type == "dichotomous") { $this->SaveDichotomous($question); } elseif ($question->type == "extmatch") { $this->SaveExtMatch($question); } elseif ($question->type == "flash") { $this->SaveFlash($question); } elseif ($question->type == "hotspot") { $this->SaveHotspot($question); } elseif ($question->type == "info") { $this->SaveInfo($question); } elseif ($question->type == "labelling") { $this->SaveLabelling($question); } elseif ($question->type == "likert") { $this->SaveLikert($question); } elseif ($question->type == "matrix") { $this->SaveMatrix($question); } elseif ($question->type == "mcq") { $this->SaveMcq($question); } elseif ($question->type == "true_false") { $this->SaveTrueFalse($question); } elseif ($question->type == "mrq") { $this->SaveMrq($question); } elseif ($question->type == "rank") { $this->SaveRank($question); } elseif ($question->type == "textbox") { $this->SaveTextbox($question); } else { $this->AddError("Question type " . $question->type . " not yet supported", $question->load_id); continue; } if (!in_array($this->q_row['q_option_order'], array('display order', 'alphabetic', 'random'))) { $this->q_row['q_option_order'] = 'display order'; print "correcting q_option_order"; } if (!empty($this->q_row['scenario']) && strcasecmp("<p> </p>", $this->q_row['scenario']) == 0) { $this->q_row['scenario'] = ''; } // create plain version of scenario and leadin $this->q_row['scenario_plain'] = empty($this->q_row['scenario']) ? '' : trim(strip_tags($this->q_row['scenario'])); $this->q_row['leadin_plain'] = empty($this->q_row['leadin']) ? '' : trim(strip_tags($this->q_row['leadin'])); if (!empty($this->q_row['correct_fback']) && !empty($this->q_row['incorrect_fback']) && $this->q_row['correct_fback'] == $this->q_row['incorrect_fback']) { $this->q_row['incorrect_fback'] = ''; } // if no o_row, create a blank one if (count($this->o_rows) == 0 and $question->type != "calculation") { $this->o_row['marks_correct'] = 1; $this->o_row['marks_incorrect'] = 0; $this->o_row['marks_partial'] = 0; $this->o_rows[] = $this->o_row; } // store question row $this->db->InsertRow("questions", "q_id", $this->q_row); $question->save_id = $this->q_row['q_id']; $this->qm_row = $this->db->GetBlankTableRow("questions_modules"); $this->qm_row['q_id'] = $this->q_row['q_id']; if (is_array($module_id)) { foreach (array_keys($module_id) as $mod_id) { $this->qm_row['idMod'] = $mod_id; $this->db->InsertRow("questions_modules", "temp", $this->qm_row); } } else { $this->qm_row['idMod'] = $module_id; $this->db->InsertRow("questions_modules", "temp", $this->qm_row); } $new_keywords = array(); if ($module_id != -1) { if (is_array($module_id)) { $user_keywords2 = array(); foreach (array_keys($module_id) as $mod_id) { $new_keywords1 = $this->SaveKeywords($this->q_row['q_id'], $question->keywords, $mod_id, $user_keywords, $user_keywords2); $new_keywords = array_merge($new_keywords, $new_keywords1); } $user_keywords = array_merge($user_keywords, $user_keywords2); } else { $new_keywords = $this->SaveKeywords($this->q_row['q_id'], $question->keywords, $module_id, $user_keywords); } } // store option rows foreach ($this->o_rows as &$o_row) { $o_row['o_id'] = $this->q_row['q_id']; if (!empty($o_row['feedback_right']) && $o_row['feedback_right'] == $o_row['feedback_wrong']) { $o_row['feedback_wrong'] = ""; } $this->db->InsertRow("options", "id_num", $o_row); } // store additional metadata if ($question->load_id != '') { $meta_row = array('id' => null, 'questionID' => $question->save_id, 'type' => 'QTI Ident', 'value' => $question->load_id); } $this->db->InsertRow("questions_metadata", "id", $meta_row); echo "<h4>{$string['questiontables']}</h4>"; echo "<div>{$string['questionsrow']}</div>"; print_p($this->q_row, false); echo "<div>{$string['optionsrows']}</div>"; print_p($this->o_rows, false, 100); echo "<div>{$string['newkeywords']}</div>"; print_p($new_keywords, false); $track = array(); $track['type'] = $string['qtiimport']; $track['typeID'] = $this->q_row['q_id']; $track['editor'] = $userID; $track['new'] = "{$string['imported1_2']} " . $params->original_filename; $track['part'] = "all"; $track['changed'] = date("Y-m-d H:i:s"); $db->InsertRow("track_changes", "id", $track); // we have a paper, add this question onto the list of questions for the paper if ($paperid && empty($data->papers)) { $p_row = $this->db->GetBlankTableRow('papers'); $p_row['paper'] = $paperid; $p_row['question'] = $question->save_id; $p_row['screen'] = $nextscreen; $p_row['display_pos'] = $nextid++; $this->db->InsertRow('papers', 'p_id', $p_row); } } $logger = new Logger($mysqli); if (!empty($data->papers)) { foreach ($data->papers as &$paper) { foreach ($paper->screens as &$screen) { foreach ($screen->question_ids as $q_id) { $p_row = $this->db->GetBlankTableRow('papers'); echo sprintf($string['addingquestiondetails'], $q_id, $nextid, $nextscreen) . '<br>'; $p_row['paper'] = $paperid; $q = FindQuestion($data->questions, $q_id); $p_row['question'] = $q->save_id; $p_row['screen'] = $nextscreen; $p_row['display_pos'] = $nextid++; $this->db->InsertRow('papers', 'p_id', $p_row); $logger->track_change('Paper', $paperid, $userID, '', $q_id, 'Add Question (from QTI)'); } $nextscreen++; } } } }
</table> </div> <br /> <?php echo $string['name']; ?> <input type="text" id="paper_name" name="paper_name" value="" maxlength="255" style="width:650px" required /> <input type="hidden" name="module" value="<?php if (isset($_GET['module'])) { echo $_GET['module']; } ?> " /> <?php if (isset($_GET['module'])) { $module_details = module_utils::get_full_details_by_ID($_GET['module'], $mysqli); $default_academic_year = date_utils::get_current_academic_year($module_details['academic_year_start']); } else { $default_academic_year = $configObject->get('cfg_academic_year_start'); } ?> <input type="hidden" name="default_academic_year" value="<?php echo $default_academic_year; ?> " /> <input type="hidden" name="folder" value="<?php if (isset($_GET['folder'])) { echo $_GET['folder']; } ?> " />
// You should have received a copy of the GNU General Public License // along with Rogō. If not, see <http://www.gnu.org/licenses/>. /** * * Confirm that it is OK to proceed deleting a module. * * @author Simon Wilkinson * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ require '../include/sysadmin_auth.inc'; require_once '../include/errors.inc'; require_once '../classes/moduleutils.class.php'; $idMod = check_var('idMod', 'GET', true, false, true); $moduleid = module_utils::get_moduleid_from_id($idMod, $mysqli); if (!$moduleid) { $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); } $mysqli->close(); ?> <!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'); ?> " />
/** * Enrole the student on a module. * * @param $idMod moduleID of module * @param $attempt * @param $session session of module * @param int $auto_update if system add * * @return bool return true if successful. */ public function add_student_to_module($idMod, $attempt, $session, $auto_update = 0) { // need to check its a self reg module if (module_utils::get_full_details_by_ID($idMod, $this->db) === false) { return false; } if (UserUtils::is_user_on_module($this, $idMod, $session, $this->db)) { //don't add a user to a module multiple times return true; } $return = UserUtils::add_student_to_module($this->get_user_ID(), $idMod, $attempt, $session, $auto_update); $this->load_student_modules(); return $return; }
require '../classes/moduleutils.class.php'; require '../classes/paperutils.class.php'; require_once '../classes/questionutils.class.php'; function stripTrainModule($module_string) { $new_modules = array(); $old_modules = explode(',', $module_string); foreach ($old_modules as $old_module) { if ($old_module != 'TRAIN') { $new_modules[] = $old_module; } } return implode(',', $new_modules); } // get the id of the TRAIN module $trainIdMod = module_utils::get_idMod('TRAIN', $mysqli); // Clear the TRAIN team $update = $mysqli->prepare("DELETE FROM modules_staff WHERE idMod = ?"); $update->bind_param('i', $trainIdMod); $update->execute(); $update->close(); // Get all the papers on the TRAIN team $result = $mysqli->prepare("SELECT properties.property_id FROM properties, properties_modules WHERE properties.property_id = properties_modules.property_id AND idMod = ?"); $result->bind_param('i', $trainIdMod); $result->execute(); $result->store_result(); $result->bind_result($paperID); while ($result->fetch()) { Paper_utils::remove_modules(array($trainIdMod => 'TRAIN'), $paperID, $mysqli); $q_result = $mysqli->prepare("SELECT question FROM papers WHERE paper=?"); $q_result->bind_param('i', $paperID);
/** * create the database and users if they do not exist * */ static function createDatabase($dbname, $dbcharset) { global $string; $res = self::$db->prepare("SHOW DATABASES LIKE '{$dbname}'"); $res->execute(); $res->store_result(); @ob_flush(); @flush(); if ($res->num_rows > 0) { self::displayError(array('010' => sprintf($string['displayerror1'], $dbname))); } $res->close(); switch ($dbcharset) { case 'utf8': $collation = 'utf8_general_ci'; break; default: $collation = 'latin1_swedish_ci'; } self::$db->query("CREATE DATABASE {$dbname} CHARACTER SET = {$dbcharset} COLLATE = {$collation}"); //have to use query here oldvers of php throw an error if (self::$db->errno != 0) { self::displayError(array('011' => $string['displayerror2'])); } //select the newly created database self::$db->change_user(self::$db_admin_username, self::$db_admin_passwd, self::$cfg_db_name); //create tables $tables = new databaseTables($dbcharset); self::$db->autocommit(false); while ($sql = $tables->next()) { $res = self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { self::displayError(array('012' => $string['displayerror3'] . self::$db->error . "<br /> {$sql}")); try { $err = self::$db->error; $mess = self::$db->errno; throw new Exception("MySQL error {$err}", $mess); } catch (Exception $e) { echo "Error No: " . $e->getCode() . " - " . $e->getMessage() . "<br />"; } self::$db->rollback(); } } self::$db->commit(); self::$cfg_db_username = self::$cfg_db_basename . '_auth'; self::$cfg_db_password = gen_password() . gen_password(); self::$cfg_db_student_user = self::$cfg_db_basename . '_stu'; self::$cfg_db_student_passwd = gen_password() . gen_password(); self::$cfg_db_staff_user = self::$cfg_db_basename . '_staff'; self::$cfg_db_staff_passwd = gen_password() . gen_password(); self::$cfg_db_external_user = self::$cfg_db_basename . '_ext'; self::$cfg_db_external_passwd = gen_password() . gen_password(); self::$cfg_db_sysadmin_user = self::$cfg_db_basename . '_sys'; self::$cfg_db_sysadmin_passwd = gen_password() . gen_password(); self::$cfg_db_sct_user = self::$cfg_db_basename . '_sct'; self::$cfg_db_sct_passwd = gen_password() . gen_password(); self::$cfg_db_inv_user = self::$cfg_db_basename . '_inv'; self::$cfg_db_inv_passwd = gen_password() . gen_password(); self::$cfg_cron_user = '******'; self::$cfg_cron_passwd = gen_password() . gen_password(); $priv_SQL = array(); //create 'database user authentication user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_password . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_username . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".admin_access TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".courses TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".client_identifiers TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".labs TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".lti_keys TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".lti_user TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules_student TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_metadata_security TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, UPDATE, INSERT, DELETE ON " . $dbname . ".password_tokens TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".schools TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".sid TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".special_needs TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".sys_errors TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT,INSERT ON " . $dbname . ".temp_users TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".users TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".users_metadata TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".denied_log TO '" . self::$cfg_db_username . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_username . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); $priv_SQL = array(); //create 'database user student user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_student_passwd . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_student_user . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_student_user . "'@'". self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".announcements TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".cache_median_question_marks TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".cache_paper_stats TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".cache_student_paper_marks TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".exam_announcements TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".feedback_release TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".help_log TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".help_searches TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".help_tutorial_log TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".client_identifiers TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".keywords_question TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".labs TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log0 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log1 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log2 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log3 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log4 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log4_overall TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log5 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log6 TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".log_extra_time TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".log_lab_end_time TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log_late TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log_metadata TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".lti_resource TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".lti_context TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".marking_override TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".modules_student TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".objectives TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".options TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_feedback TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_metadata_security TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".papers TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties_modules TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".questions TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".question_exclude TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".question_statuses TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".reference_material TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".reference_modules TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".reference_papers TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".relationships TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".schools TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".sid TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".sessions TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".std_set TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".std_set_questions TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".state TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".student_help TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".special_needs TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".sys_errors TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".temp_users TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".users TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".users_metadata TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".access_log TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".denied_log TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".killer_questions TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".save_fail_log TO '" . self::$cfg_db_student_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_student_user . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); $priv_SQL = array(); //create 'database user external user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_external_passwd . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_external_user . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_external_user . "'@'". self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".help_log TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".help_searches TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".keywords_question TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log0 TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log1 TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log2 TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log3 TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log4 TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log4_overall TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log5 TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log_late TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log_metadata TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules_staff TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".options TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".papers TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".questions TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".question_statuses TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".reference_material TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".reference_modules TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".reference_papers TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".review_comments TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".review_metadata TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".special_needs TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".std_set TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".std_set_questions TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".staff_help TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".student_help TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".sys_errors TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".users TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".access_log TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".denied_log TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties_reviewers TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".client_identifiers TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".labs TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties_modules TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".log_extra_time TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".log_lab_end_time TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".schools TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_metadata_security TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules_student TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".question_exclude TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".users_metadata TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".marking_override TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".sid TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".student_notes TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_notes TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".exam_announcements TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".relationships TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".feedback_release TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".cache_paper_stats TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_feedback TO '" . self::$cfg_db_external_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_external_user . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); $priv_SQL = array(); //create 'database user staff user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_staff_passwd . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_staff_user . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_staff_user . "'@'". self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".* TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".cache_median_question_marks TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".cache_paper_stats TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".cache_student_paper_marks TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".ebel TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".exam_announcements TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".feedback_release TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".folders TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".folders_modules_staff TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".help_log TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".help_searches TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".help_tutorial_log TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".hofstee TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".keywords_question TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".keywords_user TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log0 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log1 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log2 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log3 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log4 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log4_overall TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log5 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".log6 TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log_late TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log_metadata TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".lti_resource TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".lti_context TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".marking_override TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".modules TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".modules_staff TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".modules_student TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".objectives TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".options TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".paper_metadata_security TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".paper_notes TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".paper_feedback TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".papers TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".password_tokens TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".performance_main TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".performance_details TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".properties TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".properties_modules TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".question_exclude TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".questions TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".question_statuses TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".questions_metadata TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".questions_modules TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".recent_papers TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".reference_material TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".reference_modules TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".reference_papers TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".relationships TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".review_comments TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".review_metadata TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, DELETE ON " . $dbname . ".scheduling TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".sessions TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".sid TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".sms_imports TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".special_needs TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".std_set TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".std_set_questions TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".state TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".student_notes TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".temp_users TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".textbox_marking TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".textbox_remark TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".track_changes TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".users TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".users_metadata TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".access_log TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".denied_log TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".properties_reviewers TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".sys_errors TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".killer_questions TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT ON " . $dbname . ".save_fail_log TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, UPDATE ON " . $dbname . ".toilet_breaks TO '" . self::$cfg_db_staff_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_staff_user . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); $priv_SQL = array(); //create 'database user SCT user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_sct_passwd . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_sct_user . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_sct_user . "'@'". self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".options TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_metadata_security TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".paper_notes TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".papers TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".questions TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".question_statuses TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".questions_metadata TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".sct_reviews TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".denied_log TO '" . self::$cfg_db_sct_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_sct_user . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); $priv_SQL = array(); //create 'database user Invigilator user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_inv_passwd . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_inv_user . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_inv_user . "'@'". self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".exam_announcements TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".client_identifiers TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".labs TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".log2 TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".log_metadata TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log_extra_time TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE ON " . $dbname . ".log_lab_end_time TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules_student TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".paper_notes TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".properties_modules TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".modules TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".papers TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".questions TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".question_statuses TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE ON " . $dbname . ".student_notes TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".sid TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".special_needs TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT ON " . $dbname . ".users TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".access_log TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT INSERT ON " . $dbname . ".denied_log TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, DELETE ON " . $dbname . ".toilet_breaks TO '" . self::$cfg_db_inv_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_inv_user . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); $priv_SQL = array(); //create 'database user sysadmin user' and grant permissions self::$db->query("CREATE USER '" . self::$cfg_db_sysadmin_user . "'@'" . self::$cfg_web_host . "' IDENTIFIED BY '" . self::$cfg_db_sysadmin_passwd . "'"); if (self::$db->errno != 0) { self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_sysadmin_user . $string['wnotcreated'] . ' ' . self::$db->error)); } //$priv_SQL[] = "REVOKE ALL PRIVILEGES ON $dbname.* FROM '". self::$cfg_db_sysadmin_user . "'@'". self::$cfg_web_host . "'"; $priv_SQL[] = "GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, DROP ON " . $dbname . ".* TO '" . self::$cfg_db_sysadmin_user . "'@'" . self::$cfg_web_host . "'"; $priv_SQL[] = "FLUSH PRIVILEGES"; foreach ($priv_SQL as $sql) { self::$db->query($sql); @ob_flush(); @flush(); if (self::$db->errno != 0) { echo self::$db->error . "<br />"; self::displayError(array('013' => $string['wdatabaseuser'] . self::$cfg_db_sysadmin_user . $string['wnotpermission'] . ' ' . self::$db->error)); self::$db->rollback(); } } self::$db->commit(); //create sysadmin user UserUtils::create_user($_POST['SysAdmin_username'], $_POST['SysAdmin_password'], $_POST['SysAdmin_title'], $_POST['SysAdmin_first'], $_POST['SysAdmin_last'], $_POST['SysAdmin_email'], 'University Lecturer', '', '1', 'Staff,SysAdmin', '', self::$db); //create cron user UserUtils::create_user(self::$cfg_cron_user, self::$cfg_cron_passwd, '', '', 'cron', '', '', '', '', 'Staff,SysCron', '', self::$db); //create 100 guest accounts for ($i = 1; $i <= 100; $i++) { UserUtils::create_user('user' . $i, '', 'Dr', 'A', 'User' . $i, '', 'none', '', '1', 'Student', '', self::$db); } self::$db->commit(); //add unknown school & faculty $facultyID = FacultyUtils::add_faculty('UNKNOWN Faculty', self::$db); $scoolID = SchoolUtils::add_school($facultyID, 'UNKNOWN School', self::$db); //add traing school $facultyID = FacultyUtils::add_faculty('Administrative and Support Units', self::$db); $scoolID = SchoolUtils::add_school($facultyID, 'Training', self::$db); //create special modules module_utils::add_modules('TRAIN', 'Training Module', 1, $scoolID, '', '', 0, false, false, false, true, null, null, self::$db, 0, 0, 1, 1, '07/01'); module_utils::add_modules('SYSTEM', 'Online Help', 1, $scoolID, '', '', 0, true, true, true, true, null, null, self::$db, 0, 0, 1, 1, '07/01'); self::$db->commit(); // Create default question statuses $statuses = array(array('name' => 'Normal', 'exclude_marking' => false, 'retired' => false, 'is_default' => true, 'change_locked' => true, 'validate' => true, 'display_warning' => 0, 'colour' => '#000000', 'display_order' => 0), array('name' => 'Retired', 'exclude_marking' => false, 'retired' => true, 'is_default' => false, 'change_locked' => true, 'validate' => false, 'display_warning' => 1, 'colour' => '#808080', 'display_order' => 1), array('name' => 'Incomplete', 'exclude_marking' => false, 'retired' => false, 'is_default' => false, 'change_locked' => false, 'validate' => false, 'display_warning' => 1, 'colour' => '#000000', 'display_order' => 2), array('name' => 'Experimental', 'exclude_marking' => true, 'retired' => false, 'is_default' => false, 'change_locked' => false, 'validate' => true, 'display_warning' => 0, 'colour' => '#808080', 'display_order' => 3), array('name' => 'Beta', 'exclude_marking' => false, 'retired' => false, 'is_default' => false, 'change_locked' => false, 'validate' => true, 'display_warning' => 1, 'colour' => '#000000', 'display_order' => 4)); foreach ($statuses as $data) { $qs = new QuestionStatus(self::$db, $string, $data); $qs->save(); } //FLUSH PRIVILEGES self::$db->query("FLUSH PRIVILEGES"); if (self::$db->errno != 0) { self::logWarning(array('014' => $string['logwarning20'])); } self::$db->commit(); self::$db->autocommit(false); }
"> <div class="head_title"> <div style="float:right; vertical-align:top"><img src="../artwork/toprightmenu.gif" id="toprightmenu_icon" /></div> <?php echo "<div class=\"breadcrumb\"><a href=\"../index.php\">" . $string['home'] . "</a>"; if (isset($_GET['module']) and $_GET['module'] != '') { echo '<img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../module/index.php?module=' . $_GET['module'] . '">' . module_utils::get_moduleid_from_id($_GET['module'], $mysqli) . '</a>'; } echo "</div><div class=\"page_title\">" . $string['usersearch'] . " ({$user_no}): <span style=\"font-weight: normal\">"; if (isset($_GET['paperID'])) { echo implode(', ', array_values($paper_modules)) . ' (' . $paper_calendar_year . ')'; } elseif (isset($_GET['search_surname']) and $_GET['search_surname'] != '') { echo "'" . $_GET['search_surname'] . "'"; } elseif (isset($_GET['module']) and $_GET['module'] != '%') { echo module_utils::get_moduleid_from_id($_GET['module'], $mysqli); if (isset($_GET['calendar_year']) and $_GET['calendar_year'] != '' and isset($_GET['students']) and $_GET['students'] != '') { echo ' (' . $_GET['calendar_year'] . ')'; } } elseif (isset($_GET['search_username']) and $_GET['search_username'] != '') { echo $_GET['search_username']; } elseif (isset($_GET['student_id']) and $_GET['student_id'] != '') { echo $_GET['student_id']; } elseif (isset($_GET['calendar_year']) and $_GET['calendar_year'] != '%') { echo $_GET['calendar_year']; } echo "</span></div>\n"; echo "</div>\n"; if (isset($_GET['search_surname'])) { $tmp_surname = $_GET['search_surname']; } else {
$folder = $_GET['folder']; } else { $folder = ''; } ?> <div id="content"> <div class="head_title"> <div><img src="../artwork/toprightmenu.gif" id="toprightmenu_icon" /></div> <div class="breadcrumb"><a href="../index.php"><?php echo $string['home']; ?> </a><img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="../module/index.php?module=<?php echo $modID; ?> "><?php echo module_utils::get_moduleid_from_id($modID, $mysqli); ?> </a><img src="../artwork/breadcrumb_arrow.png" class="breadcrumb_arrow" alt="-" /><a href="sessions_list.php?module=<?php echo $modID . '&folder=' . $folder; ?> "><?php echo $string['manageobjectives']; ?> </a></div> <div class="page_title"><?php echo $string['newsession']; ?> </div> </div> <br /> <?php
$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. } else { if ($propertyObj->get_paper_type() == '2') { $allow_timing = module_utils::modules_allow_timing($modIDs, $mysqli); } } /* * BP Determine the student's end_date timestamp for a summative exam that has been 'Started'. * This is also used further down to make sure that the timer does not close the window if the exam session hasn't been 'started' by an invigilator * If a summative exam session has been started then record late answers in log_late */ $paper_scheduled = $propertyObj->get_start_date() !== null; if ($propertyObj->get_exam_duration() != null and $propertyObj->get_paper_type() == '2' and !$is_question_preview_mode) { // Has this lab had an end time set? $log_lab_end_time = new LogLabEndTime($lab_id, $propertyObj, $mysqli); $summative_exam_session_started = $log_lab_end_time->get_session_end_date_datetime(); } // Check for submissions after the end date and set them to save in log_late if we are not in preview_mode or a summative exam session as not been started if ($is_preview_mode === false 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)) {
<link rel="stylesheet" type="text/css" href="../css/header.css" /> <link rel="stylesheet" type="text/css" href="../css/submenu.css" /> <style type="text/css"> .field {text-align:right; padding-right:10px} </style> <script type="text/javascript" src="../js/staff_help.js"></script> <script type="text/javascript" src="../js/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="../js/jquery.validate.min.js"></script> <script type="text/javascript" src="../js/jquery-ui-1.10.4.min.js"></script> <script type="text/javascript" src="../js/system_tooltips.js"></script> <script type="text/javascript" src="../js/toprightmenu.js"></script> <script> <?php $vle_apis = $configObject->get('vle_apis'); $mu = module_utils::get_instance(); $vle_apis = $mu->get_vle_api_data($vle_apis); if (count($vle_apis) > 0) { $map_levels = array(iCMAPI::LEVEL_SESSION => $string['session'], iCMAPI::LEVEL_MODULE => $string['module']); } else { $map_levels = array(); } ?> $(function () { $('#theform').validate({ errorClass: 'errfield', errorPlacement: function(error,element) { return true; } }); $('form').removeAttr('novalidate');
/** * Translates from internal numerical module IDs to institution module codes for display. */ private function convert_moduleIDs() { $result_no = count($this->user_results); $moduleIDs = array(); // Build up an array of IDs to module codes. for ($i = 0; $i < $result_no; $i++) { $id = $this->user_results[$i]['module']; if ($id != '') { if (!isset($moduleIDs[$id])) { $moduleIDs[$id] = module_utils::get_moduleid_from_id($id, $this->db); } } } // Loop around the results array and convert to codes. for ($i = 0; $i < $result_no; $i++) { if (isset($moduleIDs[$this->user_results[$i]['module']])) { $this->user_results[$i]['module'] = $moduleIDs[$this->user_results[$i]['module']]; } } }