*/ require '../include/sysadmin_auth.inc'; require_once '../include/errors.inc'; require_once '../classes/moduleutils.class.php'; require_once '../classes/logger.class.php'; check_var('moduleid', 'GET', true, false, false); $module = module_utils::get_full_details_by_ID($_GET['moduleid'], $mysqli); if ($module === false) { $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email')); $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true); } $moduleid_in_use = false; if (isset($_POST['submit']) and $_POST['modulecode'] != $_POST['old_modulecode']) { // Check for unique moduleid $new_modulecode = trim($_POST['modulecode']); $moduleid_in_use = module_utils::module_exists($new_modulecode, $mysqli); } if (isset($_POST['submit']) and $moduleid_in_use == false) { if (isset($_POST['active'])) { $module['active'] = 1; } else { $module['active'] = 0; } if (isset($_POST['selfenroll'])) { $module['selfenroll'] = 1; } else { $module['selfenroll'] = 0; } if (isset($_POST['neg_marking'])) { $module['neg_marking'] = 1; } else {
$selfEnroll = 0; if ($v[0] == 'Manual') { $selfEnroll = 1; $peer = 0; $external = 0; $stdset = 0; $mapping = 0; $neg_marking = 1; } $sms_api = $lti_i::sms_api($v); $schoolID = SchoolUtils::get_school_id_by_name($v[3], $mysqli); $modcreate = module_utils::add_modules($v[1], $v[5], 1, $schoolID, '', $sms_api, $selfEnroll, $peer, $external, $stdset, $mapping, $neg_marking, 0, $mysqli, 1, 0, 1, 1, '07/01'); if ($modcreate === false) { $problem = true; } } elseif (!module_utils::module_exists($v[1], $mysqli) and !$lti_i::allow_module_create($v)) { UserNotices::display_notice($string['NoModCreateTitle'], $string['NoModCreate'] . $v[1], '../artwork/exclamation_64.png', '#C00000'); echo "\n</body>\n</html>\n"; exit; } if (!$userObject->is_staff_user_on_module($v[1]) and $lti_i::allow_staff_module_register($v) and $userObject->has_role(array('Staff', 'Admin', 'SysAdmin')) and module_utils::is_allowed_add_team_members_by_name($v[1], $mysqli)) { UserUtils::add_staff_to_module_by_modulecode($userObject->get_user_ID(), $v[1], $mysqli); } elseif (!$userObject->is_staff_user_on_module($v[1]) and !$lti_i::allow_staff_module_register($v)) { UserNotices::display_notice($string['NotAddedToModuleTitle'], $string['NotAddedToModule'] . $v[1], '../artwork/exclamation_64.png', '#C00000'); echo "\n</body>\n</html>\n"; exit; } } $module_store = $lti_i::module_code_translated_store($data); if ($problem === false) { $lti->add_lti_context($module_store);
/** * Creates a new module. * * @param integer $moduleid - The code of the module. * @param string $fullname - The full name of the module. * @param integer $active - Is the module active or inactive. * @param integer $schoolID - Which school the module belongs to. * @param string $vle_api - Which curriculum map or VLE to use for learning objectives. * @param string $sms_api - Which SMS system to link to. * @param integer $selfEnroll - Can students self-enrol in the module. * @param bool $peer - Is Peer Review turned on. * @param bool $external - Is External Examiner turned on. * @param bool $stdset - Is Standard Setting turned on. * @param bool $mapping - Is mapping turned on. * @param integer $neg_marking - Can negative marking be used in questions. * @param string $ebel_grid_template - Which Ebel grid to assign (optional). * @param object $db - MySQLi database connection. * @param integer $sms_import - * @param integer $timed_exams - Are timed summative exams allowed. * @param integer $exam_q_feedback - Is question-based feedback allowed for summative exams. * @param integer $add_team_members - Are team members allowed to add others. * @param integer $map_level - What level to link to in the curriculum map. * @param string $academic_year_start - Day the module changes academic year. * * @return boolean - True if module successfully added. */ public function add_modules($moduleid, $fullname, $active, $schoolID, $vle_api, $sms_api, $selfEnroll, $peer, $external, $stdset, $mapping, $neg_marking, $ebel_grid_template, $db, $sms_import = 0, $timed_exams = 0, $exam_q_feedback = 1, $add_team_members = 1, $map_level = 0, $academic_year_start = '07/01') { // Return false if missing madatory fields. schoolid is actually a number if ($moduleid == '' or $fullname == '' or $schoolID === '') { return false; } // Don't create a duplicate module with the same module ID. if (module_utils::module_exists($moduleid, $db) !== false) { return false; } $checklist = ''; if ($peer == true) { $checklist .= ',peer'; } if ($external == true) { $checklist .= ',external'; } if ($stdset == true) { $checklist .= ',stdset'; } if ($mapping == true) { $checklist .= ',mapping'; } if ($checklist != '') { $tmp_checklist = substr($checklist, 1); } $result = $db->prepare("INSERT INTO modules VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?)"); $result->bind_param('ssisssiiiiiiiis', $moduleid, $fullname, $active, $vle_api, $tmp_checklist, $sms_api, $selfEnroll, $schoolID, $neg_marking, $ebel_grid_template, $timed_exams, $exam_q_feedback, $add_team_members, $map_level, $academic_year_start); $result->execute(); $result->close(); if ($db->errno != 0) { return "failed at insert"; return false; } $idMod = $db->insert_id; if ($sms_import == 1 and $sms_api != '') { $SMS = SmsUtils::GetSmsUtils(); $SMS->update_module_enrolement($moduleid, $idMod, $sms_api, $db); } return $idMod; }
require_once '../classes/moduleutils.class.php'; require_once '../classes/userutils.class.php'; $SMS = SMSutils::GetSmsUtils(); $cfg_sms_sources = array(); if (is_object($SMS)) { $cfg_sms_sources = $SMS->getModuleSources(); } $cfg_sms_sources = array($string['nolookup'] => '') + $cfg_sms_sources; $unique_moduleid = true; $tmp_modulecode = ''; $vle_api = ''; $map_level = 0; if (isset($_POST['submit'])) { // Check for unique moduleID $modulecode = trim($_POST['modulecode']); if (module_utils::module_exists($modulecode, $mysqli)) { $unique_moduleid = false; } } if (isset($_POST['submit']) and $unique_moduleid == true) { if (isset($_POST['active'])) { $active = 1; } else { $active = 0; } if (isset($_POST['selfenroll'])) { $selfenroll = 1; } else { $selfenroll = 0; } if (isset($_POST['neg_marking'])) {
$exam_q_feedback = returnTrueFalse($fields[13]); } else { $exam_q_feedback = 0; } if (isset($fields[14])) { $add_team_members = returnTrueFalse($fields[14]); } else { $add_team_members = 0; } $ebel_grid_template = ''; if (isset($fields[15]) and preg_match('([0-1][0-9]/[0-3][0-9])', $fields[15])) { $academic_year_start = trim($fields[15]); } else { $academic_year_start = $default_academic_year_start; } if (module_utils::module_exists($moduleid, $mysqli)) { $updateData = array(); $checklist = ''; if ($peer == true) { $checklist .= ',peer'; } if ($external == true) { $checklist .= ',external'; } if ($stdset == true) { $checklist .= ',stdset'; } if ($mapping == true) { $checklist .= ',mapping'; } $updateData['checklist'] = substr($checklist, 1);