<?php
error_reporting(0);
// The function header by sending raw excel
header("Content-type: application/vnd-ms-excel");
 
// Defines the name of the export file "codelution-export.xls"
header("Content-Disposition: attachment; filename=data-daftar-ulang.xls");
 
// Add data table
	include "php_class/class_mysql.php";
	include "php_class/class_jadwal.php";
	$DataJadwal = new dataJadwal;
	$tahun = $_POST['tahun'];
	$semester = $_POST['semester'];
	$jurusan = $_POST['jurusan'];
	$program = $_POST['program'];
	
	?>
          <table>
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Dosen</th>
                    <th>Mata Kuliah</th>
                    <th>Kelas</th>
                    <th>Hari</th>
                    <th>Waktu</th>
                    <th>Ruang</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataJadwal->get_data_jadwal_filter('',$a,'jumlah', $semester, $tahun, $jurusan, $program);
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $DataJadwal->get_data_jadwal_filter('id',$a,'', $semester, $tahun, $jurusan, $program);
						$dosen = $DataJadwal->get_data_jadwal_filter('dosen', $a, '', $semester, $tahun, $jurusan, $program);
						$matakuliah = $DataJadwal->get_data_jadwal_filter('matakuliah',$a,'', $semester, $tahun, $jurusan, $program);
						$kelas = $DataJadwal->get_data_jadwal_filter('kelas',$a,'', $semester, $tahun, $jurusan, $program);
						$hari = $DataJadwal->get_data_jadwal_filter('hari',$a,'', $semester, $tahun, $jurusan, $program);
						$ruang = $DataJadwal->get_data_jadwal_filter('ruang',$a,'', $semester, $tahun, $jurusan, $program);
						$waktu = $DataJadwal->get_data_jadwal_filter('waktu',$a,'', $semester, $tahun, $jurusan, $program);
						
						echo "<tr id='".$id."' class='odd gradeX'>";
						echo "<td id='".$id."' class='context'>".$id."</td>";
						echo "<td id='".$id."' class='context'>".$dosen."</td>";
						echo "<td id='".$id."' class='context'>".$matakuliah."</td>";
						echo "<td id='".$id."' class='context'>".$kelas."</td>";
						echo "<td id='".$id."' class='context'>".$hari."</td>";
						echo "<td id='".$id."' class='context'>".$waktu."</td>";
						echo "<td id='".$id."' class='context'>".$ruang."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
