45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/includes/db_init.php';
|
|
|
|
$db = db();
|
|
$role = $_GET['role'] ?? 'admin';
|
|
$action = $_GET['action'] ?? 'dashboard';
|
|
|
|
// Simple Teacher/Admin access control (just for demo)
|
|
$can_access = in_array($role, ['admin', 'guru']);
|
|
|
|
if (!$can_access) {
|
|
die("Akses ditolak.");
|
|
}
|
|
|
|
$classes = $db->query("SELECT * FROM classes ORDER BY name ASC")->fetchAll();
|
|
?>
|
|
<!doctype html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>Absensi Harian — Dashboard Kelas</title>
|
|
<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="container py-4">
|
|
<nav class="mb-4"><a href="/?role=<?= htmlspecialchars($role) ?>">← Kembali ke Dashboard</a></nav>
|
|
<h1 class="h3 mb-4">Pilih Kelas untuk Absensi</h1>
|
|
<div class="row g-3">
|
|
<?php foreach ($classes as $class): ?>
|
|
<div class="col-md-4">
|
|
<div class="card p-3">
|
|
<h5 class="card-title"><?= htmlspecialchars($class['name']) ?></h5>
|
|
<p class="text-muted">Guru: <?= htmlspecialchars($class['homeroom_teacher'] ?? 'Belum ditentukan') ?></p>
|
|
<a href="attendance_detail.php?class_id=<?= (int)$class['id'] ?>&role=<?= htmlspecialchars($role) ?>" class="btn btn-primary btn-sm">Buka Absensi</a>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|