本文整理汇总了PHP中Student::findById方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::findById方法的具体用法?PHP Student::findById怎么用?PHP Student::findById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::findById方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewStudent
public function viewStudent()
{
if (!isset($_GET['id'])) {
$_SESSION['Error'] = "You can't edit students without having an ID.";
} else {
// Load Student
$student = Student::findById($_GET['id']);
$student->loadClassList();
$student->loadContactList();
$student = $student->getValues();
$identity = $student['identity'];
$type = ['label' => 'Student', 'id' => $student['id']];
// Get grades
$grades = [];
foreach (Grade::all() as $i) {
$grades[] = $i->getValues();
}
// Get Schools
$schools = [];
foreach (School::all() as $i) {
$schools[] = $i->getValues();
}
// Get Addresses
$addresses = [];
foreach (Address::findByIdentityId($student['identity']['id']) as $i) {
$addresses[] = $i->getValues();
}
require_once 'views/student/edit.php';
}
}
示例2: home
public function home()
{
$address = Address::findByIdentityId(1);
$schools = School::all(0, 50);
$teachers = Teacher::findBySchoolId(1);
$studentContacts = StudentContact::findByStudentId(1);
$classes = Sclass::findByTeacherId(1);
$student = Student::findById(1);
require_once 'views/identity/home.php';
}
示例3: viewContact
public function viewContact($flag = true)
{
if (!session_id()) {
session_start();
}
$id = false;
if (isset($_SESSION['identityId'])) {
$id = $_SESSION['identityId'];
} else {
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$_SESSION['Error'] = "You can't view student contacts without having an ID.";
}
}
if ($id) {
require_once 'models/student.php';
require_once 'models/studentContact.php';
require_once 'models/identity.php';
require_once 'models/address.php';
require_once 'models/phone.php';
// Get identity of contact
$identity = Identity::findById($id);
$identity = $identity->getValues();
$type = ['label' => 'Contact', 'id' => $id];
// Get addresses belonging to identity
$addresses = [];
foreach (Address::findByIdentityId($id) as $i) {
$addresses[] = $i->getValues();
}
$phoneNumbers = [];
foreach (Phone::findByIdentityId($id) as $i) {
$phoneNumbers[] = $i->getValues();
}
// Load Contact
$students = [];
foreach (StudentContact::findByIdentityId($id)->getValues()['relationships'] as $i) {
$students[] = array('relationship' => $i['type'], 'student' => Student::findById($i['studentID'])->getValues());
}
if ($flag) {
// This individual is a contact for: student identity, relationship type, edit controls
require_once 'views/contact/edit.php';
}
}
}
示例4: header
$application = Application::findById($id);
$application->id_pelajar = (int) $_POST['id_pelajar'];
$application->id_sekolah = (int) $_POST['sekolah'];
$application->id_subjek = (int) $_POST['subjek'];
$application->status = (int) $_POST['status'];
if ($application->update()) {
// $_SESSION['success'] = 'Application updated!';
header('Location: index.php?module=admin');
exit;
} else {
// $_SESSION['error'] = 'Failed to update application!';
}
}
ob_start();
$app = Application::findById($id);
$pelajar = Student::findById($app->id_pelajar);
$sekolahs = School::all();
$subjeks = Subject::ofSchool($app->id_sekolah);
$statuses = Application::statuses();
?>
<div>
<div>
<h1>Kemaskini Permohonan <span class="text-muted">#<?php
echo $id;
?>
</span></h1>
<hr />
</div>
<form action="" class="form-horizontal" method="post" id="application-form">
<input type="hidden" name="id_pelajar" value="<?php
示例5: Application
if (isset($_POST) && !empty($_POST)) {
$application = new Application();
$application->id_pelajar = (int) $_POST['id_pelajar'];
$application->id_sekolah = (int) $_POST['sekolah'];
$application->id_subjek = (int) $_POST['subjek'];
if ($application->submit()) {
$_SESSION['success'] = 'Permohonan Di Hantar!';
header('Location: index.php?module=student');
exit;
} else {
$_SESSION['error'] = 'Permohonan Gagal!';
}
}
ob_start();
$pelajar = Student::findById($_SESSION['id_pelajar']);
$sekolahs = School::senaraiSekolah();
$application = Application::all($_SESSION['id_pelajar'], array('status' => 1));
?>
<div>
<div>
<h1>Permohonan Baru</h1>
<hr />
</div>
<?php
if (count($application) > 0) {
?>
<div class="alert alert-info">
<i class="fa fa-info-circle"></i> Permohonan baru tidak di benarkan kerana permohonan terdahulu anda masih dalam proses semakan.