本文整理汇总了PHP中UserUtils::add_student_to_module方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtils::add_student_to_module方法的具体用法?PHP UserUtils::add_student_to_module怎么用?PHP UserUtils::add_student_to_module使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtils
的用法示例。
在下文中一共展示了UserUtils::add_student_to_module方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
$attempt = trim($fields[3]);
} else {
$attempt = 1;
}
if (isset($module_list[$module])) {
$require_insert = true;
if (isset($students[$sid]['modules'][$module])) {
foreach ($students[$sid]['modules'][$module] as $individual_attempt) {
if ($individual_attempt == $attempt) {
$require_insert = false;
}
}
}
if ($require_insert) {
if (isset($students[$sid]['dbID'])) {
$success = UserUtils::add_student_to_module($students[$sid]['dbID'], $module_list[$module], $attempt, $session, $mysqli);
if ($success) {
$modulesAdded++;
}
} else {
$missing_users[$sid]['module'][] = $module;
}
}
} else {
$unknow_ModuleID[] = $module;
}
}
}
}
unlink($configObject->get('cfg_tmpdir') . $userObject->get_user_ID() . "_cohort_update.csv");
echo "<table>\n";
示例2: add_student_to_module
/**
* 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;
}
示例3: strtoupper
} else {
echo "<div class=\"r1\" id=\"divmod" . $id . "_" . $loop . "\"><input type=\"checkbox\" onclick=\"toggle('divmod" . $id . "_" . $loop . "')\" name=\"mod" . $id . "_" . $loop . "\" id=\"mod" . $id . "_" . $loop . "\" value=\"" . $idMod . "\" /> <label for=\"mod" . $id . "_" . $loop . "\">{$moduleid}: {$fullname}</label></div>\n";
}
$loop++;
$old_letter = strtoupper(substr($moduleid, 0, 1));
}
echo "</div>\n</div>\n";
}
if (isset($_POST['submit'])) {
for ($attempt = 1; $attempt <= 3; $attempt++) {
// Clear the student of all modules.
UserUtils::clear_student_modules_by_userID($_POST['userID'], $_POST['session'], $attempt, $mysqli);
// Insert a record for each module.
for ($i = 0; $i <= $_POST['mod_count']; $i++) {
if (isset($_POST['mod' . $attempt . '_' . $i]) and $_POST['mod' . $attempt . '_' . $i] != '') {
UserUtils::add_student_to_module($_POST['userID'], $_POST['mod' . $attempt . '_' . $i], $attempt, $_POST['session'], $mysqli, 0);
}
}
}
?>
<!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>Rogō: <?php
echo $_POST['session'] . ' ' . $string['modules'];
示例4: update_module_enrolement
//.........这里部分代码省略.........
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];
}
示例5: sprintf
}
$session = date_utils::get_current_academic_year();
$modID = module_utils::get_idMod($module, $mysqli);
// Translate module code into ID
$mod_details = module_utils::get_full_details_by_ID($modID, $mysqli);
if ($mod_details === false) {
$msg = sprintf($string['nomodule'], $module);
display_error('Module ID error', $msg, false, true);
}
if ($mod_details['active'] == 1 and $mod_details['selfenroll'] == 1 and isset($_POST['submit'])) {
if (!$userObject->has_role('Student')) {
// Add role of 'Student' if current user doesn't have it.
UserUtils::add_role('Student', $userObject->get_user_ID(), $mysqli);
}
// Insert new module enrollment
UserUtils::add_student_to_module($userObject->get_user_ID(), $modID, 1, $_POST['session'], $mysqli);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html;charset=<?php
echo $configObject->get('cfg_page_charset');
?>
" />
<title><?php
echo $string['moduleselfenrolment'] . ' ' . $configObject->get('cfg_install_type');
?>
</title>