예제 #1
0
 static function create_extended_user($username, $title, $forname, $surname, $email, $course, $gender, $year, $role, $sid, $db, $school, $coursedesc, $initials = null, $password = '')
 {
     $courseok = CourseUtils::add_course($school, $course, $coursedesc, $db);
     if ($courseok !== true and $course != '' or $username == '' or $surname == '' or $email == '') {
         return false;
     }
     if (!in_array($role, array('Staff', 'Student', 'SysAdmin', 'Admin', 'graduate', 'left', 'External Examiner'))) {
         // not a valid role
         return false;
     }
     $userid = self::create_user($username, $password, $title, $forname, $surname, $email, $course, $gender, $year, $role, $sid, $db, $initials);
     return $userid;
 }
예제 #2
0
파일: register.php 프로젝트: vinod-co/centa
 for ($a = 0; $a < strlen($_POST['new_grade2']); $a++) {
     $b = substr($_POST['new_grade2'], $a, 1);
     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';
예제 #3
0
                         $schoolID = $school_list[trim($fields[2])];
                     } else {
                         if ($unknown_schoolID == 0) {
                             $result = $mysqli->prepare("SELECT id FROM faculty WHERE name='Administrative and Support Units' LIMIT 1");
                             $result->execute();
                             $result->bind_result($facultyID);
                             $result->fetch();
                             $result->close();
                             $unknown_schoolID = SchoolUtils::add_school($facultyID, '', $mysqli);
                         }
                         $schoolID = $unknown_schoolID;
                     }
                     if (in_array($courseid, $course_list)) {
                         echo "<tr><td></td><td class=\"existing\">{$courseid}</td><td class=\"existing\">{$description}</td><td class=\"existing\">" . $string['alreadyexists'] . "</td></tr>\n";
                     } else {
                         $success = CourseUtils::add_course($schoolID, $courseid, $description, $mysqli);
                         if ($success) {
                             echo "<tr><td><img src=\"../artwork/green_plus_16.png\" wodth=\"16\" height=\"16\" alt=\"Add\" /></td><td class=\"added\">{$courseid}</td><td class=\"added\">{$description}</td><td class=\"added\">" . $string['added'] . "</td></tr>\n";
                             $coursesAdded++;
                         } else {
                             echo "<tr><td><img src=\"../artwork/red_cross_16.png\" wodth=\"16\" height=\"16\" alt=\"Failed\" /></td><td class=\"failed\">{$courseid}</td><td class=\"failed\">{$description}</td><td class=\"failed\">" . $string['failed'] . "</td></tr>\n";
                         }
                     }
                 }
             }
         }
     }
 }
 unlink($configObject->get('cfg_tmpdir') . $userObject->get_user_ID() . "_course_create.csv");
 echo "</table>";
 echo "<div style=\"text-align:center\"><input type=\"button\" name=\"ok\" value=\"" . $string['ok'] . "\" onclick=\"window.location='list_courses.php'\" style=\"width:100px\" /></div>\n<br />\n";