<?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-kuliah.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>Tahun Kuliah</th>
                    <th>Tanggal Wisuda</th>
                    <th>Nomer Ijazah</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataSurat->get_keterangan_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_keterangan_all('id',$a,'');
						$npm = $DataSurat->get_keterangan_all('npm',$a,'');
						$nama = $DataSurat->get_keterangan_all('nama',$a,'');
						$nomer = $DataSurat->get_keterangan_all('nomer',$a,'');
						$tahun = $DataSurat->get_keterangan_all('tahun',$a,'');
						$tanggal = $DataSurat->get_keterangan_all('tanggal',$a,'');
						$ijazah = $DataSurat->get_keterangan_all('ijazah',$a,'');
						
						echo "<tr id='".$id."' class='odd gradeX context'>";
						echo "<td>".$nomer."</td>";
						echo "<td>".$nama."</td>";
						echo "<td>".$npm."</td>";
						echo "<td>".$tahun."</td>";
						echo "<td>".$tanggal."</td>";
						echo "<td>".$ijazah."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
