<?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-Language" content="en-us">
  <title>Journal</title>
  <meta charset="utf-8">

  <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/multiselect.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>
  button#putweather {
    width:80px;
    margin-top:20px;
  }
  button#putdailyjournal.btn {
    width:80px;
    margin-top:27px;
  }
  .btn {
    width:80px;
  }
  
  body {
    font-size:16px;
    font-weight:500;
    color:#000;
  }  
  
  td > * {
  width: 100%;
  }

  div > * {
    width: 100%;
  }

</style>  


</head>
<body>

<?php 

// Die check contstant for indirectly accessed php  
define("PUBLIC_ACCESS", 1);

date_default_timezone_set("Canada/Eastern");

// Location of class definitions
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$toolkit = "$docRoot/toolkit";

// Class object definitions for the UI Controls used
require_once ("$toolkit/inputtext.php");
require_once ("$toolkit/selectlist.php");
require_once ("$toolkit/selecthourmin.php");
require_once ("$toolkit/inputhidden.php");
require_once ("$toolkit/selecthourmin.php");
require_once ("$toolkit/selecthourmin.php");
require_once ("$toolkit/notetext.php");
require_once ("$toolkit/putbutton.php");
require_once ("$toolkit/putrequest.php");
require_once ("$toolkit/summdetail.php");


// Class definitions for the Controls instantiator and Menu generator 
require_once ("$docRoot/sys/init.php");
require_once ("$docRoot/sys/menu.php");

// Model and view class object definitions for the module
require_once ("$docRoot/dailyjournal/model.php");
require_once ("$docRoot/dailyjournal/view.php");

if (isset($_SESSION['projectworkday'])) 
  $pw_id = $_SESSION['projectworkday'];
else
  $pw_id = 0;
if (isset($_SESSION['loginworkday'])) 
  $lw_id = $_SESSION['loginworkday'];
else
  $lw_id = 0;
if (isset($_SESSION['workday'])) 
  $wo_id = $_SESSION['workday'];
else
  $wo_id = 0;
print_r ("pw:$pw_id lw:$lw_id wo:$wo_id");

// Instantiate the model and view
$dailyJournal = new modDailyJournal($lw_id);
$dailyJournalView = new modDailyJournalView($dailyJournal);

// Insert html layout and javascript
echo $dailyJournalView->output();

?>
</body>
</html>