當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Student::findById方法代碼示例

本文整理匯總了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';
     }
 }
開發者ID:MatthewAry,項目名稱:php-cs313,代碼行數:30,代碼來源:student_controller.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';
 }
開發者ID:MatthewAry,項目名稱:php-cs313,代碼行數:10,代碼來源:identity_controller.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';
         }
     }
 }
開發者ID:MatthewAry,項目名稱:php-cs313,代碼行數:45,代碼來源:contact_controller.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 
開發者ID:sanusi87,項目名稱:project_one,代碼行數:31,代碼來源:admin_edit_application.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. 
開發者ID:sanusi87,項目名稱:project_one,代碼行數:30,代碼來源:student_submit_application.php


注:本文中的Student::findById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。