<!DOCTYPE html>
<html>
<head>
	<title>RPP</title>
</head>
<body>
	<style type="text/css">
	body{
		font-family: sans-serif;
	}
	table{
		margin: 20px auto;
		border-collapse: collapse;
	}
	table th,
	table td{
		border: 1px solid #3c3c3c;
		padding: 3px 8px;
 
	}
	a{
		background: blue;
		color: #fff;
		padding: 8px 10px;
		text-decoration: none;
		border-radius: 2px;
	}
	</style>
 
	<?php
	header("Content-type: application/vnd-ms-excel");
	header("Content-Disposition: attachment; filename=Laporan_rpp.xls");
	 include "config.php"; 

    if(isset($_GET['id'])){
	$pilihtapel = $_GET['id'];
	$aa= mysqli_query($mysqli,"SELECT * FROM tapel where Idtapel='$pilihtapel' ");
	$a1= mysqli_fetch_array($aa);
	$namatapel=$a1['nama'];
	$smt=$a1['semester'];
	$kop1="Laporan Rencana Pembelajaran Guru Semester ".$smt;
	$kop2=" Tahun Pelajaran ".$namatapel;
	$namakop=$kop1.$kop2;


	?>
 



	<center>
		<h1><?php echo $namakop ?></h1>
	</center>
 
    <table table-striped border=1>
    <thead>
      <tr bgcolor=#6da66a>
                    <th scope="col">No</th>
					<th scope="col">ID RPP</th>
                    <th scope="col">Nama Guru</th>
                    <th scope="col">Mata Pelajaran</th>
                    <th scope="col">Kelas</th>
                    <th scope="col">Tanggal Kirim</th>
					<th scope="col">Tanggal Verifikasi</th>
					<th scope="col">Catatan</th>
					<th scope="col">Pengawas</th>
					<th scope="col">Status</th>
					<th scope="col">Kalender Akademik</th>
					<th scope="col">Rincian Pekan Efektif</th>
					<th scope="col">Analisis Alokasi Waktu</th>
					<th scope="col">CP / Layanan </th>
					<th scope="col">TP dan ATP </th>
					<th scope="col">Prota </th>
					<th scope="col">Promes </th>
					<th scope="col">KKTP </th>
					<th scope="col">Modul Ajar / RPP </th>
					<th scope="col">Pemetaan CP (KBC & DPL) </th>
					
                  </tr>
                </thead>
                <tbody>
				<?php
				
				$result = mysqli_query($mysqli, "SELECT drpp.Idrpp kodeid,tapel.nama nmtapel,tapel.semester, user.madrasah, user.nama nmguru,mapel.nama nmmapel, kelas.nama nmkelas,drpp.kaldik,drpp.rpe,drpp.alokasiwaktu,drpp.cp,drpp.atp,drpp.prota,drpp.promes, drpp.kktp,drpp.modulrpp,drpp.tglkirim, drpp.tglvalidasi, drpp.catatan,drpp.peta_cp,drpp.catat_pengawas,drpp.validasi FROM drpp,tapel,user,mapel,kelas WHERE drpp.Iduser=user.Iduser AND drpp.Idtapel=tapel.Idtapel AND drpp.Idmapel=mapel.Idmapel AND drpp.Idkelas=kelas.Idkelas AND drpp.Idtapel='$pilihtapel' ORDER BY drpp.Idrpp ASC");
				$counter=0;
				// Fetch the next row of a result set as an associative array
				while ($res = mysqli_fetch_assoc($result)) {
					$counter=$counter+1;
					if ($counter % 2) {
						echo "<tr>";
					} else {
						  echo "<tr bgcolor='#d9d9d9'>";
					 }
					?>
				   <td scope="row">
					<?php
					echo " $counter </td>";
					echo "<td>".$res['kodeid']."</td>";
					echo "<td>".$res['nmguru']."</td>";
					echo "<td>".$res['nmmapel']."</td>";
					echo "<td>".$res['nmkelas']."</td>";
					echo "<td>".$res['tglkirim']."</td>";
					echo "<td>".$res['tglvalidasi']."</td>";
					echo "<td>".$res['catatan']."</td>";
					echo "<td>".$res['catat_pengawas']."</td>";
					echo "<td>".$res['validasi']."</td>";
					echo "<td>".$res['kaldik']."</td>";
					echo "<td>".$res['rpe']."</td>";
					echo "<td>".$res['alokasiwaktu']."</td>";
					echo "<td>".$res['cp']."</td>";
					echo "<td>".$res['atp']."</td>";
					echo "<td>".$res['prota']."</td>";
					echo "<td>".$res['promes']."</td>";
					echo "<td>".$res['kktp']."</td>";
					echo "<td>".$res['modulrpp']."</td>";
					echo "<td>".$res['peta_cp']."</td>";
					echo "</tr>";
					
				
}
?> 
  </tr>
  </tbody>
</table>
<?php
	}
?>
</body>
</html>