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'; } }
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'; }
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'; } } }
$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
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.