	<div class="visWrap">
<?
		if($_GET['user']){
			$l_bc_3 = get_item('select DisplayName from zaposlenik where rbr_users_outer_db = '.$_GET['user']);
		}
?>
		<p>
			<a href="default.php?a=<?=$_GET['a']?>&b=<?=$_GET['b']?>">Dozvole home</a> -> <?=$l_bc_3?>
		</p>
<?
		
		
		
		
		if($_GET['user']){
			$x = get_data('select rbr, ime_tablice as ime from meta_tablica_list order by rbr ', 1);
?>
			<form name="faccess" method="post" action="default.php?access=1">
				<input type="hidden" name="user" value="<?=$_GET['user']?>">
			<table class="tableDozvole" border="0" cellpadding="5" cellspacing="1" bgcolor="#666666" width="700">
			<tr bgcolor="#b1b1b1">
				<td></td>
				<td></td>
				<td colspan="2" align="center"><b>Index forme</b></td>
				<td colspan="2" align="center"><b>Podaci forme</b></td>
			</tr>
			<tr bgcolor="#b1b1b1">
				<td></td>
				<td><b>Tablica</b></td>
				<td align="center"><b>View Data</b></td>
				<td align="center"><b>Delete Data</b></td>
				<td align="center"><b>View Data</b></td>
				<td align="center"><b>Add/Edit Data</b></td>
			</tr>
<?
				$l_cnt = 1;
				for($i = 0; $i < sizeof($x['rbr']); $i++){
					$y = get_data('select rbr, ime from meta_forma where rbr_meta_tablica_list = '.$x['rbr'][$i], 0);
					$z = get_data('select rbr, ime from meta_prikaz where rbr_meta_tablica_list = '.$x['rbr'][$i], 0);
					
					$z2 = get_item('select rbr from meta_subforma where rbr_meta_forma = '.$y['rbr']);
					if($z2){
						continue;
					}
					
					$z3 = get_item('select rbr from meta_subforma_table where rbr_meta_forma = '.$y['rbr']);
					if($z3){
						continue;
					}
					
					$l_sql_start = 'select rbr from access where rbr_zaposlenik = '.$_GET['user'];
					if($z['rbr']){
						$x1 = get_item($l_sql_start.' and rbr_modul_type = 1 and rbr_modul = '.$z['rbr'].' and rbr_access_type = 1 limit 1 ');
						$x2 = get_item($l_sql_start.' and rbr_modul_type = 1 and rbr_modul = '.$z['rbr'].' and rbr_access_type = 2 limit 1 ');
						$l_checked_1 = '';
						$l_checked_2 = '';
						$l_bck_1 = 'style="background:#ffaaaa"';
						$l_bck_2 = 'style="background:#ffaaaa"';
						if(!$x1){
							$l_checked_1 = ' checked ';
							$l_bck_1 = 'style="background:#ddffdd"';
						}
						if(!$x2){
							$l_checked_2 = ' checked ';
							$l_bck_2 = 'style="background:#ddffdd"';
						}
						$l_chk_1 = '<input type="checkbox" name="f_access_1_'.$z['rbr'].'_1" value="1" '.$l_checked_1.'>';
						$l_chk_2 = '<input type="checkbox" name="f_access_1_'.$z['rbr'].'_2" value="1" '.$l_checked_2.'>';
					}else{
						$l_chk_1 = '<input type="checkbox" name="f_access_1_'.$z['rbr'].'_1_none" value="1" disabled="true">';
						$l_chk_2 = '<input type="checkbox" name="f_access_1_'.$z['rbr'].'_2_none" value="1" disabled="true">';
					}
					
					$x3 = get_item($l_sql_start.' and rbr_modul_type = 2 and rbr_modul = '.$y['rbr'].' and rbr_access_type = 1 limit 1 ');
					$x4 = get_item($l_sql_start.' and rbr_modul_type = 2 and rbr_modul = '.$y['rbr'].' and rbr_access_type = 2 limit 1 ');
						
					$l_checked_3 = '';
					$l_checked_4 = '';
					$l_bck_3 = 'style="background:#ffaaaa"';
					$l_bck_4 = 'style="background:#ffaaaa"';
					if(!$x3){
						$l_checked_3 = ' checked ';
						$l_bck_3 = 'style="background:#ddffdd"';
					}
					if(!$x4){
						$l_checked_4 = ' checked ';
						$l_bck_4 = 'style="background:#ddffdd"';
					}
					
?>
					<tr bgcolor="#f1f1f1">
						<td align="right"><?=$l_cnt++?>.</td>
						<td><?=$y['ime']?></td>
						<td align="center" <?=$l_bck_1?>><?=$l_chk_1?></td>
						<td align="center" <?=$l_bck_2?>><?=$l_chk_2?></td>
						<td align="center" <?=$l_bck_3?>><input type="checkbox" name="f_access_2_<?=$y['rbr']?>_1" value="1" <?=$l_checked_3?>></td>
						<td align="center" <?=$l_bck_4?>><input type="checkbox" name="f_access_2_<?=$y['rbr']?>_2" value="1" <?=$l_checked_4?>></td>
					</tr>
<?
				}
?>
			</table>
			<br>
			<center><input type="submit" value="Potvrdi" class="faccess-sbmt"></center>
			<br><br><br><br>
			</form>
<?
		}else{
?>
			<p><b>Odaberite vrstu prikaza</b></p>
			<ul class="jezikMenu">
<?
				$x = get_data('select rbr_users_outer_db as rbr, DisplayName from zaposlenik order by rbr_users_outer_db ', 1);
				for($i = 0; $i < sizeof($x['rbr']); $i++){
?>
					<li><a href="default.php?a=<?=$_GET['a']?>&b=<?=$_GET['b']?>&user=<?=$x['rbr'][$i]?>"><?=$x['DisplayName'][$i]?></a></li>
<?
				}
?>
			</ul>
<?
			
		}
?>