<?php
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");
cek_session_admin();
(isset($_GET['pg'])) ? $pg = $_GET['pg'] : $pg = '';
if ($pg == 'setting_rapor') {
$level = $_POST['level'];	
 $data= [
        'tanggal_rapor' => $_POST['tanggal_rapor'],
        'tp' => $_POST['tp'],
        'semester' => $_POST['smt']		
		  ];
$dataM=[
'model_rapor' =>$_POST['rapor'],
'model_kkm' =>$_POST['kkm']
];
$dataR=[
'rapor' =>$_POST['guru']
];		  
		   $exec = update($koneksi, 'aplikasi', $data, ['id_aplikasi' => '1']);
		    $exec = update($koneksi, 'kelas', $dataM, ['level' =>$level]);
			$exec = update($koneksi, 'menu', $dataR, ['id_menu' => '1']);
}
if ($pg == 'ambilkuri') {
    $level = $_POST['level'];
    $sql = mysqli_query($koneksi, "SELECT * FROM kelas WHERE level='" . $level . "' GROUP BY kurikulum");
    echo "<option value=''>--Pilih Kurikulum--</option>";
    while ($data = mysqli_fetch_array($sql)) {
        echo "<option value='$data[kurikulum]'>$data[kurikulum]</option>";
    }
}
if ($pg == 'model') {
    $k = $_POST['kuri'];
    $sql = mysqli_query($koneksi, "SELECT * FROM m_kurikulum WHERE kurikulum='" . $k . "'");
    echo "<option value=''>--Pilih Model Rapor--</option>";
    while ($data = mysqli_fetch_array($sql)) {
        echo "<option value='$data[id]'>$data[rapor]</option>";
    }
}