<?php
include_once 'includes/processes.php';
$Process = new Login_Process;

$pageLink = basename($_SERVER['REQUEST_URI']);
$Process->check_status($pageLink);

$Process->check_status($pageLink);
$addAccessRole = $Process->addAccessRole($_POST, $_POST['add_role']);
?>
<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
  <title>User Access - APL Portal</title>

  <meta charset="utf-8">
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width">

  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,700italic,400,600,700">
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,300,700">
  <link rel="stylesheet" href="./css/font-awesome.min.css">
  <link rel="stylesheet" href="./js/libs/css/ui-lightness/jquery-ui-1.9.2.custom.min.css">
  <link rel="stylesheet" href="./css/bootstrap.min.css">

  <!-- Plugin CSS -->
  <link rel="stylesheet" href="./js/plugins/icheck/skins/minimal/blue.css">
  <link rel="stylesheet" href="./js/plugins/select2/select2.css">
  <link rel="stylesheet" href="./js/plugins/datepicker/datepicker.css">
  <link rel="stylesheet" href="./js/plugins/simplecolorpicker/jquery.simplecolorpicker.css">
  <link rel="stylesheet" href="./js/plugins/timepicker/bootstrap-timepicker.css">
  <link rel="stylesheet" href="./js/plugins/fileupload/bootstrap-fileupload.css">

  <!-- App CSS -->
  <link rel="stylesheet" href="./css/target-admin.css">
  <link rel="stylesheet" href="./css/custom.css">


  <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
  <![endif]-->
  <script language="JavaScript">
	function toggle(source) {
	  checkboxes = document.getElementsByName('privilege');
	  for each(var checkbox in checkboxes)
		checkbox.checked = source.checked;
	}
</script>
</head>

<body>

<?php include'includes/header.php'; ?>

<div class="container">

  <div class="content">

    <div class="content-container">



      <div class="content-header">
        <h2 class="content-header-title">User Access</h2>
        <ol class="breadcrumb">
          <li><a href="./">Home</a></li>
          <li><a href="access.php">Manage Access</a></li>
          <li class="active">User Access</li>
        </ol>
      </div> <!-- /.content-header -->



      <div class="row">
        <div class="col-md-12">
			<?php echo $addAccessRole; ?>
		</div>
		 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
        <div class="col-md-12">

		 <div class="portlet">

            <div class="portlet-header">

              <h3>
                <i class="fa fa-lock"></i>
                Access Role
              </h3>
            </div> <!-- /.portlet-header -->

            <div class="portlet-content">
				<div class="form-group col-sm-12">
					<label for="item_desc">Access Name</label>
					<input type="text" id="access_name" name="access_name" class="form-control" required />
				</div>
			</div> <!-- /.portlet-content -->

          </div> <!-- /.portlet -->


        </div> <!-- /.col -->

        <div class="col-md-12">
		 <div class="portlet">
            <div class="portlet-header">
              <h3>
                <i class="fa fa-lock"></i>
                Access Modules
              </h3>
            </div> <!-- /.portlet-header -->
            <div class="portlet-content">
				<div class="col-sm-12">
				  <strong>Select Modules</strong>
				  <select id="s2_multi_value" name="modules[]" class="form-control" multiple>
						<?php $Process->listModules(); ?>
				  </select>
				</div> <!-- /.col -->
            </div> <!-- /.portlet-content -->
          </div> <!-- /.portlet -->
        </div> <!-- /.col -->

        <div class="col-md-12">

		 <div class="portlet">

            <div class="portlet-header">

              <h3>
                <i class="fa fa-lock"></i> <input type="checkbox" onClick="toggle(this)">
                Access Privileges
              </h3>
            </div> <!-- /.portlet-header -->

            <div class="portlet-content">
				<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover">
						<tbody>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_tickets"> Create Tickets </label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_tickets"> Read Tickets</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_tickets"> Edit Tickets</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_tickets"> Delete Tickets</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="close_tickets"> Close Tickets</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_requisition"> Create Requisition </label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_requisition"> Read Requisition</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_requisition"> Edit Requisition</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_requisition"> Delete Requisition</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_station"> Create Station</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_station"> Edit Station</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_station"> Delete Station</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_station"> Read Station</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_users"> Create Users</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_users"> Edit Users</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_users"> Delete Users</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_users"> Read Users</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_modules"> Create Modules</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_modules"> Edit Modules</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_modules"> Delete Modules</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_modules"> Read Modules</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_access"> Create Access</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_access"> Edit Access</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_access"> Delete Access</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_access"> Read Access</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="create_store_item"> Create Store Item</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_store_item"> Edit Store Item</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_store_item"> Delete Store Item</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_store_item"> Read Store Item</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="assign_ticket"> Can Assigned Ticket</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="assigned_ticket"> Can be Assigned Ticket</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="close_ticket"> Close Ticket</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="reopen_ticket"> Re-open Ticket</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="user_ticket"> View user Tickets</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="station_ticket"> View Station Tickets</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="all_ticket"> View All Tickets</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="add_pilot"> Can add Pilot</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="read_pilot"> Read Pilot</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="edit_pilot"> Edit Pilot</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="delete_pilot"> Delete Pilot</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="log_case"> Log Case</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="close_case_log">Close Case Log</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="reopen_case_log">Re-open Case Log</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="crc_case_resolver">CRC Case Resolver</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="bd_case_resolver">BD Case Resolver</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="it_case_resolver">IT Case Resolver</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="account_case_resolver">Account Case Resolver</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="view_case">View Case</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="request_user">Request User</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="request_admin">Request Admin</label></td>
							</tr>
							<tr>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="asset_register">Asset Register</label></td>
							  <td><label class="checkbox-inline"><input type="checkbox" name="privilege[]" value="repair_list">Repair List</label></td>
							  <td></td>
							  <td></td>
							  <td></td>
							</tr>
						</tbody>
					</table>
              </div> <!-- /.table-responsive -->


            </div> <!-- /.portlet-content -->

          </div> <!-- /.portlet -->


        </div> <!-- /.col -->

		<div class="col-md-12">
			<button type="submit" name="add_role" class="btn btn-primary">Add Role</button>
        </div> <!-- /.col -->

		</form>

      </div> <!-- /.row -->








    </div> <!-- /.content-container -->

  </div> <!-- /.content -->

</div> <!-- /.container -->
	<?php include"includes/footer.php"; ?>

  <script src="./js/libs/jquery-1.10.1.min.js"></script>
  <script src="./js/libs/jquery-ui-1.9.2.custom.min.js"></script>
  <script src="./js/libs/bootstrap.min.js"></script>

  <!--[if lt IE 9]>
  <script src="./js/libs/excanvas.compiled.js"></script>
  <![endif]-->

  <!-- Plugin JS -->
  <script src="./js/plugins/icheck/jquery.icheck.js"></script>
  <script src="./js/plugins/select2/select2.js"></script>
  <script src="./js/plugins/datepicker/bootstrap-datepicker.js"></script>
  <script src="./js/plugins/timepicker/bootstrap-timepicker.js"></script>
  <script src="./js/plugins/simplecolorpicker/jquery.simplecolorpicker.js"></script>
  <script src="./js/plugins/autosize/jquery.autosize.min.js"></script>
  <script src="./js/plugins/textarea-counter/jquery.textarea-counter.js"></script>
  <script src="./js/plugins/fileupload/bootstrap-fileupload.js"></script>

   <script src="./js/plugins/datatables/jquery.dataTables.min.js"></script>
  <script src="./js/plugins/datatables/DT_bootstrap.js"></script>
  <script src="./js/plugins/tableCheckable/jquery.tableCheckable.js"></script>

  <!-- App JS -->
  <script src="./js/target-admin.js"></script>

  <!-- Plugin JS -->
  <script src="./js/demos/form-extended.js"></script>

</body>
</html>
