<?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-keterangan-lulus.xls");
 
// Add data table
	include "php_class/class_mysql.php";
	include "php_class/class_surat.php";
	
	$DataSurat = new DataSurat;
	?>
          <table>
             <thead>
                <tr>
                    <th>Nomer Surat</th>
                    <th>Nama Mahasiswa</th>
                    <th>NPM</th>
                    <th>Judul</th>
                    <th>Hari Ujian</th>
                    <th>Tanggal Ujian</th>
                    <th>Tempat</th>
                    <th>Tanggal Wisuda</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataSurat->get_ket_lulus_all('',$a,'jumlah');
				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++){
						$id = $DataSurat->get_ket_lulus_all('id',$a,'');
						$npm = $DataSurat->get_ket_lulus_all('npm',$a,'');
						$nama = $DataSurat->get_ket_lulus_all('nama',$a,'');
						$nomer = $DataSurat->get_ket_lulus_all('nomer',$a,'');
						$judul = $DataSurat->get_ket_lulus_all('judul',$a,'');
						$judul = str_replace("petik", "'",$judul);
						$hari = $DataSurat->get_ket_lulus_all('hari',$a,'');
						$tanggal = $DataSurat->get_ket_lulus_all('tanggal',$a,'');
						$tempat = $DataSurat->get_ket_lulus_all('tempat',$a,'');
						$tanggalwisuda = $DataSurat->get_ket_lulus_all('tanggalwisuda',$a,'');

						echo "<tr id='".$id."' class='odd gradeX context'>";
						echo "<td>".$nomer."</td>";
						echo "<td>".$nama."</td>";
						echo "<td>".$npm."</td>";
						echo "<td>".$judul."</td>";
						echo "<td>".$hari."</td>";
						echo "<td>".$tanggal."</td>";
						echo "<td>".$tempat."</td>";
						echo "<td>".$tanggalwisuda."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
