<?php
// Mencegah error jika variabel module kosong
$module = isset($_GET['module']) ? $_GET['module'] : 'home';

if($module == "home"){
    include "module/home.php";
}

/* ==========================================
   MODUL KHUSUS SISWA (USER LEVEL)
   ========================================== */
elseif($module == "profil_siswa"){
    include "module/siswa/profil.php";
}
elseif($module == "jadwal_siswa"){
    // Diarahkan ke jadwal hari Senin sebagai default
    include "module/jadwal_siswa/siswa_senin.php";
}
elseif($module == "riwayat_absensi"){
    include "module/absensi/riwayat.php";
}

/* ==========================================
   MODUL DATA MASTER SISWA (ADMIN LEVEL)
   ========================================== */
elseif($module == "siswa"){
    include "module/siswa/siswa.php";
}
elseif($module == "tampil"){
    include "module/siswa/tampil.php";
}
elseif($module == "input_siswa"){
    include "module/siswa/input_siswa.php";
}
elseif($module == "siswa_det"){
    include "module/siswa/siswa_det.php";
}
elseif($module == "detail_siswa"){
    include "module/siswa/detail_siswa.php";
}

/* ==========================================
   MODUL ABSEN & LAPORAN
   ========================================== */
elseif($module == "absen"){
    include "module/absen/absen.php";
}
elseif($module == "rekap_s"){
    include "module/laporan/siswa/rekap.php";
}
elseif($module == "rekap_g"){
    include "module/laporan/guru/rekap.php";
}

/* ==========================================
   MODUL USER & GURU
   ========================================== */
elseif($module == "user"){
    include "module/user/user.php";
}
elseif($module == "input_user"){
    include "module/user/input_user.php";
}
elseif($module == "input_guru"){
    include "module/guru/input_guru.php";
}
elseif($module == "detail_guru"){
    include "module/guru/detail_guru.php";
}
elseif($module == "guru_det"){
    include "module/guru/guru_det.php";
}
elseif($module == "jadwal_mengajar"){
    include "module/guru/jadwal_mengajar.php";
}
elseif($module == "guru"){
    include "module/guru/guru.php";
}

/* ==========================================
   MODUL KELAS & SEKOLAH
   ========================================== */
elseif($module == "input_kelas"){
    include "module/kelas/input_kelas.php";
}
elseif($module == "kelas"){
    include "module/kelas/kelas.php";
}
elseif($module == "input_sekolah"){
    include "module/sekolah/input_sekolah.php";
}
elseif($module == "sekolah"){
    include "module/sekolah/sekolah.php";
}

/* ==========================================
   MODUL MATA PELAJARAN
   ========================================== */
elseif($module == "mata_pelajaran"){
    include "module/pelajaran/pelajaran.php";
}
elseif ($_GET['module'] == 'input_mapel') {
    include "module/pelajaran/input_mapel.php";
}

/* ==========================================
   MODUL JADWAL (ADMIN/GURU)
   ========================================== */
elseif($module == "senin"){ include "module/jadwal/senin.php"; }
elseif($module == "selasa"){ include "module/jadwal/selasa.php"; }
elseif($module == "rabu"){ include "module/jadwal/rabu.php"; }
elseif($module == "kamis"){ include "module/jadwal/kamis.php"; }
elseif($module == "jumat"){ include "module/jadwal/jumat.php"; }
elseif($module == "input_jadwal"){
    include "module/jadwal/input_jadwal.php";
}

/* ==========================================
   MODUL JADWAL SISWA (VIEW ONLY)
   ========================================== */
elseif($module == "siswa_senin"){ include "module/jadwal_siswa/siswa_senin.php"; }
elseif($module == "siswa_selasa"){ include "module/jadwal_siswa/siswa_selasa.php"; }
elseif($module == "siswa_rabu"){ include "module/jadwal_siswa/siswa_rabu.php"; }
elseif($module == "siswa_kamis"){ include "module/jadwal_siswa/siswa_kamis.php"; }
elseif($module == "siswa_jumat"){ include "module/jadwal_siswa/siswa_jumat.php"; }

/* ==========================================
   MODUL CETAK
   ========================================== */
elseif ($module == 'cetak_filter') {
    include "cetak_filter.php";
}

// Jika module tidak ditemukan
else {
    include "module/home.php";
}
?>