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; }
} if ($tmp_sortby == 'q_type' and isset($_GET['type'])) { $tmp_sortby = 'leadin'; } //SL 05-02-2015 changed to look at leadin column instead of leadin_plain column if ($_GET['module'] == '0') { $sql = "SELECT DISTINCT NULL AS extra_field, NULL AS p, NULL AS d, questions.q_id, theme, leadin AS leadin, q_type, last_edited, DATE_FORMAT(last_edited, '{$configObject->get('cfg_long_date')}') AS modified, locked, status, bloom FROM (users, questions) LEFT JOIN questions_modules ON questions.q_id = questions_modules.q_id WHERE users.id = questions.ownerID AND ownerID = " . $userObject->get_user_ID() . " AND idMod IS NULL GROUP BY q_id"; } elseif ($_GET['type'] == 'performance') { $sql = "SELECT DISTINCT NULL AS extra_field, p, d, questions.q_id, theme, leadin AS leadin, q_type, last_edited, DATE_FORMAT(last_edited, '{$configObject->get('cfg_long_date')}') AS modified, locked, status, bloom FROM (questions, performance_main, performance_details, questions_modules) WHERE questions.q_id = performance_main.q_id AND performance_main.id = performance_details.perform_id AND questions.q_id = questions_modules.q_id AND idMod = {$module}"; } elseif ($_GET['type'] == 'keyword') { $sql = "SELECT DISTINCT keyword AS extra_field, keywordID AS p, NULL AS d, questions.q_id, theme, leadin AS leadin, q_type, last_edited, DATE_FORMAT(last_edited, '{$configObject->get('cfg_long_date')}') AS modified, locked, status, bloom FROM (questions, questions_modules, keywords_question, keywords_user) WHERE questions.q_id = keywords_question.q_id AND keywords_question.keywordID = keywords_user.id AND questions.q_id = questions_modules.q_id AND idMod = {$module} AND deleted IS NULL AND status NOT IN ({$retired_in})"; } elseif ($_GET['type'] == 'bloom') { $sql = "SELECT DISTINCT bloom AS extra_field, NULL AS p, NULL AS d, questions.q_id, theme, leadin AS leadin, q_type, last_edited, DATE_FORMAT(last_edited, '{$configObject->get('cfg_long_date')}') AS modified, locked, status, bloom FROM (questions, questions_modules) WHERE questions.q_id = questions_modules.q_id {$module_sql} {$staff_modules_sql} {$statusSQL} AND deleted IS NULL AND status NOT IN ({$retired_in})"; } elseif ($_GET['type'] == 'objective') { $vle_api_cache = array(); $vle_api_data = MappingUtils::get_vle_api($module, date_utils::get_current_academic_year(), $vle_api_cache, $mysqli); $sql = "SELECT DISTINCT GROUP_CONCAT(obj_id SEPARATOR ' ') AS extra_field, NULL AS p, NULL AS d, questions.q_id, theme, leadin AS leadin, q_type, last_edited, DATE_FORMAT(last_edited, '{$configObject->get('cfg_long_date')}') AS modified, locked, status, bloom FROM (questions, questions_modules, relationships) WHERE questions.q_id = questions_modules.q_id AND questions.q_id = relationships.question_id AND relationships.vle_api = '{$vle_api_data['api']}' AND relationships.map_level = '{$vle_api_data['level']}' {$module_sql} {$staff_modules_sql} {$statusSQL} AND deleted IS NULL AND status NOT IN ({$retired_in}) GROUP BY question_id"; } else { $sql = "SELECT DISTINCT NULL AS extra_field, NULL AS p, NULL AS d, questions.q_id, theme, leadin AS leadin, q_type, last_edited, DATE_FORMAT(last_edited, '{$configObject->get('cfg_long_date')}') AS modified, locked, status, bloom FROM (questions, questions_modules) WHERE questions.q_id = questions_modules.q_id {$module_sql} {$staff_modules_sql} {$statusSQL} {$keyword} AND deleted IS NULL"; if ($_GET['type'] != 'status') { $sql .= " AND status NOT IN ({$retired_in})"; } } $search_results = $mysqli->prepare($sql); $search_results->execute(); $search_results->bind_result($extra_field, $p, $d, $q_id, $theme, $leadin, $q_type, $last_edited, $modified, $locked, $status, $bloom); $search_results->store_result(); if ($type == 'keyword') { $table_order = array($string['question'] => 800, $string['type'] => 100, 'Keyword' => 100, $string['modified'] => 70, $string['status'] => 70); } elseif ($type == 'bloom') { $table_order = array($string['question'] => 800, $string['type'] => 100, 'Bloom\'s Taxonomy' => 100, $string['modified'] => 70, $string['status'] => 70);
if ($_POST['paper_type'] == 'summative' or $_POST['paper_type'] == 'osce' or $_POST['paper_type'] == 'offline') { $next_flag = 1; $year_options = array(); $calendar_year = date_utils::get_current_academic_year(); $next_session = substr($calendar_year, 0, 4) + 1 . '/' . (substr($calendar_year, -2) + 1); $year_options[] = $next_session; // Add next year's session $module_details = $mysqli->prepare("SELECT DISTINCT calendar_year FROM modules_student ORDER BY calendar_year DESC"); $module_details->execute(); $module_details->bind_result($calendar_year); while ($module_details->fetch()) { $year_options[] = $calendar_year; } $module_details->close(); if (count($year_options) == 1) { $year_options[] = date_utils::get_current_academic_year(); // Add current year } echo "<tr><td style=\"width:140px; text-align:right; vertical-align:top\">" . $string['academicsession'] . "</td><td>"; echo "<select name=\"session\">\n"; foreach ($year_options as $calendar_year) { $sel = $_POST['default_academic_year'] == $calendar_year ? ' selected="selected"' : ''; echo "<option value=\"{$calendar_year}\"{$sel}>{$calendar_year}</option>\n"; } echo "</select></td>\n"; } else { echo "<input type=\"hidden\" name=\"session\" value=\"\" />\n"; } if (!$configObject->get('cfg_summative_mgmt') or $_POST['paper_type'] != 'summative') { echo "</tr><tr><td align=\"right\" valign=\"top\">" . $string['from'] . " </td><td>"; $date_array = getdate();
} 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>
$lti->add_lti_resource($retlookup, 'paper'); } } unset($_SESSION['postlookup']); $returned = $lti->lookup_lti_resource(); if (!$lti->isInstructor()) { //student if ($returned === false) { // no data selected for this UserNotices::display_notice($string['warning'], $string['ltinotconfigured'], '../artwork/access_denied.png', $title_color = '#C00000'); echo "\n</body>\n</html>\n"; exit; } else { //valid data list($c_internal_id, $upd) = $lti->lookup_lti_context(); $session = date_utils::get_current_academic_year(); if (is_null($c_internal_id)) { // $lti_i::invalid_module_code($c_internal_id, $data, 'no returned data'); } $data = $lti_i::module_code_translate($c_internal_id); foreach ($data as $v) { $returned_check = module_utils::get_full_details_by_name($v[1], $mysqli); if (!UserUtils::is_user_on_module_by_name($userObject->get_user_ID(), $v[1], $session, $mysqli) and $returned_check !== false and $lti_i::allow_module_self_reg($v)) { if ($returned_check['active'] == 1 and $returned_check['selfenroll'] == 1 and !UserUtils::is_user_on_module_by_name($userObject->get_user_ID(), $v[1], $session, $mysqli)) { // Insert new module enrollment UserUtils::add_student_to_module_by_name($userObject->get_user_ID(), $v[1], 1, $session, $mysqli); } } } $_SESSION['lti']['paperlink'] = $returned[0]; header("location: ../paper/user_index.php?id=" . $returned[0]);
function update_module_enrolement($module, $idMod, $sms_api, $mysqli = 'NOTSET', $session = 'NOTSET', $demomode = false) { // run module enrolement for select code if ($mysqli == 'NOTSET') { global $mysqli; } if ($session == 'NOTSET') { $session = date_utils::get_current_academic_year(); } $session_parts = explode('/', $session); $enrolements = 0; $deletions = 0; $enrolement_details = ''; $deletion_details = ''; // UoN code to strip off prefix codes. //------------------------------------ $replaced_module = str_replace('_UNMC', '', $module); $replaced_module = str_replace('_UNNC', '', $replaced_module); //------------------------------------ // Get the currently enrolled students in Rogo for the module. $current_users = array(); $student_data = $mysqli->prepare("SELECT modules_student.id, users.id, username, grade, title, surname, first_names, initials, roles, yearofstudy, auto_update, sid.student_id FROM (modules_student, users) LEFT JOIN sid ON users.id = sid.userID WHERE modules_student.userID = users.id AND calendar_year = ? AND idMod = ?"); $student_data->bind_param('si', $session, $idMod); $student_data->execute(); $student_data->store_result(); $student_data->bind_result($sm_id, $uid, $username, $grade, $title, $surname, $first_names, $initials, $roles, $year, $auto_update, $student_id); while ($student_data->fetch()) { $current_users[$username]['delete'] = $auto_update; // Set users to be deleted if added via SATURN, set otherwise lower down after checking with SMS $current_users[$username]['smID'] = $sm_id; $current_users[$username]['userID'] = $uid; $current_users[$username]['grade'] = $grade; $current_users[$username]['title'] = $title; $current_users[$username]['surname'] = $surname; $current_users[$username]['first_names'] = $first_names; $current_users[$username]['initials'] = $initials; $current_users[$username]['roles'] = $roles; $current_users[$username]['year'] = $year; $current_users[$username]['auto_update'] = $auto_update; $current_users[$username]['student_id'] = $student_id; } $student_data->close(); $c_u = $current_users; // Look up SMS $returned_data = @file_get_contents($sms_api . "&code={$replaced_module}&year=" . $session_parts[0]); $xml = false; if ($returned_data !== false) { $xml = new SimpleXMLElement($returned_data); } if (is_object($xml) and !isset($xml->ErrorMessage) and !isset($xml->Module->ModuleError)) { foreach ($xml->Module->Membership->Student as $sms) { $sms->Title = trim($sms->Title); $sms->Surname = trim($sms->Surname); $sms->Forename = trim($sms->Forename); $sms->CourseCode = trim($sms->CourseCode); $sms->Username = trim($sms->Username); $sms->Email = trim($sms->Email); $sms->Gender = trim($sms->Gender); $sms->YearofStudy = trim($sms->YearofStudy); $sms->StudentID = trim($sms->StudentID); $lookup_username = trim($sms->Username); // Make sure we have a proper username - it can sometimes be blank in SATURN data if ($sms->Email != '') { // Try to extract from email address $un_parts = explode('@', $sms->Email); $lookup_username = $un_parts[0]; } if ($lookup_username != '') { if (isset($current_users[$lookup_username]['delete'])) { $current_users[$lookup_username]['delete'] = 0; // Mark as being legitimate } else { // Student missing from Rogo module $student_data = $mysqli->prepare("SELECT id, yearofstudy, initials, grade, title, surname, first_names, roles, email, COALESCE(sid.student_id,'SID_ERROR') FROM users LEFT JOIN sid ON users.id = sid.userID WHERE username = ? LIMIT 1"); // Do they have a Rogo user record? $student_data->bind_param('s', $lookup_username); $student_data->execute(); $student_data->store_result(); $student_data->bind_result($tmp_userID, $tmp_yearofstudy, $tmp_initials, $tmp_grade, $tmp_title, $tmp_surname, $tmp_first_names, $tmp_roles, $tmp_email, $tmp_student_id); $student_data->fetch(); if ($student_data->num_rows == 0) { // Going to have to create a whole new account for the user $names = explode(' ', $sms->Forename); $initials = ''; foreach ($names as $tmp_name) { $initials .= $tmp_name[0]; } if (!$demomode) { $tmp_userID = UserUtils::create_user($lookup_username, '', $sms->Title, $sms->Forename, $sms->Surname, $sms->Email, $sms->CourseCode, $sms->Gender, $sms->YearofStudy, 'Student', $sms->StudentID, $mysqli); if ($tmp_userID == false) { echo 'ERROR: unable to establish surname for ' . $lookup_username . '<br />'; continue; } } $current_users[$lookup_username]['userID'] = $tmp_userID; $current_users[$lookup_username]['grade'] = $sms->CourseCode; $current_users[$lookup_username]['title'] = $sms->Title; $current_users[$lookup_username]['surname'] = $sms->Surname; $current_users[$lookup_username]['first_names'] = $tmp_first_names; $current_users[$lookup_username]['initials'] = $initials; $current_users[$lookup_username]['roles'] = 'Student'; $current_users[$lookup_username]['email'] = $sms->Email; $current_users[$lookup_username]['year'] = $sms->YearofStudy; $current_users[$lookup_username]['student_id'] = $sms->StudentID; $current_users[$lookup_username]['delete'] = 0; } else { $current_users[$lookup_username]['userID'] = $tmp_userID; $current_users[$lookup_username]['grade'] = $tmp_grade; $current_users[$lookup_username]['title'] = $tmp_title; $current_users[$lookup_username]['surname'] = $tmp_surname; $current_users[$lookup_username]['first_names'] = $tmp_first_names; $current_users[$lookup_username]['initials'] = $tmp_initials; $current_users[$lookup_username]['roles'] = $tmp_roles; $current_users[$lookup_username]['email'] = $tmp_email; $current_users[$lookup_username]['year'] = $tmp_yearofstudy; $current_users[$lookup_username]['student_id'] = $tmp_student_id; $current_users[$lookup_username]['delete'] = 0; } // Add student onto the module $auto_update = 1; //set auto_update to student module association if (!$demomode) { $success = UserUtils::add_student_to_module($tmp_userID, $idMod, 1, $session, $mysqli, $auto_update); } if ($success) { $enrolements++; if ($enrolement_details == '') { $enrolement_details = $lookup_username; } else { $enrolement_details .= ',' . $lookup_username; } } $student_data->close(); } // Check to see if any details of the user account need updating. if (strtoupper(substr($sms->ReasonForLeaving, 0, 3)) == 'W/D') { $new_roles = 'left'; } elseif (stripos($sms->ReasonForLeaving, 'not permitted to progress') !== false) { $new_roles = 'left'; } elseif ($sms->ReasonForLeaving == 'Successfully completed course') { $new_roles = 'graduate'; } else { $new_roles = $current_users[$lookup_username]['roles']; // Keep the roles same as they were. if ($new_roles != 'left' and $new_roles != 'graduate' and strpos($new_roles, 'Student') === false) { $new_roles .= ',Student'; // Add in 'student' role if missing. } } $names = explode(' ', $sms->Forename); $tmp_initials = ''; foreach ($names as $tmp_name) { if (isset($tmp_name[0])) { $tmp_initials .= $tmp_name[0]; } } if ($current_users[$lookup_username]['year'] != $sms->YearofStudy or $tmp_initials != $current_users[$lookup_username]['initials'] or $current_users[$lookup_username]['grade'] != $sms->CourseCode or $current_users[$lookup_username]['title'] != $sms->Title or $current_users[$lookup_username]['surname'] != $sms->Surname or $current_users[$lookup_username]['first_names'] != $sms->Forename or $current_users[$lookup_username]['roles'] != $new_roles or isset($current_users[$lookup_username]['email']) and $current_users[$lookup_username]['email'] != $sms->Email) { $result = $mysqli->prepare("UPDATE users SET yearofstudy = ?, roles = ?, grade = ?, title = ?, surname = ?, first_names = ?, initials = ?, email = ? WHERE username = ?"); $result->bind_param('issssssss', $sms->YearofStudy, $new_roles, $sms->CourseCode, $sms->Title, $sms->Surname, $sms->Forename, $tmp_initials, $sms->Email, $lookup_username); if (!$demomode) { $result->execute(); } $result->close(); } // Check if SID needs updating - rare but could happen if ($current_users[$lookup_username]['student_id'] != $sms->StudentID) { if ($current_users[$lookup_username]['student_id'] == 'SID_ERROR') { $result = $mysqli->prepare("INSERT INTO sid VALUES (?, ?)"); $result->bind_param('si', $sms->StudentID, $current_users[$lookup_username]['userID']); $result->execute(); $result->close(); } else { $result = $mysqli->prepare("UPDATE sid SET student_id = ? WHERE userID = ?"); $result->bind_param('si', $sms->StudentID, $current_users[$lookup_username]['userID']); $result->execute(); $result->close(); } } } else { echo 'ERROR: unable to establish username for ' . $sms->Title . ' ' . $sms->Surname . ', ' . $sms->Forename . ' (' . $sms->StudentID . ')<br />'; } } // Check for any extra students in Rogo but not in SATURN for module foreach ($current_users as $username => $individual_user) { if ($individual_user['delete'] == 1 and $individual_user['auto_update'] == 1) { $result = $mysqli->prepare("DELETE FROM modules_student WHERE id = ?"); // Delete using primary key of 'modules_student' $result->bind_param('i', $individual_user['smID']); if (!$demomode) { $result->execute(); } $result->close(); $deletions++; if ($deletion_details == '') { $deletion_details = $username; } else { $deletion_details .= ',' . $username; } } } } $import_type = ''; if ($enrolements > 0 or $deletions > 0) { if ($sms_api == 'http://saturn-exports.nottingham.ac.uk/touchstone.ashx?campus=malaysia') { $import_type = 'SATURN Malaysia'; } elseif ($sms_api == 'http://saturn-exports.nottingham.ac.uk/touchstone.ashx?campus=china') { $import_type = 'SATURN China'; } else { $import_type = 'SATURN UK'; } $result = $mysqli->prepare("INSERT INTO sms_imports VALUES (NULL, NOW(), ?, ?, ?, ?, ?, ?, ?)"); $result->bind_param('sisisss', $idMod, $enrolements, $enrolement_details, $deletions, $deletion_details, $import_type, $session); $result->execute(); $result->close(); } $this->set_enrolement_no($enrolements, $module); $this->set_deletion_no($deletions, $module); $expdata = array(); if ($demomode) { // Write out to temp $dir = sys_get_temp_dir(); $expdata['status'] = $this->errorinfo; $expdata['students'] = $c_u; $expdata['moduledata'] = $xml; $expdata['studentsa'] = $current_users; file_put_contents($dir . '/' . 'uon-' . $module . '.txt', var_export($expdata, true)); file_put_contents($dir . '/' . 'sum-uon-' . $module . '.txt', "{$enrolements}, {$deletions}\r\n{$import_type}\r\n{$enrolement_details}\r\n{$deletion_details}\r\n"); } }
</td><td><?php echo $configObject->get('cfg_client_lookup'); ?> </td></tr> <tr><td><?php echo $string['interactivequestions']; ?> </td><td><?php echo $configObject->get('cfg_interactive_qs'); ?> </td></tr> <tr><td><?php echo $string['Session']; ?> </td><td><?php echo date_utils::get_current_academic_year(); ?> </td></tr> <tr><td><?php echo $string['ErrorLogSettings']; ?> </td><td><?php echo $ErrorLogSettings; ?> </td></tr> <tr><td colspan="2"> </td></tr> <tr><td colspan="2" class="sechead"><?php echo $string['rogoplugins']; ?> </td></tr>
echo $string['objectivesfile']; ?> </td><td><input type="file" size="50" name="txtfile" /> <input type="hidden" name="module" value="<?php echo $modID; ?> " /></td> </tr> <tr> <?php echo "<td style=\"text-align:right\">" . $string['session'] . "</td><td><select name=\"session\">\n"; $startyear = date('Y') - 1; for ($i = 0; $i < 2; $i++) { $tmp_session = $startyear + $i . '/' . substr($startyear + $i + 1, 2); $sel = $tmp_session == date_utils::get_current_academic_year() ? ' selected="selected"' : ''; echo "<option value=\"{$tmp_session}\"{$sel}>{$tmp_session}</option>\n"; } echo "</select></td>\n"; ?> </tr> <tr><td colspan="2" style="text-align:center"><input type="submit" class="ok" value="<?php echo $string['import']; ?> " name="submit" /><input class="cancel" type="button" value="<?php echo $string['cancel']; ?> " name="cancel" onclick="history.go(-1)" /></td></tr> </form> </div> </td>
$current_year = true; } $row_no++; } $results->close(); if ($current_year == false) { echo "<tr><td colspan=\"4\"><table border=\"0\" style=\"padding-bottom:5px; width:100%; color:#1E3287\"><tr><td><nobr>" . date_utils::get_current_academic_year(); if ($userObject->has_role(array('Admin', 'SysAdmin'))) { echo " <a href=\"#\" onclick=\"editModules('" . date_utils::get_current_academic_year() . "','" . $user_details['grade'] . "'); return false;\"><img src=\"../artwork/pencil_16.png\" width=\"16\" height=\"16\" alt=\"" . $string['editmodules'] . "\" /></a>"; } echo "</nobr></td><td style=\"width:98%\"><hr noshade=\"noshade\" style=\"border:0px; height:1px; color:#E5E5E5; background-color:#E5E5E5; width:100%\" /></td></tr></table></td></tr>\n"; } for ($i = 0; $i < $row_no; $i++) { if ($user_modules[$i]['calendar_year'] != $old_year) { echo "<tr><td colspan=\"4\"><table border=\"0\" style=\"padding-bottom:5px; width:100%; color:#1E3287\"><tr><td><nobr>" . $user_modules[$i]['calendar_year']; if (($user_modules[$i]['calendar_year'] == $most_recent_year or $user_modules[$i]['calendar_year'] == date_utils::get_current_academic_year()) and $userObject->has_role(array('Admin', 'SysAdmin'))) { echo " <a href=\"#\" onclick=\"editModules('" . $user_modules[$i]['calendar_year'] . "','" . $user_details['grade'] . "'); return false;\"><img src=\"../artwork/pencil_16.png\" width=\"16\" height=\"16\" alt=\"" . $string['editmodules'] . "\" /></a>"; } echo "</nobr></td><td style=\"width:98%\"><hr noshade=\"noshade\" style=\"border:0; height:1px; color:#E5E5E5; background-color:#E5E5E5; width:100%\" /></td></tr></table></td></tr>\n"; } echo "<tr><td>"; if ($user_modules[$i]['attempt'] != 1) { echo '<img src="../artwork/resit.png" width="16" height="16" alt="Resit" title="' . $string['resitcandidate'] . '" />'; } echo "</td><td><a href=\"../module/index.php?module={$user_modules[$i]['idMod']}\">{$user_modules[$i]['moduleid']}</a></td><td> <a href=\"../module/index.php?module={$user_modules[$i]['idMod']}\">{$user_modules[$i]['fullname']}</a></td><td>{$user_modules[$i]['calendar_year']}</td></tr>\n"; $old_year = $user_modules[$i]['calendar_year']; } ?> </table> <?php
if ($configObject->get('cfg_sms_api') == '') { log_error(0, 'CRON JOB', 'Application Error', "'cfg_sms_api' setting in config.inc.php is set to blank.", 'users_from_SMS.php', 0, '', null, null, null); exit; } $sms_connection = SmsUtils::GetSmsUtils(); //error_reporting(E_ALL); //ini_set('display_errors',1); $mysqli = DBUtils::get_mysqli_link($configObject->get('cfg_db_host'), $configObject->get('cfg_db_sysadmin_user'), $configObject->get('cfg_db_sysadmin_passwd'), $configObject->get('cfg_db_database'), $configObject->get('cfg_db_charset'), $notice, $configObject->get('dbclass')); $useObject = new UserObject($configObject, $mysqli); // Do not include deleted modules or non-active modules. $module_data = $mysqli->prepare("SELECT modules.id, moduleid, sms, academic_year_start FROM modules WHERE sms != '' AND mod_deleted IS NULL AND active = 1 ORDER BY moduleid"); $module_data->execute(); $module_data->store_result(); $module_data->bind_result($idMod, $module, $sms, $academic_year_start); while ($module_data->fetch()) { $session = date_utils::get_current_academic_year($academic_year_start); $sms_connection->update_module_enrolement($module, $idMod, $sms, $mysqli, $session); } $module_data->close(); $errorinfo = $sms_connection->geterrors(); if (count($errorinfo['usernamematch']) > 0) { log_error(0, 'CRON JOB', 'Application Warning', implode('\\r\\n', $errorinfo['usernamematch']), 'users_from_SMS.php', 0, '', null, $errorinfo['usernamematchdata'], null); } if (count($errorinfo['unabletodetermineusername']) > 0) { log_error(0, 'CRON JOB', 'Application Warning', implode('\\r\\n', $errorinfo['unabletodetermineusername']), 'users_from_SMS.php', 0, '', null, $errorinfo['unabletodetermineusernamedata'], null); } $errorstr = ''; if (count($errorinfo['moduleerrorstate']) > 0) { foreach ($errorinfo['moduleerrorstate'] as $key => $value) { $cnt = count($value); $errorstr .= 'Error state: ' . $key . " <br />\r\n{$cnt} module(s):: ";
* @copyright Copyright (c) 2014 The University of Nottingham * @package */ set_time_limit(0); error_reporting(E_ALL); require '../include/sysadmin_auth.inc'; require_once '../classes/dateutils.class.php'; require_once '../classes/userutils.class.php'; require_once '../classes/smsutils.class.php'; if ($configObject->get('cfg_sms_api') == '') { log_error(0, 'CRON JOB', 'Application Error', "'cfg_sms_api' setting in config.inc.php is set to blank.", 'users_from_SMS.php', 0, '', null, null, null); exit; } $sms_connection = SmsUtils::GetSmsUtils(); // Calculate what the current academic session is. $session = (isset($_GET['session']) and $_GET['session'] != '') ? $_GET['session'] : date_utils::get_current_academic_year(); $session_parts = explode('/', $session); ?> <!DOCTYPE html> <html> <head> <title>Rogō <?php echo $configObject->get('cfg_install_type'); ?> </title> <link rel="stylesheet" type="text/css" href="../css/body.css" /> <link rel="stylesheet" type="text/css" href="../css/header.css" /> <link rel="stylesheet" type="text/css" href="../css/submenu.css" /> <link rel="stylesheet" type="text/css" href="../css/list.css" />
public function get_outcomes($ac_year = 'all', $vle_api_data = null) { $outcomes = array(); $vle_api_cache = array(); // Get the VLE API we're using currently if (is_null($vle_api_data)) { $vle_api_data = MappingUtils::get_vle_api($this->idMod, date_utils::get_current_academic_year(), $vle_api_cache, $this->db); } // Get years for which there are mappings for the current mapping source if ($ac_year == 'all') { $all_years = getYearsForModules($vle_api_data['api'], array($this->idMod => $this->module_id), $this->db); } else { $all_years = array($ac_year); } foreach ($all_years as $ac_year) { $obs = getObjectives(array($this->idMod => $this->module_id), $ac_year, '', '', $this->db); if (is_array($obs) and isset($obs[$this->module_id])) { foreach ($obs[$this->module_id] as $session) { if (isset($session['objectives'])) { foreach ($session['objectives'] as $objective) { if (isset($objective['guid'])) { $uid = $objective['guid']; } elseif (isset($objective['id'])) { $uid = $objective['id']; } else { $uid = ''; } if ($uid != '') { // Build list of IDs but use the latest text $ids = isset($outcomes[$uid]) ? $outcomes[$uid]['ids'] : array(); $ids[] = $objective['id']; $outcomes[$uid] = array('ids' => $ids, 'label' => $objective['content']); } } } } } } if (count($outcomes) > 0) { uasort($outcomes, function ($a, $b) { if ($a['label'] == $b['label']) { return 0; } return $a['label'] < $b['label'] ? -1 : 1; }); } // Filter local mappings to remove duplicates $last_id = -1; $last_text = ''; if ($vle_api_data['api'] == '') { foreach ($outcomes as $id => $outcome) { if ($last_id != -1) { if ($outcome['label'] == $last_text) { $outcomes[$last_id]['ids'][] = $id; unset($outcomes[$id]); } else { $last_id = $id; $last_text = $outcome['label']; } } else { $last_id = $id; } } } return $outcomes; }