<?php ob_start();
error_reporting(0);
require("../../config/koneksi.php");
require("../../config/function.php");
require("../../config/crud.php");

session_start();
if (!isset($_SESSION['id_user'])) {
    die('Anda tidak diijinkan mengakses langsung');
}

$idmateri = $_GET['id'];
$materi=fetch($koneksi,'materi',['id_materi' => $idmateri]);
$guru=fetch($koneksi,'users',['id_user' =>$_SESSION['id_user']]);

$bl = date('m');
$bulane = fetch ($koneksi, 'bulan', ['bln' =>$bl]);
?>

<!DOCTYPE html>
<html>

<head>
    <meta charset='utf-8'>

    <title>Nilai_Quiz_<?= $materi['mapel'] ?></title>

   <link rel="stylesheet" href="../../plugins/bootstrap/dist/css/bootstrap.min.css">


</head>
	<body style="font-size: 12px;">
				
		 <center><h3><?= strtoupper($setting['sekolah']) ?></h3></center>
	   <center> Alamat : <?= $setting['alamat']; ?> Kec. <?= $setting['kecamatan']; ?> Kab. <?= $setting['kota']; ?></center>
	  <hr>
     <img src="../../<?= $setting['logo'] ?>" style="margin-left:20px ;margin-top:-130px ;width: 70px;">
			
				
				
   <br>
   <div style="padding-left:20px;margin-right:50px ;" class="col-md-12">
    <table>
	<tbody>
            <tr>
                <td width='100px'>Mata Pelajaran</td>
                <td width='10px'>:</td>
                <td><?= $materi['mapel'] ?></td>
            </tr>
			
               
				<tr>
                <td width='100px'>Semester</td>
                <td width='10px'>:</td>
                <td><?= $setting['semester'] ?></td>
            </tr>
			
			<tr>
                <td width='100px'>Tahun Pelajaran</td>
                <td width='10px'>:</td>
                <td><?= $setting['tp'] ?></td>
            </tr>
			</tbody>
    </table>
	</div>
     <br>
     <table style="font-size: 12px" class="table table-bordered table-sm">
					<thead>
						<tr>
							<th width='5px'>No</th>
							<th>NIS</th>
							<th>Nama</th>
							<th width="5%">Kelas</th>
							<th width="10%">Nilai</th>
							
						</tr>
					</thead>
					<tbody>
	 <?php
	  $query = mysqli_query($koneksi, "select * from nilaiquiz WHERE idmateri='$idmateri'");
      $no = 0;
       while ($nilai = mysqli_fetch_array($query)) {
	   $siswa=fetch($koneksi,'siswa',['id_siswa'=>$nilai['idsiswa']]);
       $no++;
	   
	   
	 ?>
     <tbody>
	<tr>
		<td align='center'><?= $no ?></td>
		<td align='center' width='100px'><?= $siswa[nis]  ?></td>
		<td><?= $siswa[nama]  ?></td>
		<td><?= $siswa[id_kelas]  ?></td>
		<td width='130px'><?= $nilai[nilai]  ?></td>
								
		</tr>
	   <?php } ?>
	 </tbody>
	</table>
	<br/>
	<table border='0' style="margin-left: 50px;margin-right:5px">>
					<tr>
					
						<td>
							Mengetahui, <br/>
							Kepala Sekolah <br/>
							<br/>
							<br/>
							<br/>
							
							<u><?= $setting['kepsek'] ?></u><br/>
							NIP. <?= $setting['nip'] ?>
						</td>
						<td width='400px'></td>
						<td>
							<?= $setting['kecamatan'] ?>, <?php echo date('d'); ?> <?= $bulane['ket'] ?> <?= date('Y') ?><br/>
							Guru Pengampu<br/>
							<br/>
							<br/>
							<br/>
							
							<u><?= $guru['nama'] ?></u><br/>
							NIP. <?= $guru['nip'] ?>
						</td>
					</tr>
				</table>
</body>

</html>
