<?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-absen-sempek.xls");
 
// Add data table
	include "php_class/class_mysql.php";
	include "php_class/class_semesterpendek.php";
	$datasp2 = new DataSemesterPendek;

			$idmatkul = $_POST['idmatkul'];
			$tahun = $_POST['tahun'];
			$semester = $_POST['semester'];
			$program = $_POST['program'];
			$matkul = $_POST['matkul'];
			$kode = $_POST['kode'];
	?>
                          <table border="1">
                             <thead>
                                <tr>
                                    <th>NPM</th>
                                    <th>Nama Mahasiswa</th>
                                    <th>Kelas</th>
                                    <th>Mata Kuliah</th>
                                    <th>Sandi Mata Kuliah</th>
                                    <th>Nama Dosen</th>
                                    <th>NIP</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php
								$JumlahData = $datasp2->get_temp_bagi('',$a,'jumlah', $program, $tahun, $semester, $idmatkul);
                                if ($JumlahData<=0){
                                    echo "<tr class='odd gradeX'>";
                                    echo "<td>No Data</td>";
                                    echo "<td></td>";
									echo "<td></td>";
                                    echo "</tr>";	
                                }else{
                                    
									for ($a=1;$a<=$JumlahData;$a++){
										$nama = $datasp2->get_temp_bagi('Nama',$a,'', $program, $tahun, $semester, $idmatkul);
                                        $NPM = $datasp2->get_temp_bagi('NPM',$a,'', $program, $tahun, $semester, $idmatkul);
										$kelas = $datasp2->get_temp_bagi('kelas',$a,'', $program, $tahun, $semester, $idmatkul);
										$dosen = $datasp2->get_temp_bagi('dosen',$a,'', $program, $tahun, $semester, $idmatkul);
										$nip = $datasp2->get_temp_bagi('nip',$a,'', $program, $tahun, $semester, $idmatkul);

                                        echo "<tr  class='odd gradeX'>";
										echo "<td>".$NPM."</td>";
										echo "<td>".$nama."</td>";
										echo "<td>".$kelas."</td>";
										echo "<td>".$matkul."</td>";
										echo "<td>".$kode."</td>";
										echo "<td>".$dosen."</td>";
										echo "<td>".$nip."</td>";
                                        echo "</tr>";
                                    }
                                }
                            ?>
                            </tbody>
                          </table>

