<?php	
	include "connect.php"; //include file koneksi
	include"indo.php";

?>
<html>
<head>
<title>LIST CMHS</title>
</head>
<body>
<h3><center> DAFTAR CALON MAHASISWA BARU </h3>
<p align="center"><font face="verdana" size="2">
<?

	$entries=20; //nilai awal==jumlah data yang ditampilkan setiap halaman
	
	//************awal paging************//
	$tampil="select * from cmhs"; //input
	$hasil=mysql_query($tampil);
	$total = mysql_num_rows($hasil);//dapatkan jumlah semua data
	
	if ($total>$entries)  //jika jumlah semua data lebih banyak dari nilai awal yang diberikan
	{
		echo "Halaman : ";
		$pages=1;
		while($pages<=ceil($total/$entries))
		{
			if ($pages!=1)
			{
				echo " | ";
			}
		?>
		<!--Membuat link sesuai nama halaman-->
		<a href="tampilcmhs.php?id=<? echo ($pages-1); ?> " style="text-decoration:none"><font size="2" face="verdana" color="#009900"><? echo $pages; ?></font></a>
 
		 <?
				$pages++;
		}
	}else{
		$pages=0;
	}
	
	//**************akhir paging*****************//
	
	?>
	  </font>
	<?
	$page=(int)$_GET['id'];
	$offset=$page*$entries;
	
	//menampilkan data dengan menggunakan limit sesuai parameter paging yang diberikan
	$tampil2="select * from cmhs order by no_cmhs desc limit $offset,$entries";
	$hasil2=mysql_query($tampil2);
	$total2 = mysql_num_rows($hasil2);
	
?>
</p>
<form method="post" action="clulus.php">
<table align="center" width="1197" border="0">
			<tr align="center" bgcolor='#6699FF'>
				<td width="86"><b><font face="verdana" size="2" color="#FFFFFF">No.Peserta</font></b></td>
				<td width="193"><b><font face="verdana" size="2" color="#FFFFFF">Nama</font></b></td>
				<td width="131"><b><font face="verdana" size="2" color="#FFFFFF">Tanggal Lahir</font></b></td>
				<td width="287"><b><font face="verdana" size="2" color="#FFFFFF">Asal Sekolah</font></b></td>
				<td width="117"><b><font face="verdana" size="2" color="#FFFFFF">Prodi</font></b></td>
				<td width="101"><b><font face="verdana" size="2" color="#FFFFFF">TA</font></b></td>
				<td width="28"><b><font face="verdana" size="2" color="#FFFFFF">Ket</font></b></td>
				<td width="192"><b><font face="verdana" size="2" color="#FFFFFF">Aksi</font></b></td>
			    <td width="24"><b><font color="#FFFFFF" size="2" face="verdana">CL</font></b></td>
			</tr>
	<?
	if ($total2){
		while ($row=mysql_fetch_array($hasil2))
		{
		?>
			<tr bgcolor="#D5E9FF">
				<td valign="top"><font face="verdana" size="2"><? echo $row[2]; ?></font></td>
				<td valign="top"><a href="viewcmhs.php?id=<? echo $row[0]; ?> " style="text-decoration:none"><font size="2" face="verdana" color="#009900"><? echo $row[3]; ?></font></a></td>
			    <? $tgl_asli = $row[5];
				$ftgl=TanggalIndo($tgl_asli);
				?>
				<td valign="top"><font face="verdana" size="2"><? echo " $ftgl"; ?></font></td>
			    <td valign="top"><font face="verdana" size="2"><? echo $row[12]; ?></font></td>
				<td valign="top"><div align="center"><font face="verdana" size="2"><? echo $row[15]; ?></font></div></td>
				<td valign="top"><div align="center"><font face="verdana" size="2"><? echo $row[17]; ?></font></div></td>
				<td valign="top" align="center"><font face="verdana" size="2"><? echo $row[18]; ?></font></td>
				<td align="center" valign="top"><font face="verdana" size="2"><a href=formeditcmhs.php?id=<? echo $row[0]; ?>>Edit</a> |
																<a href=cetakktu.php?id=<? echo $row[0]; ?>>Print</a> | 
																<a href=fmhs.php?id=<? echo $row[0]; ?>>Trans</a> |
																<a href=hapuscmhs.php?id=<? echo $row[0]; ?> onClick="return confirm('Yakin data ini akan dihapus...?')">Hapus</a></font></td>
		        <td align="center" valign="top"><input type="checkbox" name="id_daf" value="<? echo $row[0]; ?>"></td>
	          <?	
		} 
	}else{
		?><p align="center"><font color="#FF0000" face="verdana" size="2"><b>Belum ada data!!</b></font></p><?
	}
	?>
		<tr bgcolor="#D5E9FF">
		<td colspan="7" align="center"><font face="verdana" size="2">JUMLAH: <? echo $total; ?></font></td>
		<td colspan="2" align="center"><a href="userspmb.php">Home</a>|<a href="fcmhs.php">Input</a>	<input type="submit" name="Submit" value="Lulus">
		  <input type="reset" name="Reset" value="Reset"></td>
		</tr>

</table> 
</form>
</body>
</html>
