本文整理汇总了PHP中Teacher::createTeacherFromId方法的典型用法代码示例。如果您正苦于以下问题:PHP Teacher::createTeacherFromId方法的具体用法?PHP Teacher::createTeacherFromId怎么用?PHP Teacher::createTeacherFromId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teacher
的用法示例。
在下文中一共展示了Teacher::createTeacherFromId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCurrentUser
function updateCurrentUser()
{
$user = $_SESSION['user'];
$sessionUserId = $user->getUserId();
if ($user->getRole() === 'STUDENT') {
$_SESSION['user'] = Student::createStudentFromId($sessionUserId);
} else {
$_SESSION['user'] = Teacher::createTeacherFromId($sessionUserId);
}
}
示例2: infoLog
$desc = "The account for '{$username}' has been locked due to too many login attempts.";
infoLog($desc);
returnToPageError($message, $username);
} else {
unlockUser($userid);
clearFailedLogins($userid);
$user = User::createUserLoginDetails($userid);
}
}
$random_salt = $user->getSalt();
$pwd = hash('sha512', $pwd . $random_salt);
if ($pwd === $user->getPassword()) {
if ($user->getRole() === 'STUDENT') {
$_SESSION['user'] = Student::createStudentFromId($userid);
} else {
$_SESSION['user'] = Teacher::createTeacherFromId($userid);
}
clearFailedLogins($userid);
$_SESSION['timeout'] = time();
$message = "User {$userid} has been successfully logged in.";
if (isset($_SESSION['url']) && isset($_SESSION['urlid']) && $userid == $_SESSION['urlid']) {
$url = $_SESSION['url'];
unset($_SESSION['url']);
unset($_SESSION['urlid']);
} else {
$url = '../portalhome.php';
}
returnToPageSuccess($message, $url);
} else {
//Check when the last failed login was
$lastFailedLogin = strtotime($user->getLastFailedLogin());
示例3: filter_input
$userid = filter_input(INPUT_GET, 'userid', FILTER_SANITIZE_STRING);
$query = "SELECT `Role` FROM TUSERS WHERE `User ID` = {$userid}";
try {
$role = db_select_single_exception($query, 'Role');
} catch (Exception $ex) {
header("Location: ../portalhome.php");
exit;
}
if ($role == 'STUDENT') {
$user = Student::createStudentFromId($userid);
$prefName = $user->getPrefferedName();
$dob = $user->getDateOfBirth();
$hideStaff = 'style="display:none;"';
$hideStudents = '';
} else {
$user = Teacher::createTeacherFromId($userid);
$title = $user->getTitle();
$initials = $user->getInitials();
$classroom = $user->getClassroom();
$number = $user->getPhoneNumber();
$hideStaff = '';
$hideStudents = 'style="display:none;"';
}
$firstName = $user->getFirstName();
$surname = $user->getSurname();
$email = $user->getEmail();
if (isset($_SESSION['message'])) {
$message = $_SESSION['message'];
unset($_SESSION['message']);
}
?>