本文整理汇总了PHP中student类的典型用法代码示例。如果您正苦于以下问题:PHP student类的具体用法?PHP student怎么用?PHP student使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了student类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_student
public function login_student($student_id, $student_password)
{
if (empty($student_id) || empty($student_password)) {
echo "Username or Password is invalid";
return false;
}
$student_id = stripslashes($student_id);
$student_password = stripslashes($student_password);
$student_id = mysql_real_escape_string($student_id);
$student_password = mysql_real_escape_string($student_password);
$student_password = sha1($student_password);
$students_rec = mysql_query("SELECT * FROM " . $this->students_table . " where student_id = {$student_id};");
if (($obj = mysql_fetch_object($students_rec)) != NULL) {
$student = new student($obj->student_id, $obj->user_name, $obj->user_password, $obj->change_password);
if ($student->getUser_password() == $student_password) {
echo "welcome " . $student->getUser_name();
return true;
} else {
echo "Wrong password";
return false;
}
} else {
echo "No such user!";
return false;
}
}
示例2: test_student_save_nouserobject
/**
* Test student save works when $USER object not set
*/
public function test_student_save_nouserobject()
{
global $DB, $USER;
// Create Moodle course category.
$crscat = create_course_category((object) array('name' => 'Test Course category', 'idnumber' => 'MCC-1'));
// Create Moodle course.
$crsdata = array('category' => $crscat->id, 'fullname' => 'MC-TEST-ELIS-8484', 'shortname' => 'MC-TEST-ELIS-8484', 'idnumber' => 'MC-TEST-ELIS-8484');
$mdlcrs = new stdClass();
$mdlcrs->id = $DB->insert_record('course', (object) $crsdata);
$cddata = array('name' => 'CD-ELIS-8484', 'code' => 'CD-ELIS-8484', 'idnumber' => 'CD-ELIS-8484', 'syllabus' => 'syllabus');
$cd = new course($cddata);
$cd->save();
$ci = new pmclass(array('idnumber' => 'CI-ELIS-8484', 'courseid' => $cd->id, 'moodlecourseid' => $mdlcrs->id, 'autocreate' => 0));
$ci->save();
$testuser = new user(array('idnumber' => 'testuserelis8484', 'username' => 'testuserelis8484', 'firstname' => 'Test', 'lastname' => 'User-ELIS8484', 'email' => 'tu8484@noreply.com', 'city' => 'Waterloo', 'country' => 'CA'));
$testuser->save();
$USER = null;
$sturec = new stdClass();
$sturec->userid = $testuser->id;
$sturec->classid = $ci->id;
$sturec->grade = 0;
$sturec->enrolmenttime = time();
$student = new student($sturec);
$student->save();
$this->assertFalse(empty($student));
if (!empty($student)) {
$this->assertFalse(empty($student->id));
}
}
示例3: addteacher
protected function addteacher()
{
global $objPDO;
global $user;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin()) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/subject_teacher_relations.php';
}
}
示例4: create
protected function create()
{
global $objPDO;
global $user;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin()) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/create_section.php';
}
}
示例5: insertion
public function insertion()
{
echo "hello";
if (!is_dir("uploads/")) {
mkdir("uploads/");
}
$dir = "uploads/";
$valuePost = array("firstname" => $_POST['firstname'], "lastname" => $_POST['lastname'], "fathername" => $_POST['fathername'], "dob" => $_POST['dob'], "sex" => $_POST['sex'], "contact" => $_POST['contact'], "email" => $_POST['email'], "secondary" => $_POST['secondary'], "senior" => $_POST['senior'], "fn" => $_FILES['img']['name'], "target" => $dir . basename($_FILES['img']['name']));
$student = new student();
$error = $student->Insertion($valuePost);
return $error;
}
示例6: create_student
private function create_student($row)
{
$obj = new student();
$obj->setstudentId($row["student_Id"]);
$obj->setFirstName($row["FirstName"]);
$obj->setLastName($row["LastName"]);
$obj->setDob(new \DateTime($row["dob"]));
$obj->setGender($row["gender"]);
$obj->setUsername($row["UserName"]);
$obj->setPassword($row["password"]);
$obj->setapproved($row["approved"]);
return $obj;
}
示例7: save_enrolments
/**
* Save a set of enrolments and LO grades to the database
* @param array $enrolments Enrolment data to save
* @param array $grades LO grade data to save
*/
protected function save_enrolments($enrolments, $grades = array())
{
// Enrolments.
foreach ($enrolments as $enrolment) {
$student = new student($enrolment);
$sink = $this->redirectMessages();
$student->save();
}
// LO grades.
foreach ($grades as $grade) {
$studentgrade = new student_grade($grade);
$studentgrade->save();
}
}
示例8: studentsection
protected function studentsection()
{
global $objPDO;
global $user;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin()) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/section_student_relation_view.php';
} else {
if ($student->checkTeacher()) {
} else {
}
}
}
示例9: create_class_enrolment
/**
* Method to create test user class enrolment
* @param int $userid the user DB id
* @param int $classid the class DB id
*/
public function create_class_enrolment($userid, $classid)
{
// Initialize version1elis importplugin for utility functions.
$importplugin = rlip_dataplugin_factory::factory('dhimport_version1elis');
$record = new stdClass();
$record->userid = $userid;
$record->classid = $classid;
$record->completestatusid = 0;
$record->grade = 50;
$record->credits = 1;
$record->locked = 0;
$record->enrolmenttime = $importplugin->parse_date('Jan/10/2013');
$stu = new student($record);
$stu->save();
}
示例10: addparent
protected function addparent()
{
global $user;
global $objPDO;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin() == true && isset($_GET['uid'])) {
global $objPDO;
$studentProfile = new StudentProfile($objPDO);
$studentProfile->loadByUserId($_GET['uid']);
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/addparent.php';
} else {
header('Location:http://localhost/cloud');
}
}
示例11: student_sync_role_set
/**
* When a role is selected from the sync configuration, create class
* enrolments for the specified role assignments.
*/
static function student_sync_role_set()
{
require_once CURMAN_DIRLOCATION . '/lib/student.class.php';
global $CURMAN;
$contextlevel = context_level_base::get_custom_context_level('class', 'block_curr_admin');
// find all class role assignments
$sql = "SELECT ra.id, cu.id AS userid, ctx.instanceid AS classid\n FROM {$CURMAN->db->prefix_table('role_assignments')} ra\n JOIN {$CURMAN->db->prefix_table('user')} mu ON ra.userid = mu.id\n JOIN {$CURMAN->db->prefix_table('crlm_user')} cu ON mu.idnumber = cu.idnumber\n JOIN {$CURMAN->db->prefix_table('context')} ctx ON ctx.id = ra.contextid\n WHERE ctx.contextlevel = {$contextlevel}\n AND ra.roleid = {$CURMAN->config->enrolment_role_sync_student_role}";
$studentswanted = $CURMAN->db->get_records_sql($sql);
$studentswanted = $studentswanted ? $studentswanted : array();
foreach ($studentswanted as $student) {
unset($student->id);
$student = new student($student);
$student->add();
}
return true;
}
示例12: index
protected function index()
{
global $user;
global $objPDO;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin() == true) {
$role = $student->getacctType();
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/temp_page.php';
} else {
if ($student->checkTeacher() == true) {
$role = $student->getacctType();
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/temp_page.php';
} else {
header('Location:http://localhost/cloud');
}
}
}
示例13: index
protected function index()
{
global $objPDO;
global $user;
$student = new student($objPDO, $user->getuserId());
$headMenu = array("username" => $student->getName());
if ($user->checkAdmin()) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/admin.php';
} else {
if ($student->checkTeacher()) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/employee.php';
} else {
if ($student->checkStudent()) {
include $_SERVER['DOCUMENT_ROOT'] . '/cloud/view/student.php';
}
}
}
}
示例14: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$emails = ['mwathibrian7@gmail.com'];
Mail::send('mails.welcome', ['name' => 'Angela Namikoye, Brian Phiri'], function ($message) use($emails) {
$message->to($emails)->from('strath.clearance@gmail.com', 'strath')->subject('This is test email');
});
$user = Auth::user()->regNo;
student::where('studentNo', '=', $user)->update(['state' => 'Activated']);
Session::flash('flash_msg', 'You have initiated the clearance process');
return redirect('/student');
}
示例15: savepass
protected function savepass()
{
$required = array("current" => "Current Password", "new" => "New Password");
foreach ($required as $key => $value) {
if (!isset($_POST[$key]) || $_POST[$key] == '' || $_POST[$key] == 'select') {
echo $value . ' is Required<br/>';
return;
}
}
global $user;
global $objPDO;
$student = new student($objPDO, $user->getuserId());
if (md5($_POST['current']) == $student->getPassword()) {
$student->setPassword(md5($_POST['new']));
$student->save();
} else {
echo 'The Current Password is Wrong';
return;
}
echo '<meta http-equiv="Refresh" content="0;url=http://localhost/cloud/profile"/>';
}