LobbySIO/printvwf.php
2021-08-11 10:54:25 -04:00

297 lines
18 KiB
PHP

<?php
/*
* Copyright (C) 2018 josh.north@point808.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
ini_set('session.gc_maxlifetime', 24*60*60); // MIN SESSION
ini_set('session.gc_probability', 1); // GC RATES
ini_set('session.gc_divisor', 100); // TIMES
ini_set('session.use_cookies', '1');
ini_set('session.use_only_cookies', '1');
ini_set('session.cookie_lifetime', '0');
ini_set('session.cookie_secure', '0');
ini_set('session.cookie_httponly', '0');
ini_set('session.cookie_samesite', 'Lax');
session_save_path('.tmp'); // TEMP
session_start(); // START
require_once __DIR__ . '/autoload.php'; // AUTOLOAD
use App\LobbySIO\Config\Registry;
$Users = new \App\LobbySIO\Database\Users();
if (Registry::AUTHMETHOD == 'SAML') {
//simplesaml
require_once('../simplesamlphp/lib/_autoload.php');
$auth = new \SimpleSAML\Auth\Simple(Registry::AUTHIDP);
//$auth->requireAuth();
$auth->isAuthenticated();
if (!$auth->isAuthenticated()) {
$attributes = 'none';
} else {
$attributes = $auth->getAttributes();
$saml_user_email = $attributes['http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress'][0];
$saml_user_info = $Users->getUserInfoByEmail($saml_user_email, "1", "0");
$saml_user_id = $saml_user_info["0"]["users_id"];
}
$session = \SimpleSAML\Session::getSessionFromRequest();
$session->cleanup();
}
$StaticFunctions = new \App\LobbySIO\Misc\StaticFunctions(); // DEFAULT CLASSES
$SiteInfo = new \App\LobbySIO\Database\SiteInfo();
if (isset($_SESSION['user_id'])) { // LOGGED IN? GET USER OBJECT
if (isset($saml_user_id)) {
$sessuserid=$saml_user_id;
} else {
$sessuserid=$_SESSION['user_id'];
}
} elseif (!isset($_SESSION['user_id'])) {
if (isset($saml_user_id)) {
$sessuserid=$saml_user_id;
} else {
$sessuserid='2';
}
$session_user = $Users->getUserInfo($sessuserid, "1", "0"); }
if (isset($session_user)) { // GET UID OR SET TO KIOSK
$uid = $session_user["0"]["users_id"];} else { $uid = "2"; }
$app_disp_lang = filter_input(INPUT_COOKIE, 'app_disp_lang'); // SETUP LANGUAGE
if(!isset($app_disp_lang)) {
$app_disp_lang=$StaticFunctions->getDefaultLanguage(); }
$siteidcookie = filter_input(INPUT_COOKIE, 'app_site'); // SETUP SITE
foreach($SiteInfo->getSite("0", $uid, "0", "0") as $arr) {
$lookup_array[$arr['sites_id']]=1; }
if(isset($lookup_array[$siteidcookie])) {
$siteid = $siteidcookie; } else { $siteid = "1"; }
if(!isset($siteid)) { $siteid="1"; }
$Translate = new \App\LobbySIO\Language\Translate($app_disp_lang); // SETUP TRANSLATOR
$transLang = $Translate->userLanguage();
$defaulttimezone = $StaticFunctions->getDefaultTZ();
date_default_timezone_set('UTC'); // DEFAULT TO UTC
date_default_timezone_set($defaulttimezone); // UPDATE TO DEFAULT APP SETTING
$timezone = $SiteInfo->getSite($siteid, "0", "0", "0")[0]["sites_timezone"]; // GET TIMEZONE FROM SITE ID
$timeplus = new DateTime($StaticFunctions->getUTC(), new DateTimeZone('UTC')); // DUMB WAY TO CALCULATE SOME TIMES
$timeplus->setTimezone(new DateTimeZone("$timezone"));
$timenow = $timeplus->format('Y-m-d H:i:s');
$app_current_pagename = $transLang['ACCOUNT']; // PAGE SETUP
$app_current_pageicon = '<i class="fas fa-user-circle"></i> ';
// require_once("inc/header.inc.php");
if ($StaticFunctions->getUserSessionStatus() == false) { // CHECK STATUS
echo $StaticFunctions->killSession(); // ELSE DIE
} else { ?>
<!-- START CONTENT -->
<!doctype html>
<html lang="<?php echo $app_disp_lang; ?>">
<!-- START HEAD -->
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<link rel="manifest" href="manifest.webmanifest">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="<?php echo $transLang['STR_VENDORINFO_FORM_TITLE']; ?>">
<link rel="apple-touch-icon" href="assets/touch-logo.png?v3">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" href="css/bootstrap.min.css?v3"/>
<link rel="stylesheet" href="css/sticky-footer-navbar.css?v3">
<link rel="stylesheet" href="css/all.min.css?v3"/>
<link rel="stylesheet" href="css/fontawesome.min.css?v3"/>
<link rel="stylesheet" href="css/brands.min.css?v3"/>
<link rel="stylesheet" href="css/regular.min.css?v3"/>
<link rel="stylesheet" href="css/animate.min.css?v3"/>
<link rel="stylesheet" href="css/datatables.min.css?v3" />
<link rel="stylesheet" href="css/styles.css?v3"/>
<link rel="stylesheet" href="css/tempusdominus-bootstrap-4.min.css?v3"/>
<meta name="description" content="<?php echo $transLang['META_DESC']; ?>" />
<script src="js/jquery.min.js?v3"></script>
<script src="js/bootstrap.bundle.min.js?v3"></script>
<script src="js/datatables.min.js?v3"></script>
<script src="js/buttons.flash.min.js?v3"></script>
<script src="js/buttons.html5.min.js?v3"></script>
<script src="js/buttons.print.min.js?v3"></script>
<script src="js/dataTables.buttons.min.js?v3"></script>
<script src="js/jszip.min.js?v3"></script>
<script src="js/pdfmake.min.js?v45"></script>
<script src="js/vfs_fonts.js?v3"></script>
<script src="js/moment.min.js?v3"></script>
<script src="js/tempusdominus-bootstrap-4.min.js?v3"></script>
<script src="js/jSignature.min.js?v3"></script>
<title><?php echo $transLang['STR_VENDORINFO_FORM_TITLE']; ?></title>
</head>
<!-- END HEAD -->
<!-- START BODY -->
<body>
<?php
$form_data = filter_input_array(INPUT_POST, [
'form_data_stage' => (string)FILTER_SANITIZE_STRING,
'form_data_sitename' => (string)FILTER_SANITIZE_STRING,
'form_data_timein' => (string)FILTER_SANITIZE_STRING,
'form_data_timeout' => (string)FILTER_SANITIZE_STRING,
'form_data_isvendor' => (int)FILTER_VALIDATE_INT,
'form_data_badge' => (string)FILTER_SANITIZE_STRING,
'form_data_reason' => (string)FILTER_SANITIZE_STRING,
'form_data_manualsignindate' => (string)FILTER_SANITIZE_STRING,
'form_data_firstname' => (string)FILTER_SANITIZE_STRING,
'form_data_idtypename' => (string)FILTER_SANITIZE_STRING,
'form_data_lastname' => (string)FILTER_SANITIZE_STRING,
'form_data_country' => (string)FILTER_SANITIZE_STRING,
'form_data_checklistcompleted' => (string)FILTER_SANITIZE_STRING,
'form_data_workcompleted' => (string)FILTER_SANITIZE_STRING,
'form_data_sitecleanup' => (string)FILTER_SANITIZE_STRING,
'form_data_doccompleted' => (string)FILTER_SANITIZE_STRING,
'form_data_signinby' => (string)FILTER_SANITIZE_STRING,
'form_data_vwfby' => (string)FILTER_SANITIZE_STRING,
'form_data_checklistrequired' => (string)FILTER_SANITIZE_STRING,
'form_data_routinework' => (string)FILTER_SANITIZE_STRING,
'form_data_nonroutinework' => (string)FILTER_SANITIZE_STRING,
'form_data_coi' => (string)FILTER_SANITIZE_STRING,
'form_data_carnum' => (string)FILTER_SANITIZE_STRING,
'form_data_ssanum' => (string)FILTER_SANITIZE_STRING,
'form_data_company' => (string)FILTER_SANITIZE_STRING,
'form_data_worksummary' => (string)FILTER_SANITIZE_STRING,
'form_data_equipmentsummary' => (string)FILTER_SANITIZE_STRING,
'form_data_contact1' => (string)FILTER_SANITIZE_STRING,
'form_data_contact2' => (string)FILTER_SANITIZE_STRING,
'form_data_workstart' => (string)FILTER_SANITIZE_STRING,
'form_data_workend' => (string)FILTER_SANITIZE_STRING,
'form_data_visittype' => (int)FILTER_VALIDATE_INT,
'form_data_escortrequired' => (int)FILTER_VALIDATE_INT,
'form_data_customerimpacted' => (string)FILTER_SANITIZE_STRING,
'form_data_v_signature' => (string)FILTER_SANITIZE_STRING,
'form_data_e_signature' => (string)FILTER_SANITIZE_STRING,
'form_data_escortname' => (string)FILTER_SANITIZE_STRING
]);
?>
<div class="container-fluid">
<div class="row row-cols-2 mb-0 border">
<div class="col d-grid gap-2">
<img src="<?php echo $StaticFunctions->getLogo(); ?>" width="120" height="60" alt="">
</div>
<div class="col d-grid gap-2 text-end">
<h2><span class="align-middle"><?php echo $transLang['STR_VENDORINFO_FORM_TITLE']; ?></span></h2>
</div>
</div>
<div class="row row-cols-1 mb-0 border">
<div class="col d-grid gap-2">
<small><i><?php echo $transLang['STR_VENDORINFO_DOCUMENTATIONREQUIRED_DESC']; ?></i></small>
</div>
</div>
<div class="row row-cols-2 mb-0 border border-bottom-0">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_COMMON_SITE']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_sitename']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_CUSTOMERIMPACTED_TITLE']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_customerimpacted']; ?></small></h6>
</div>
</div>
<div class="row row-cols-2 mb-0 border border-bottom-0 border-top-0">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_WORKSTART_TITLE']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_workstart']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_WORKEND_TITLE']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_workend']; ?></small></h6>
</div>
</div>
<div class="row row-cols-2 mb-0 border border-bottom-0 border-top-0">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['NAME']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_lastname'] . ", " . $form_data['form_data_firstname']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['COMPANY']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_company']; ?></small></h6>
</div>
</div>
<div class="row row-cols-2 mb-0 border border-top-0">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_CONTACT1_TITLE']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_contact1']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_CONTACT2_TITLE']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_contact2']; ?></small></h6>
</div>
</div>
<div class="row row-cols-1 mb-0 ml-4 border">
<div class="col d-grid gap-2">
<ul class="list-unstyled">
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_checklistrequired']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_CHECKLISTREQUIRED_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_CHECKLISTREQUIRED_DESC']; ?>)</i></small></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_routinework']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_ROUTINEWORK_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_ROUTINEWORK_DESC']; ?>)</i></small></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_nonroutinework']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_NONROUTINEWORK_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_NONROUTINEWORK_DESC']; ?>)</i></small></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_coi']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_COI_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_COI_DESC']; ?>)</i></small></li>
</ul>
</div>
</div>
<div class="row row-cols-1 mb-0 border">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_WORKSUMMARY_TITLE']; ?>: </strong><br><small>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $form_data['form_data_worksummary']; ?></small></h6>
</div>
</div>
<div class="row row-cols-1 mb-0 border">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_EQUIPMENTSUMMARY_TITLE']; ?>: </strong><br><small>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $form_data['form_data_equipmentsummary']; ?></small></h6>
</div>
</div>
<div class="row row-cols-1 mb-0 border border-bottom-0">
<div class="col d-grid gap-2">
<small><i><?php echo $transLang['ACKNOWLEDGEMENT']; ?></small></i>
</div>
</div>
<div class="row row-cols-2 mb-0 border border-top-0">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_COMMON_SIGNATURE']; ?></strong></h6>
</div>
<div class="col d-grid gap-2">
<img src="<?php echo $form_data['form_data_v_signature']; ?>" width="200" height="50"/>
</div>
</div>
<div class="row row-cols-1 mb-0 ml-4 border">
<div class="col d-grid gap-2">
<ul class="list-unstyled">
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_checklistcompleted']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_CHECKLISTCOMPLETED_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_CHECKLISTCOMPLETED_DESC']; ?>)</i></small></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_workcompleted']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_WORKCOMPLETED_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_WORKCOMPLETED_DESC']; ?>)</i></small></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_sitecleanup']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_SITECLEANUP_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_SITECLEANUP_DESC']; ?>)</i></small></li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;<?php if($form_data['form_data_doccompleted']==$transLang['STR_COMMON_YES']){echo '<i class="far fa-check-square"></i> ';}else{echo '<i class="far fa-square"></i> ';} ?>
<strong><?php echo $transLang['STR_VENDORINFO_DOCCOMPLETED_TITLE']; ?> </strong><small><i>(<?php echo $transLang['STR_VENDORINFO_DOCCOMPLETED_DESC']; ?>)</i></small></li>
</ul>
</div>
</div>
<div class="row row-cols-2 border">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['SIGNINBY']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_signinby']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['STR_VENDORINFO_VERIFIEDBY']; ?>:</strong><small>&nbsp;<?php echo $form_data['form_data_vwfby']; ?></small></h6>
</div>
</div>
<div class="row row-cols-4 border">
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['TIMEINOUT']; ?>:</strong><br><small><?php echo $form_data['form_data_timein']; ?><br><?php echo $form_data['form_data_timeout']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['BADGE']; ?>:</strong><br><small><?php echo $form_data['form_data_badge']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['ID_TYPE']; ?>:</strong><br><small><?php echo $form_data['form_data_idtypename']; ?></small></h6>
</div>
<div class="col d-grid gap-2">
<h6><strong><?php echo $transLang['REASON']; ?>:</strong><br><small><?php echo $form_data['form_data_reason']; ?></small></h6>
</div>
</div>
</div>
<?php }