Files
MYSOPHAL/front/hse.php
2025-08-07 13:15:31 +01:00

109 lines
2.6 KiB
PHP

<?php
// use Glpi\Event;
include('../inc/includes.php');
include_once(GLPI_ROOT . "/inc/db.function.php");
Session::checkLoginUser();
//Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php");
function checkIfExist($id)
{
global $DB;
$stmt = $DB->prepare("select * from `glpi_read_policy` where user_id = ? and document = 'regulation'");
$stmt->bind_param("i", $id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
return true;
}
return false;
}
$currentuserid = $_SESSION["glpiID"];
$exist = checkIfExist($currentuserid);
echo $exist;
if($exist) {
Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php");
}
function update_policy_read($id)
{
global $DB;
$stmt = $DB->prepare("INSERT INTO `glpi_read_policy` (`user_id`, `read`,`document`) VALUES (?,1,'regulation')");
$stmt->bind_param("i", $id);
$stmt->execute();
$lastId = $DB->insert_id();
return $lastId;
}
if (isset($_GET["readyes"])) {
if ($_GET["readyes"] == 1) {
$lastId = update_policy_read($currentuserid);
if (isset($lastId)) {
Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php");
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>
<style>
</style>
</head>
<body class="bg-secondary bg-gradient">
<nav class="navbar sticky-top bg-dark d-flex justify-content-end">
<div class="">
<form action="./hse.php" method="get">
<input type="hidden" name="readyes" value="1">
<button class="btn btn-success btn-sm mx-4" type="submit">
Lu et Approuvé
<?php //echo '<a href="'.$CFG_GLPI['root_doc'] . "/front/central.php".'" rel="noopener noreferrer">Lu et Approuvé</a>';
?>
</button>
</form>
</div>
</nav>
<div style="width:100vw;height:100vh;" ><embed src="../file_upload/reg_int_2024.pdf" type="application/pdf" height="100%" width="100%" ></div>
</body>
</html>