<!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>
<?php include_once "./load_plugin.php"; ?>
<script type="text/javascript" language="javascript">
	function save_click(){
		var a = confirm("Are you sure want to save the data ini?");
		if (a == true){
			form.action ='?page=Proses-User&Act=UASAVE'; 
			form.method = 'post';
			form.submit();		
			return true;
		}
	}
	function close_click(){
		form.action ='?page=Proses-User&Act=CLOSE';
		form.method = 'post';
		form.submit();		
		return true;
	}
	function setTrColor(obj, color){
		obj.style.backgroundColor=color;
		obj.onmouseout = function(){
				obj.style.backgroundColor=''; 
		}
	}
</script>
</head>
<body>
<form name="form" action="#" method="post" enctype="multipart/form-data">
<table width="100%">
	<tr>
		<th colspan="4">DATA USER</th>
	</tr>	
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
		<td width="15%">user ID</td>
		<td width="35%">: <input type="text" name="user_idn" size="27" value="<?php echo $user_idn; ?>" readonly="true"></td>
		<td width="15%">&nbsp;</td>
		<td width="35%">&nbsp;</td>
	</tr>
	<tr>
		<td>User Name</td>
		<td>: <input type="text" name="user_name" size="27" value="<?php echo $user_name; ?>" readonly="true"></td>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td colspan="4">&nbsp;</td>
	</tr>
	<tr>
		<th colspan="4">DETAIL USER ACCESS</th>
	</tr>
	<tr>
		<td colspan="4">
			<table id="datatable" class="table table-bordered" width="100%">
				<thead>
				<tr>
					<th align="center" bgcolor="#CFCFCF">No</th>
					<th align="center" bgcolor="#CFCFCF">Menu</th>
					<th align="center" bgcolor="#CFCFCF">Menu</th>
					<!--<th align="center" bgcolor="#CFCFCF">Add</th>
					<th align="center" bgcolor="#CFCFCF">Edit</th>
					<th align="center" bgcolor="#CFCFCF">Delete</th>-->
				</tr>
				</thead>
				<tbody>
				<?php
				$no=1;
				$query = mysql_query("SELECT * FROM menu_main WHERE mm_hid IN(100,200,300,400,500,600,700,800,900,1000,1100,1200) AND mm_status='Y' ORDER BY mm_hid, mm_sid ASC");
				while($result=mysql_fetch_array($query)){
					$ua = mysql_fetch_array(mysql_query("SELECT * FROM menu_access WHERE ma_mmid='$result[mm_sid]' AND ma_userid='$user_idn' AND ma_status=10"));
					if($ua['ma_uaccess']=="Y"){$cuaccess = "checked='checked'";}else{$cuaccess = "";}
					if($ua['ma_uadd']=="Y"){$cuadd = "checked='checked'";}else{$cuadd = "";}
					if($ua['ma_uedit']=="Y"){$cuedit = "checked='checked'";}else{$cuedit = "";}
					if($ua['ma_udelete']=="Y"){$cudelete = "checked='checked'";}else{$cudelete = "";}
					if($ua['ma_uprint']=="Y"){$cuprint = "checked='checked'";}else{$cuprint = "";}
					if($ua['ma_upost']=="Y"){$cupost = "checked='checked'";}else{$cupost = "";}
					if($ua['ma_uunpost']=="Y"){$cuunpost = "checked='checked'";}else{$cuunpost = "";}
				?>
				<tr onMouseOver="setTrColor(this, '#FF9900');">
					<td align="center"><?=$no;?></td>
					<td><?=$result['mm_group'];?> - <?=$result['mm_name'];?>
						<input type="hidden" name="pilih[<?=$result['mm_sid'];?>]" value="<?=$result['mm_sid'];?>">
						<input type="hidden" name="title[<?=$result['mm_sid'];?>]" value="<?=$result['mm_name'];?>">
					</td>
					<td align="center"><input type="checkbox" name="uaccess[<?=$result['mm_sid'];?>]" <?=$cuaccess;?>></td>
					<!--<td align="center"><input type="checkbox" name="uadd[<?=$result['mm_sid'];?>]" <?=$cuadd;?>></td>
					<td align="center"><input type="checkbox" name="uedit[<?=$result['mm_sid'];?>]" <?=$cuedit;?>></td>
					<td align="center"><input type="checkbox" name="udelete[<?=$result['mm_sid'];?>]" <?=$cudelete;?>></td>-->						
				</tr>
				<?php $no++; } ?>
				</tbody>
			</table>
		</td>
	</tr>    
<table>
	<tr>
		<td>
			<input type="button" name="save" value="SIMPAN" style="cursor:pointer" onClick="save_click();">
			<input type="button" name="close" value="TUTUP" style="cursor:pointer" onClick="close_click();">
		</td>
	</tr>
</table>
</form>
</body>
</html>
