$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 echo $pelajar->id; ?>
include_once ACTION . '/admin_login.php'; } elseif ($action == 'approve') { include_once ACTION . '/admin_process_application.php'; } elseif ($action == 'reject') { include_once ACTION . '/admin_process_application.php'; } elseif ($action == 'edit-application') { // update application } else { include_once ACTION . '/admin_view_application.php'; } break; case 'subjek': if ($action == 'load') { $sekolah = (int) $_GET['sekolah']; header('Content-type: Application/json'); echo json_encode(Subject::ofSchool($sekolah)); exit; } break; case 'logout': unset($_SESSION['id_pelajar']); unset($_SESSION['id_admin']); header('Location: /'); exit; case 'site': include_once ACTION . "/{$module}" . "_" . $action . ".php"; break; case 'application': if ($action == 'info') { // get application info $app = Application::findById($_GET['id']);
$id = $_GET['id']; ob_start(); $app = Application::findById($id); $pelajar = Student::findById($app->id_pelajar); $bangsa = Student::bangsa(); $sekolahs = array(); array_map(function ($sekolah) { global $sekolahs; $sekolahs[$sekolah['id']] = $sekolah['nama']; }, School::all()); $subjeks = array(); array_map(function ($subjek) { global $subjeks; $subjeks[$subjek['id']] = $subjek['nama']; }, Subject::ofSchool($app->id_sekolah)); $statuses = array(); array_map(function ($status) { global $statuses; $statuses[$status['id']] = $status['nama']; }, Application::statuses()); $programmes = array(); array_map(function ($programme) { global $programmes; return $programmes[$programme['id']] = $programme['nama_panjang']; }, Programme::all()); ?> <div> <table class="table"> <tbody> <tr>