<?php
session_start();
if (empty($_SESSION['username'])) {
header("location:../../../login.php"); // jika belum login, maka dikembalikan ke file form_login.php
}
$username=$_SESSION['username'];
$level=$_SESSION['level'];
?>
<!DOCTYPE html>
<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" />
	
	<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>
	<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/highcharts.js" type="text/javascript"></script>
<script type="text/javascript">
	var chart1; // globally available
$(document).ready(function() {
      chart1 = new Highcharts.Chart({
         chart: {
            renderTo: 'container',
            type: 'column'
         },   
         title: {
            text: 'Grafik Penilaian Wilayah '
         },
         xAxis: {
            categories: ['Id Wilayah']
         },
         yAxis: {
            title: {
               text: 'Nilai Wilayah'
            }
         },
              series:             
            [
            <?php 
        	include "../../../koneksi.php";

           $sql   = "SELECT * FROM hasil";
            $query = mysql_query( $sql )  or die(mysql_error());
            while( $ret = mysql_fetch_array( $query ) ){
            	$merek=$ret['id_wilayah'];                     
                 $sql_jumlah   = "SELECT hasil FROM hasil WHERE id_wilayah='$merek'";        
                 $query_jumlah = mysql_query( $sql_jumlah ) or die(mysql_error());
                 while( $data = mysql_fetch_array( $query_jumlah ) ){
                    $jumlah = $data['hasil'];                 
                  }             
                  ?>
                  {
                      name: '<?php echo $merek; ?>',
                      data: [<?php echo $jumlah; ?>]
                  },
                  <?php } ?>
            ]
      });
   });	
</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>
				<?php
				if ($level=='super_admin')
				{
				echo "
				<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='../wilayah/tabel_wilayah.php'><span class='bottom-arr'></span>WILAYAH</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>
					
					";
				}
				else if ($level=='admin')
				{
				echo "
				<li><a href='../wilayah/tabel_wilayah.php'><span class='bottom-arr'></span>WILAYAH</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" align="right"><a href="laporan.php"><img src="printer.png" title="Cetak Hasil Akir"></a><a href="hasil2.php"><img Src="manual.png" title="Solusi Ideal Positif/Negatif"></a></td></tr>
<caption><h3>Hasil Akhir Perangkingan</h3></caption>
    <tr>
        <th>NO</th>
        <th>Id Wilayah</th>
		<th>Nama Wilayah</th>
		<th>Alamat Wilayah Yang Diproses
       	<th>Hasil Akhir</th>

    </tr>
	<?php
include "../../../koneksi.php";

$query = mysql_query("(SELECT * FROM hasil order by hasil desc)");
if(!$query){
	die( mysql_error() );
}
$i=1;
while($row = mysql_fetch_array($query)){
$id_wilayah=$row['id_wilayah'];
$hasil=$row['hasil'];
$query3 = mysql_query("(SELECT * FROM wilayah where id_wilayah='$id_wilayah')");
while($row = mysql_fetch_array($query3)){
$nama_wilayah=$row['nama_wilayah'];
$alamat_wilayah=$row['alamat_wilayah'];
}
    $clas='baris-ganjil';
    echo "<tr class=$clas>
				  <td >$i</td>
				  
				<td >".$id_wilayah."</td>
				<td >".$nama_wilayah."</td>
				<td >".$alamat_wilayah."</td>
				<td >".$hasil."</td>
				
	</tr>";
			$i=$i+1;
		}	
	    echo "</table>";
			mysql_close();
		
			 
	?>





<div id='container'></div>	









</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">
			<div class="shell">
			
			<p class="copy">Copyright &copy; 20117 fikom unisan Reza</a></p>
			<div class="cl">&nbsp;</div>
		</div>
	</div>
</body>
</html>