140 lines
5.6 KiB
PHP
140 lines
5.6 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
@date_default_timezone_set('UTC');
|
|
|
|
require_once __DIR__ . '/includes/db_init.php';
|
|
|
|
$db = db();
|
|
ensure_schema($db);
|
|
seed_classes($db);
|
|
|
|
$roles = ['admin', 'guru', 'orang_tua', 'siswa', 'bendahara'];
|
|
$role = $_GET['role'] ?? 'admin';
|
|
if (!in_array($role, $roles, true)) {
|
|
$role = 'admin';
|
|
}
|
|
|
|
$studentId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
|
$student = null;
|
|
if ($studentId > 0) {
|
|
$stmt = $db->prepare("
|
|
SELECT s.*, c.name AS class_name, c.grade_level, c.homeroom_teacher
|
|
FROM students s
|
|
LEFT JOIN classes c ON c.id = s.class_id
|
|
WHERE s.id = :id
|
|
LIMIT 1
|
|
");
|
|
$stmt->execute([':id' => $studentId]);
|
|
$student = $stmt->fetch();
|
|
}
|
|
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
$projectName = $_SERVER['PROJECT_NAME'] ?? 'School Management System';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= htmlspecialchars($projectName) ?> — Detail Siswa</title>
|
|
<?php if ($projectDescription): ?>
|
|
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time(); ?>">
|
|
</head>
|
|
<body>
|
|
<div class="app-shell">
|
|
<nav class="navbar navbar-expand-lg">
|
|
<div class="container-fluid px-4">
|
|
<a class="navbar-brand" href="index.php?role=<?= urlencode($role) ?>">EduCore CMS</a>
|
|
<div class="ms-auto d-flex gap-2">
|
|
<a class="btn btn-outline-secondary btn-sm" href="students.php?role=<?= urlencode($role) ?>">Kembali ke Data Siswa</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container-fluid px-4 py-4">
|
|
<?php if (!$student): ?>
|
|
<div class="alert alert-warning">Data siswa tidak ditemukan.</div>
|
|
<?php else: ?>
|
|
<div class="row g-3">
|
|
<div class="col-lg-7">
|
|
<div class="card-soft p-3 h-100">
|
|
<div class="section-title">Profil Siswa</div>
|
|
<div class="row g-3">
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Kode Siswa</div>
|
|
<div class="fw-semibold"><?= htmlspecialchars($student['student_code']) ?></div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Status</div>
|
|
<span class="badge text-bg-light border"><?= htmlspecialchars(ucfirst($student['status'])) ?></span>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Nama Lengkap</div>
|
|
<div class="fw-semibold"><?= htmlspecialchars($student['full_name']) ?></div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Jenis Kelamin</div>
|
|
<div><?= htmlspecialchars($student['gender'] ?? '-') ?></div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Kelas</div>
|
|
<div><?= htmlspecialchars($student['class_name'] ?? '-') ?> (<?= htmlspecialchars($student['grade_level'] ?? '-') ?>)</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Wali Kelas</div>
|
|
<div><?= htmlspecialchars($student['homeroom_teacher'] ?? '-') ?></div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Nama Wali</div>
|
|
<div><?= htmlspecialchars($student['guardian_name'] ?? '-') ?></div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="text-muted small">Tanggal Input</div>
|
|
<div><?= htmlspecialchars($student['created_at']) ?></div>
|
|
</div>
|
|
</div>
|
|
<?php if (!empty($student['notes'])): ?>
|
|
<hr>
|
|
<div class="text-muted small mb-1">Catatan</div>
|
|
<div><?= nl2br(htmlspecialchars($student['notes'])) ?></div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<div class="card-soft p-3 h-100">
|
|
<div class="section-title">Aksi Cepat</div>
|
|
<div class="d-grid gap-2">
|
|
<button class="btn btn-outline-secondary" disabled>Tambahkan Absensi</button>
|
|
<button class="btn btn-outline-secondary" disabled>Input Nilai/Ujian</button>
|
|
<button class="btn btn-outline-secondary" disabled>Tagihan Keuangan</button>
|
|
</div>
|
|
<div class="empty-state mt-3">
|
|
Modul lanjutan (absensi, ujian, keuangan) akan ditambahkan pada iterasi berikutnya.
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</main>
|
|
|
|
<footer class="footer text-center">
|
|
© <?= date('Y') ?> EduCore CMS • Detail Siswa
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="assets/js/main.js?v=<?= time(); ?>"></script>
|
|
</body>
|
|
</html>
|