<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="function/dataTables/media/css/demo_page.css">
<link rel="stylesheet" href="function/dataTables/media/css/demo_table_jui.css">
<link rel="stylesheet" href="function/dataTables/media/themes/smoothness/jquery-ui-1.8.4.custom.css">
<script type="text/javascript" src="function/dataTables/media/js/jquery.js"></script>
<script type="text/javascript" src="function/dataTables/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" language="javascript">
	$(document).ready( function () {
		var oTable = $('#myTables').dataTable( {
			 "sDom": 'R<"H"lfr>t<"F"ip>',
			 "bJQueryUI": true,
			 "sPaginationType": "full_numbers",
			 "iDisplayLength" :10
		});
	});
	function setTrColor(obj, color)
	{
		obj.style.backgroundColor=color;
		obj.onmouseout = function(){
				obj.style.backgroundColor=''; 
		}
	}
	function add_click(){
		form.action ='?page=Proses-User&Act=ADD';
		form.method = 'post';
		form.submit();		
		return true;
	}
	function detail_click(id){
		form.action ='?page=Proses-User&Act=DETAIL&id='+id;
		form.method = 'post';
		form.submit();		
		return true;
	}
	function delete_click(id,code){
		var a = confirm("Apakah anda yakin akan menghapus data?");
		if (a == true){
			form.action ='?page=Proses-User&Act=DELETE&id='+id+'&user='+code;
			form.method = 'post';
			form.submit();		
			return true;
		}	
	}
	function useraccess_click(id){
		form.action ='?page=Proses-User&Act=UACCESS&id='+id;
		form.method = 'post';
		form.submit();		
		return true;
	}
</script>
<form method="post" name="form" enctype="multipart/form-data">
<table width="100%">
	<tr>
		<th colspan="5">DATA USER</th>
	</tr>
	<tr>
		<td colspan="5">&nbsp;</td>		
	</tr>
	<tr>
		<td colspan="5">
			<img src="images/btn_add.png" height="30" width="30" title="Tambah" border="0" style="cursor:pointer" onclick="add_click();" />
		</td>	
	</tr>
</table>
<table id="myTables" class="display" cellpadding="0" cellspacing="0">
	<thead>
	<tr>
		<th>No.</th>
		<!--<th>User Level</th>-->
		<th>User ID</th>
		<th>User Name</th>
		<th>Action</th>
	</tr>
	</thead>
	<tbody>
	<?php		
	  	$no=1;
		$qd = mysql_query("SELECT a.id,a.user_id,a.user_name, b.user_level, b.id idlevel FROM user a 
					 LEFT JOIN user_level b ON b.id=a.user_level
					 WHERE a.user_level<>100 ORDER BY a.id DESC");
		while($dd=mysql_fetch_object($qd)){		
		?> 
		  <tr onmouseover="setTrColor(this, '#FF9900');">
			<td align="center"><?=$no;?>.</td>
			<!--<td align="left"><?=$dd->user_level;?></td>-->
			<td align="left"><?=$dd->user_id;?></td>
			<td align="left"><?=$dd->user_name;?></td>
			<td align="center">
				<img src="images/user_access.png" width="20" height="15" border="0" title="User Access Menu" style="cursor:pointer" onclick="useraccess_click('<?=$dd->id;?>');" />&nbsp;
				<img src="images/btn_edit.png" width="20" height="20" border="0" title="Edit" style="cursor:pointer" onclick="detail_click('<?=$dd->id;?>');" />
			    <img src="images/btn_delete.png" width="20" height="20"  border="0"  title="Hapus" style="cursor:pointer" onclick="delete_click('<?=$dd->id;?>','<?=$dd->user_id;?>');"  />
			</td>
		  </tr>
      <?php $no++; }  ?>	
	</tbody>
</table>
</form>