<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=jadwal_sidang.xls");//ganti nama sesuai keperluan
header("Pragma: no-cache");
header("Expires: 0");
?>
<div id="konten">
<div class="cssTable">
	<table border="1">
	<?php if($jenis_cetak=='1') { ?>
		<tr>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm1;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm2;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm3;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm4;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm5;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm6;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm7;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm8;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm9;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm10;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm11;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm12;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm13;?></td>
			</tr>
	<?php } else if ($jenis_cetak=='2') { ?>
		<tr>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm1;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm2;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm3;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm4;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm5;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm6;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm7;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm9;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm10;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm11;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm12;?></td>
				<td style="text-align:center;vertical-align:middle;font-weight:bold"><?php echo $judulForm13;?></td>
			</tr>
	<?php } ?>
	<?php
		if($list_perkara!=''){
			if($list_perkara->num_rows>0){
				$con = 1;
				foreach ($list_perkara->result() as $row) {
		    		$date = new DateTime(str_replace("-","",$row->tanggal_sidang));
		    		if(($row->sidang_keliling=='T')||($row->sidang_keliling=='t')){
		    			$sidang_keliling = "Tidak";
		    		} else if (($row->sidang_keliling=='Y')||($row->sidang_keliling=='y')) {
		    			$sidang_keliling = "Ya";
		    		} else {
		    			$sidang_keliling = "";
		    		}

		    		if(!empty($row->ruangan)){
		    			$ruang_sidang = $row->ruangan;
		    		} else {
		    			$ruang_sidang = "<div style='color:red;'>Ditentukan Kemudian</div>";
		    		}

		    		if($jenis_cetak=='1') { 

						echo "<tr>";
				    		echo "<td style='vertical-align:top'>".$con."</td>";
				    		echo "<td style='vertical-align:top'>".$date->format('d M Y')."</td>";
				    		echo "<td style='vertical-align:top;text-align:center'>".$sidang_keliling."</td>";
				    		echo "<td style='vertical-align:top'>".$ruang_sidang."</td>";
				    		echo "<td style='vertical-align:top'>".$row->nomor_perkara."</td>";
				    		echo "<td style='vertical-align:top'>".$row->agenda."</td>";
				    		echo "<td style='vertical-align:top'>".$row->pihak1_text."</td>";
				    		echo "<td style='vertical-align:top'>".$row->pihak2_text."</td>";
				    		echo "<td style='vertical-align:top'>".$row->majelis_hakim_nama."</td>";
				    		echo "<td style='vertical-align:top'>".$row->panitera_pengganti_text."</td>";
				    		echo "<td style='vertical-align:top'>".$row->keterangan."</td>";
				    		echo "<td></td>";
				    		echo "<td></td>";
			    		echo "</tr>";
			    	} else if ($jenis_cetak=='2') {
			    		echo "<tr>";
			    			echo "<td style='vertical-align:top'>".$con."</td>";
			    			echo "<td style='vertical-align:top'>".$date->format('d M Y')."</td>";
			    			echo "<td style='vertical-align:top;text-align:center'>".$sidang_keliling."</td>";
			    			echo "<td style='vertical-align:top'>".$ruang_sidang."</td>";
			    			echo "<td style='vertical-align:top'>".$row->nomor_perkara."</td>";
			    			echo "<td style='vertical-align:top'>".$row->agenda."</td>";
			    			echo "<td style='vertical-align:top'>".$row->pihak1_text."</td>";
			    			echo "<td style='vertical-align:top'>".$row->majelis_hakim_nama."</td>";
			    			echo "<td style='vertical-align:top'>".$row->panitera_pengganti_text."</td>";
			    			echo "<td style='vertical-align:top'>".$row->keterangan."</td>";
				    		echo "<td></td>";
				    		echo "<td></td>";
		    			echo "</tr>";
			    	}
		    		$con++;
		    	}
			}else{
		    	echo "<tr><td colspan='12' align='center'>Data Tidak diTemukan</td></tr>";
		    }
		}else{
			echo "<tr><td colspan='12' align='center'>Data Tidak diTemukan</td></tr>";
		}
		?>
	</table>
</div>
</div>