<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script>  

<?php
include('../include/session.php');
date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$access_id = $_GET['user_select'];
$set = $_GET['set'];
$message='';


if (isset($_GET['set_button']) )
	   {
   $page_name = $_GET['page_select'];
   
   	$table_name = $_SESSION['db_prefix']."_users";
	$user_query = "SELECT username, home_page FROM $table_name WHERE access_id = '".$access_id."' ";
	$user_result = mySQL_query($user_query);
	$user_name = mysql_result($user_result, 0, "username");
	
	
   $table_name = $_SESSION['db_prefix']."_permissions";
   $check_query = "SELECT page_name FROM $table_name WHERE access_id = '". $access_id."' AND page_name = '". $page_name."' ";
   $check_result = execsql($check_query);
   $check_num = mysql_num_rows($check_result);
   if ($check_num!=0) {
	   $message= "&nbsp;&nbsp;&nbsp;<img src=../images/exclamation_mark_green_small.png width=24 height=24/><font color=green><b>&nbsp;&nbsp;&nbsp;Permission was allready set.</b></font>";
   }
   else {
   $table_name = $_SESSION['db_prefix']."_permissions";
   $set_query  = "INSERT INTO $table_name (access_id, page_name) VALUES ('" . $access_id . "','" . $page_name . "')";
   execsql($set_query);	
   $message= "&nbsp;&nbsp;&nbsp;<img src=../images/check_mark_green.png width=24 height=24/><font color=green><b>&nbsp;&nbsp;&nbsp;Permission was set.</b></font>";
   }
   $table_name = $_SESSION['db_prefix']."_tracking_admin";
   $trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '7', '".$user_name."' ,'".$page_name."','','' )";
   $trackingResult = mySQL_query($trackingQuery);
}

if (isset($_GET['remove_button']) )
	   {
	$table_name = $_SESSION['db_prefix']."_users";
	$user_query = "SELECT username, home_page FROM $table_name WHERE access_id = '".$access_id."' ";
	$user_result = mySQL_query($user_query);
	$user_name = mysql_result($user_result, 0, "username");	   
		   
	$page_name = $_GET['page_select'];
	$table_name = $_SESSION['db_prefix']."_permissions";
	$del_query = "DELETE FROM $table_name WHERE access_id = '".$access_id."' AND page_name ='".$page_name."'";
	$del_result = execsql($del_query);
    $message= "&nbsp;&nbsp;&nbsp;<img src=../images/x-icon.png width=24 height=24/><font color=green><b>&nbsp;&nbsp;&nbsp;Permission was unset.</b></font>";
	
	$table_name = $_SESSION['db_prefix']."_tracking_admin";
    $trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '8', '".$user_name."' ,'".$page_name."','','' )";
   $trackingResult = mySQL_query($trackingQuery);
}

if (isset($_GET['home_button']) )
	   {
			   
	$access_id = $_GET['user_select'];
    $home_page = $_GET['home_page_group'];
	$table_name = $_SESSION['db_prefix']."_users";
	$user_query = "SELECT username, home_page FROM $table_name WHERE access_id = '".$access_id."' ";
	$user_result = mySQL_query($user_query);
	$user_name = mysql_result($user_result, 0, "username");
	$old_home_page = mysql_result($user_result, 0, "home_page");
	//$page_name = $_GET['permission_select'];
	$table_name = $_SESSION['db_prefix']."_users";
    $page_query = "UPDATE $table_name SET home_page = '". $home_page ."' WHERE access_id = '". $access_id  ."' ";
    $page_result = mySQL_query($page_query);
	
	
	$table_name = $_SESSION['db_prefix']."_tracking_admin";
	$trackingQuery = "INSERT INTO $table_name (entry_date, user_name, action, details_1, details_2, details_3, details_4) VALUES ('".$entry_date."' ,'".$_SESSION['username']."', '6', '".$user_name."' ,'".$old_home_page."','".$home_page."','' )";
	$trackingResult = mySQL_query($trackingQuery);
}
	
if ($set==5) {
$user_id = $_SESSION['username'];
date_default_timezone_set('Africa/Gaborone');
$entry_date = date("Y-m-d H:i:s", time()); 

$table_name = $_SESSION['db_prefix']."_tracking_admin";
$action_query = "INSERT INTO $table_name (entry_date, user_name, action, details) VALUES ('".$entry_date."' ,'".$user_id."','set permissions' ,'set permissions' )";
execsql($action_query);
}

$table_name = $_SESSION['db_prefix']."_users";
$user_query = "SELECT username, home_page FROM $table_name WHERE access_id = '". $access_id."'";
$user_result = execsql($user_query);
$user_num = mysql_num_rows($user_result);
if ($user_num==1) {
$username = mysql_result($user_result, 0, "username");
$home_page = mysql_result($user_result, 0, "home_page");
}
else {
	$username="";
}


$table_name = $_SESSION['db_prefix']."_permissions";
$perm_list_query = "SELECT page_name FROM $table_name WHERE access_id = '". $access_id." ' ";
$perm_list_result = execsql($perm_list_query);
$perm_list_num = mysql_num_rows($perm_list_result);


$table_name = $_SESSION['db_prefix']."_users";
$select_query = "SELECT access_id, username FROM $table_name  ORDER BY username";
	$arrId = array ();
	$arrName = array ();
	$select_result = execsql($select_query);
	$select_num = mysql_num_rows($select_result);
	$a = 0;
	while ($a < $select_num) {
		$arrId[$a] = mysql_result($select_result, $a, "access_id");
		$arrName[$a] = mysql_result($select_result, $a, "username");
		$a++;
	}
	
$table_name = $_SESSION['db_prefix']."_permissions";
$page_query = "SELECT access_id, page_name FROM $table_name WHERE access_id ='".$access_id."' ORDER BY page_name ";
	$arrId2 = array ();
	$arrName2 = array ();
	$page_result = execsql($page_query);
	$page_num = mysql_num_rows($page_result);
	$b = 0;
	while ($b < $page_num) {
		$arrId2[$b] = mysql_result($page_result, $b, "page_name");
		$arrName2[$b] = mysql_result($page_result, $b, "page_name");
		$b++;
	}
?>
</head>



<?php
include ("../navigation/header.php");
$page_name = "AD-permissions";
include ("../navigation/access.php");
if ($permission_num==1) {
	include ("../navigation/admin_sidebar.php");
?>
<body  onload="<?php if ($set==5) { ?> document.getElementById('hidden_frame').style.display = 'none'; <?php } else { ?> document.getElementById('hidden_frame').style.display = 'block'; <?php } ?>" >


<div class="main_frame"  style="height:auto; min-height:570px;">

<div class="page_head_frame">
        <table width="809" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><label class="label_page_head">Set User Permissions for&nbsp;<?php echo $username ?></label></td>
            </tr>
        </table>
      </div>
        <br /><br />
        <div class="page_middle_frame">
<div class="page_inside_frame"><form name="form1" id="form1" action="permissions.php" method="get"> <label class="label_std">Select a user to view and set permissions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  <select name="user_select" class="select160" onchange="window.location.href= this.form.user_select.options[this.form.user_select.selectedIndex].value" >
    <option value=""></option>
    <?php
        	for ($i = 0; $i < count($arrId); $i++) {
    		echo "<option value=permissions.php?user_select=".$arrId[$i]."&set=0>".$arrName[$i]."</option>";
	}
?>
  </select>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("user_select","req","Please select user.");
</script></div>
<br />
<br />

      <div class="hidden_frame" id="hidden_frame">
        <form id="form2" name="form2" method="get" action="permissions.php">
            <div class="page_inside_frame">
              <label style="font-size:16px;">Permissions and home page settings for: <?php echo $username ?></label><br />
</div>  
              
              <div class="page_inside_frame"><label class="label_std"> Set home page:<label>
                <label class="label_std">
                <input name="user_select" type="hidden" id="user_select" value="<?php echo $access_id ?>" />
                <input name="set" type="hidden" id="set" value="3" />
                
                <label class="label_std"><br>
                <input type="radio" name="home_page_group" value="hr" id="home_page_group_2" <?php if ($home_page=="hr") { ?> checked="checked" <?php } ?>/>HR</label>
                <label class="label_std">
                  <input type="radio" name="home_page_group" value="sales" id="home_page_group_4" <?php if ($home_page=="sales") { ?> checked="checked" <?php } ?>/>
                  Sales</label>
                  <label class="label_std">
<input type="radio" name="home_page_group" value="orders" id="home_page_group_0" <?php if ($home_page=="orders") { ?> checked="checked" <?php } ?>/>Orders</label>
                <input type="radio" name="home_page_group" value="maintenance" id="home_page_group_6" <?php if ($home_page=="maintenance") { ?> checked="checked" <?php } ?>/>
                Maintenance
                <label class="label_std"><input type="radio" name="home_page_group" value="stores" id="home_page_group_1" <?php if ($home_page=="stores") { ?> checked="checked" <?php } ?>/>Stores</label>
                <input type="radio" name="home_page_group" value="production" id="home_page_group_5" <?php if ($home_page=="production") { ?> checked="checked" <?php } ?>/>
Production
<input type="radio" name="home_page_group" value="transport" id="home_page_group_7" <?php if ($home_page=="transport") { ?> checked="checked" <?php } ?>/>
                Transport
                <label class="label_std"><input type="radio" name="home_page_group" value="admin" id="home_page_group_3" <?php if ($home_page=="admin") { ?> checked="checked" <?php } ?>/>Admin</label>
                &nbsp;<br>
                <br>
                &nbsp;
                <input name="home_button" type="submit" class="imagebutton" id="home_button" value="Set home page" />
                <br />
                </div>
            </form>
            <div class="page_inside_frame">
            <label class="label_std">To add permissions for this user, select from the list and click 'Set'.</label>
              <form action="permissions.php" name="set_form" method="get">
                  <table width="600" height="424" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="283" height="68" valign="top"><label class="label_std"><br />
                        <br />
                        Permissions for: <span class="label_page_head"><?php echo $username ?></span></label></td>
                      <td width="277" rowspan="4" valign="top"><select name="page_select" size="30" class="selectbox160" id="page_select"  style="color:#FF0000; width:250px;" onmouseover="MM_showHideLayers('message','','hide')">
                        <option disabled="disabled" style="font-weight:700; color:#000">Admin</option>
                        <option <?php if (in_array("AD-user list", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-user list">User list (main page)</option>
                        <option <?php if (in_array("AD-new user", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-new user">New user</option>
                        <option <?php if (in_array("AD-remove user", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-remove user">Remove user</option>
                        <option <?php if (in_array("AD-reset password", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-reset password">Reset password</option>
                        <option <?php if (in_array("AD-permissions", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-permissions">Set permissions</option>   
                        <option <?php if (in_array("AD-pre defined", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-pre defined">Pre defined lists</option>
                        <option <?php if (in_array("AD-presets", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-presets">Presets</option>
                        <option <?php if (in_array("AD-tracking", $arrName2)) {?> style="color:#009900;" <?php }?> value="AD-tracking">Tracking</option>
                        
                                                
                        <option disabled="disabled" style="font-weight:700; color:#000">HR</option>
                        <option <?php if (in_array("HR-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-main">Main</option>
                       <option <?php if (in_array("HR-new employee", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-new employee">New employee</option>
                       <option <?php if (in_array("HR-edit employee", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-edit employee">Edit employee</option>
                       <option <?php if (in_array("HR-overtime", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-overtime">Overtime</option>
                       <option <?php if (in_array("HR-leave", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-leave">Leave</option>
                       <option <?php if (in_array("HR-discipline", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-discipline">Discipline</option>
                       <option <?php if (in_array("HR-pettycash", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-pettycash">Petty cash</option>
                       <option <?php if (in_array("HR-loans", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-loans">Loans</option>
                       <option <?php if (in_array("HR-severance", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-severance">Severance</option>
                       <option <?php if (in_array("HR-time recording", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-time recording">Time recording </option>
                      <!--  <option <?php if (in_array("HR-timekeeping-2", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-timekeeping-2">Delayed time recording</option>
                        <option <?php if (in_array("HR-overtime", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-overtime">Overtime recording</option>
                        
                        
                        <option <?php if (in_array("HR-employee", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-employee">Employee list</option>-->
                        <option <?php if (in_array("HR-wages", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-wages">View wages</option>
                        <option <?php if (in_array("HR-management", $arrName2)) {?> style="color:#009900;" <?php }?> value="HR-management">View management</option>
                        
                                                
                        <option disabled="disabled" style="font-weight:700; color:#000">Orders</option>
                        <option <?php if (in_array("Orders-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-main">Main page</option>
                        <option <?php if (in_array("Orders-compile", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-compile">Compile job card</option>
                        <option <?php if (in_array("Orders-deliver", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-deliver">Deliver/install</option>
                        <option <?php if (in_array("Orders-inspect", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-inspect">Inspection report</option>
                        <option <?php if (in_array("Orders-invoice", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-invoice">Invoice</option>
                        <option <?php if (in_array("Orders-complete", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-complete">Complete order</option>
                        <option <?php if (in_array("Orders-survey", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-survey">Survey</option>
                        <option <?php if (in_array("Orders-costing", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-costing">Costing</option>
                        <option <?php if (in_array("Orders-edit job card", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-edit job card">Edit job card</option>
                        <option <?php if (in_array("Orders-void job card", $arrName2)) {?> style="color:#009900;" <?php }?> value="Orders-void job card">Void job card</option>
                        
                        <option disabled="disabled" style="font-weight:700; color:#000">Sales</option>
                        <option <?php if (in_array("Sales-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="Sales-main">Main page</option>
                        <option <?php if (in_array("Customer-edit", $arrName2)) {?> style="color:#009900;" <?php }?> value="Customer-edit">Customer edit</option>
                        <option <?php if (in_array("Quote-enquiry", $arrName2)) {?> style="color:#009900;" <?php }?> value="Quote-enquiry">Quote enquiry</option>
                        <option <?php if (in_array("Quote-capture", $arrName2)) {?> style="color:#009900;" <?php }?> value="Quote-capture">Quote capture</option>
                        <option <?php if (in_array("Quote-status", $arrName2)) {?> style="color:#009900;" <?php }?> value="Quote-status">Quote status</option>
                        <option <?php if (in_array("Sales-bill of quantity", $arrName2)) {?> style="color:#009900;" <?php }?> value="Sales-bill of quantity">Bill of quantity</option>
                        <option <?php if (in_array("Quote-edit", $arrName2)) {?> style="color:#009900;" <?php }?> value="Quote-edit">Quote edit</option>
                         <option <?php if (in_array("Enquiry-edit", $arrName2)) {?> style="color:#009900;" <?php }?> value="Enquiry-edit">Enquiry edit</option>
                        <!--
                        <option <?php if (in_array("Capture-job", $arrName2)) {?> style="color:#009900;" <?php }?> value="Capture-job">Capture job</option>     
                        <option <?php if (in_array("Create-job", $arrName2)) {?> style="color:#009900;" <?php }?> value="Create-job">Create job</option>-->
                        
                        <option disabled="disabled" style="font-weight:700; color:#000">Maintenance</option>
                        <option <?php if (in_array("Maintenance-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-main">Main page</option>
                        <option <?php if (in_array("Maintenance-enquiry", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-enquiry">Enquiry</option>
                        <option <?php if (in_array("Maintenance-quotation", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-quotation">Quotation</option>
                        <option <?php if (in_array("Maintenance-edit quote", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-edit quote">Edit quotation</option>
                        
                        <option <?php if (in_array("Maintenance-accept", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-accept">Accept</option>
                        <option <?php if (in_array("Maintenance-invoice", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-invoice">Invoice</option>
                        <option <?php if (in_array("Maintenance-compile", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-compile">Open maintenance card</option>
                        <option <?php if (in_array("Maintenance-close", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-close">Close maintenance card</option>
                        <option <?php if (in_array("Maintenance-complete", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-complete">Complete maintenance card</option>
                       <option <?php if (in_array("Maintenance-survey", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-survey">Survey</option>
                        <option <?php if (in_array("Maintenance-contract", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-contract">Contracts</option>
                        <option <?php if (in_array("Maintenance-schedule", $arrName2)) {?> style="color:#009900;" <?php }?> value="Maintenance-schedule">Schedule</option>
                        
                        
                        <option disabled="disabled" style="font-weight:700; color:#000">Stores</option>
                        <option <?php if (in_array("Stores-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-main">Main page</option>
                        <option <?php if (in_array("Stores-new item", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-new item">New store item</option>
                        <option <?php if (in_array("Stores-receive", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-receive">Receive</option>
                        <option <?php if (in_array("Stores-special", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-special">Special orders</option>
                        <option <?php if (in_array("Stores-purchase", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-purchase">Purchase orders</option>
                        <option <?php if (in_array("Stores-authorise purchase", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-authorise purchase">Authorise purchase order</option>
                        <option <?php if (in_array("Stores-status purchase", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-status purchase">Status purchase orders</option>
                        <option <?php if (in_array("Stores-edit purchase", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-edit purchase">Edit purchase order</option>
                        <option <?php if (in_array("Stores-edit receive", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-edit receive">Edit receive note</option>
                        <option <?php if (in_array("Stores-registration", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-registration">Registration</option>
                        <option <?php if (in_array("Stores-supply employee", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-supply employee">Supply employee</option>
                        <option <?php if (in_array("Stores-supply order", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-supply order">Supply order</option>
                        <option <?php if (in_array("Stores-supply order add", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-supply order add">Supply order additional</option>
                        <option <?php if (in_array("Stores-return order", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-return order">Return order</option>
                        <option <?php if (in_array("Stores-maintenance additional", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-maintenance additional">Supply maintenance additional</option>
                        <option <?php if (in_array("Stores-return maintenance", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-return maintenance">Return maintenance</option>
                        
                        <option <?php if (in_array("Stores-supply m-order", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-supply m-order">Supply M-works order</option>
                        <option <?php if (in_array("Stores-supply m-order add", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-supply m-order add">Supply M-works order additional</option>
                       <option <?php if (in_array("Stores-return M-works order", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-return M-works order">Return M-works order</option>
                        <option <?php if (in_array("Stores-direct", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-direct">Direct delivery</option>
                        <option <?php if (in_array("Stores-supplier", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-supplier">New supplier</option>
                        <option <?php if (in_array("Stores-stock take", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-stock take">Stock take</option>
                        <option <?php if (in_array("Stores-stock adjust", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-stock adjust">Stock adjust (Stock take required)</option>
                        <option <?php if (in_array("Stores-edit", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-edit">Editing</option>
                        <!--<option <?php if (in_array("Stores-print-copy", $arrName2)) {?> style="color:#009900;" <?php }?> value="Stores-print-copy">Print copy</option>-->
                        
                        <option disabled="disabled" style="font-weight:700; color:#000">Production</option>
                        <option <?php if (in_array("Production-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-main">Main page</option>
                        <option <?php if (in_array("Production-compile", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-compile">Compile job card</option>
                        <option <?php if (in_array("Production-produce", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-produce">Produce</option>
                        <option <?php if (in_array("Production-deliver", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-deliver">Deliver</option>
                        <option <?php if (in_array("Production-invoice", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-invoice">Invoice</option>
                        <option <?php if (in_array("Production-complete", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-complete">Complete order</option>
                        <option <?php if (in_array("Production-new job", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-new job">New order</option>
                        <option <?php if (in_array("Production-edit job card", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-edit job card">Edit production job card</option>
                        <option <?php if (in_array("Production-void job card", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-void job card">Void production job card</option>
                        <option <?php if (in_array("Production-costing", $arrName2)) {?> style="color:#009900;" <?php }?> value="Production-costing">Costing</option>
                        
                        <option disabled="disabled" style="font-weight:700; color:#000">Transport</option>
                        <option <?php if (in_array("Transport-main", $arrName2)) {?> style="color:#009900;" <?php }?> value="Transport-main">Main</option>
                        <option <?php if (in_array("Transport-new vehicle", $arrName2)) {?> style="color:#009900;" <?php }?> value="Transport-new vehicle">New vehicle</option>
                        <option <?php if (in_array("Transport-edit vehicle", $arrName2)) {?> style="color:#009900;" <?php }?> value="Transport-edit vehicle">Edit vehicle</option>
                        <option <?php if (in_array("Transport-fuel", $arrName2)) {?> style="color:#009900;" <?php }?> value="Transport-fuel">Fuel recording</option>
                        <option <?php if (in_array("Transport-service", $arrName2)) {?> style="color:#009900;" <?php }?> value="Transport-service">Service recording</option>
                        <option <?php if (in_array("Transport-admin", $arrName2)) {?> style="color:#009900;" <?php }?> value="Transport-admin">Fuel admin</option>
                        
                        
                        
                        </select></td>
                      </tr>
                    <tr valign="top">
                      <td height="30" align="center"><p>
                        <input name="set_button" type="submit" class="imagebutton" id="set_button" value="Set" />
                        </p>
                        <p>
                          <input name="remove_button" type="submit" class="imagebutton" id="remove_button" value="Unset" />
                          </p></td>
                      </tr>
                    <tr valign="top">
                      <td align="center"><div id="message"><?php echo $message ?></div></td>
                      </tr>
                    <tr valign="top">
                      <td align="center"><br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br />
                        <br /></td>
                    </tr>
                    </table>
                  <br />
                  
                  
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                  <input name="user_select" type="hidden" id="user_select" value="<?php echo $access_id ?>" />
                  <input name="set" type="hidden" id="set" value="" />
                  </form>
                <script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("set_form");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("page_select","req","Please select permission to set.");
</script>
</div>
</div>
</div>
</div>

</body>

<?php include ('../navigation/side_bar.php'); ?>

<?php } else {
    $_SESSION['denied_return'] = "admin_module/user_list.php";	
    include ("../navigation/admin_sidebar.php");?>
	<body onLoad="needToConfirm = false; accessdenied(); return false">
    <?php include ('../navigation/side_bar.php'); ?>	
	</body>
<?php }
?>


</html>