<!DOCTYPE html>
<?php
/**
 * @link: http://www.Awcore.com/dev
 */
    //connect to the database
    include "../../../koneksi.php";
    //get the function
    include_once ('function.php');

    	$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
    	$limit = 30;
    	$startpoint = ($page * $limit) - $limit;
        
        //to make pagination
        $statement = "sub_kriteria ";
?>
<html lang="en">
<head>
	<meta charset="utf-8" />
	<title>.:SPK_Potensi Wilayah Bidang Pertanian:.</title>
	<link rel="shortcut icon" type="image/x-icon" href="../css/images/pavicon.png" />
	<link rel="stylesheet" href="../css/style.css" type="text/css" media="all" />
	<link rel="stylesheet" href="../css/tabel.css" type="text/css" media="all" />
	<link rel="stylesheet" href="../css/flexslider.css" type="text/css" media="all" />
	<link href="../../css/pagination.css" rel="stylesheet" type="text/css" />
	<script src="../js/jquery-1.7.2.min.js" type="text/javascript"></script>
	<!--[if lt IE 9]>
		<script src="js/modernizr.custom.js"></script>
	<![endif]-->
	<script src="../js/jquery.flexslider-min.js" type="text/javascript"></script>
	<script src="../js/functions.js" type="text/javascript"></script>
</head>
<body>
	<!-- wrapper -->
	<div  id="wrapper">
		<!-- header -->
		<header>
			<div class="shell">
				<h1 id="logo"><a href="#">Core</a></h1>
				
			</div>	
		</header>
		<!-- end of header -->
		<!-- navigation -->
		<nav id="navigation">
			<div class="shell">
				<ul>
					<li><a href="../tabel_user.php"><span class="bottom-arr"></span>USER</a></li>				
					<li><a href="../kriteria/tabel_kriteria.php"><span class="bottom-arr"></span>KRITERIA</a></li>
					<li><a href="../sub_kriteria/tabel_sub.php"><span class="bottom-arr"></span>SUB KRITERIA</a></li>
					<li><a href="../pemohon/tabel_pemohon.php"><span class="bottom-arr"></span>PEMOHON</a></li>
					<li><a href="../penilaian/penilaian.php"><span class="bottom-arr"></span>PENILAIAN</a></li>
					<li><a href="../penilaian/hasil_akhir.php""><span class="bottom-arr"></span>RANGKING</a></li>
					<li><a href="../../../logout.php"><span class="bottom-arr"></span>LOG OUT</a></li>
					
				</ul>
			</div>	
		</nav>
		<!-- end of navigation -->
		<!-- slider-holder --><!-- end of slider-holder -->
        <!-- services -->
<section class="services">
<table>
<tr><td class="baris-ganjil" colspan="6"><a href="tambah_sub.php"><img src="../add.png" title="tambah Sub Kriteria"></a></td></tr>
</td></tr>
<caption><h3>Tabel SUB Kriteria</h3></caption>
    <tr>
        <th>NO</th>
        <th>Nama Kriteria</th>
		<th>Nama Sub Kriteria</th>
        <th>Bobot</th>
		<th>Pilihan</th>	
    </tr>
	<?php

$query = mysql_query("SELECT * FROM {$statement} LIMIT {$startpoint} , {$limit}");
if(!$query){
	die( mysql_error() );
}
$i=1;
while($row = mysql_fetch_array($query)){
    $clas='baris-ganjil';
    echo "<tr class=$clas>
				  <td >$i</td>
				    <td >".$row['nama_kriteria']."</td>
				  <td >".$row['nama_sub']."</td>
				<td >".$row['bobot']."</td>
				<td class='data'><center>";
			   ?>
			<a href="<?php echo "edit_sub.php?id_kriteria=".$row['id_kriteria']."&id=".$row['id_sub']."";?>"><img src='../mos-css/img/edit.png'></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="<?php echo "../hapus.php?action=hapus_sub&id=".$row['id_sub']."";?>" onClick="return confirm('Apakah anda yakin akan menghapus data ini?')"><img src='../mos-css/img/garbage.png'></a></td>
	<?php
				
				
		echo	"</tr>";
			$i=$i+1;
			if ($clas=='baris-ganjil') 
		     { 
			 $clas='baris-ganjil2';
			 }
		}	
	    echo "</table>";
		echo "<br />";
		echo "<br />";
		echo "<hr />";
		echo pagination($statement,$limit,$page);
	    
			mysql_close();
		
			 
	?>



</section>
		<!-- end of services -->
		<!-- main -->
	  <div class="main"></div>
		<!-- end of main -->
		<div id="footer-push"></div>
	</div>
	<!-- end of wrapper -->
	<div id="footer">
		<div class="shell">
			<p class="copy">Copyright &copy; 2017 FIKOM UNISAN, SAHIJA, SAHIJA</a></p>
			<div class="cl">&nbsp;</div>
		</div>
	</div>
</body>
</html>