<?php
session_start();

require_once($_SERVER['DOCUMENT_ROOT'] . "/sys/access.php");

if(!$access->CheckLogin()){
  $access->RedirectToURL("/login/login.php");
  exit;
}

define("PUBLIC_ACCESS", 1);
?>

<!DOCTYPE html>
<html lang="en">

<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Language" content="en-us">
  <title>Control Field</title>
  
  <link rel="stylesheet" href="/ext/bootstrap/bootstrap.min.css">
  <link rel="stylesheet" href="/ext/bootstrap/bootstrap-theme.min.css">
  <link rel="stylesheet" href="/site/css/stickythead.css">
  <link rel="stylesheet" href="/site/css/bootstrap.css">
  <link rel="stylesheet" href="/site/css/slider.css">
  <link rel="stylesheet" href="/site/css/style.css">

  <script src="/ext/jquery/jquery-3.1.1.min.js"></script>
  <script src="/ext/bootstrap/bootstrap.min.js"></script>
  <script src="/ext/jquery/jquery.stickytableheaders.min.js"></script>
  <script src="/site/js/main.js"></script>

<style>

body {
  font-family:'Courier New';
  font-size:16px;
  font-weight:600;
  color:#000;
}

.btn {
    width:160px;    
}

label {
  margin-bottom:0px;
}

.table>td { 
  vertical-align:bottom;    
}

td > * {
  width:100%;
}

select, input {
 height:28px;
 width:100%;
}

input[type=checkbox] {
  height:20px;
  width:20px;
  vertical-align:middle;
}


</style>

</head>
<body>

<?php 

// Include the MVC class definitions
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$toolkit = "$docRoot/toolkit";
require_once ("$toolkit/bitwiseposition.php");
require_once ("$toolkit/contextselector.php");
require_once ("$toolkit/fkeyfield.php");
require_once ("$toolkit/formdatahandler.php");
require_once ("$toolkit/inputtext.php");
require_once ("$toolkit/putbutton.php");
require_once ("$toolkit/selectoption.php");
require_once ("$toolkit/summarytable.php");
require_once ("$toolkit/toggleslider.php");

require_once ("$docRoot/sys/init.php");
require_once ("$docRoot/sys/panel.php");
require_once ("$docRoot/controlfield/model.php");
require_once ("$docRoot/controlfield/view.php");

$reset = 1;
if ($reset) {
$_SESSION['controltype'] = 0;
$_SESSION['menuitem'] = 0;
$_SESSION['controlfield'] = 0;
$_SESSION['controlattr'] = 0;
}

$lo_id = (isset($_SESSION['login'])) ? $_SESSION['login'] : 0;
$en_id = 1;
$ct_id = isset($_SESSION['controltype']) ? $_SESSION['controltype'] : 0;
$mi_id = isset($_SESSION['menuitem']) ? $_SESSION['menuitem'] : 0;
$cf_id = isset($_SESSION['controlfield']) ? $_SESSION['controlfield'] : 0;
$ca_id = isset($_SESSION['controlattr']) ? $_SESSION['controlattr'] : 0;

print_r ("en:$en_id ct:$ct_id mi:$mi_id cf:$cf_id ca:$ca_id");      

// Initialize model
$controlField = new modControlField($lo_id, $en_id, $ct_id, $mi_id, $cf_id, $ca_id);

$controlFieldView = new modControlFieldView($controlField);
echo $controlFieldView->output();

?>

</body>
</html>

