Files
MYSOPHAL/front/fiche.demande.acces.pdf.php
2025-08-07 13:15:31 +01:00

78 lines
1.3 KiB
PHP

<?php
ob_Start();
use Glpi\Event;
include ('../inc/includes.php');
Session::checkLoginUser();
function getTicketContent($id){
global $DB;
$query = "SELECT content FROM `glpi_tickets` WHERE id = ?";
$stmt = $DB->prepare($query);
$stmt->bind_param("i" , $id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$row = $result->fetch_assoc();
}
return $row['content'];
}
if(filter_var($_GET['id'], FILTER_VALIDATE_INT) === FALSE) Html::redirect($CFG_GLPI["root_doc"]."/front/ticket.form.php");
if(isset($_GET['id']) && !empty($_GET['id'])){
$category = '';
if(isset($_GET['category'])){
switch ($_GET['category']){
case 51: $category = "Attribution accès";break;
case 52: $category = "Reconfiguration accès";break;
case 51: $category = "Retrait accès";break;
}
}
$content = getTicketContent($_GET['id']);
//supprimer UTF-8-BOM
for ($i = 0; $i <= 31; ++$i) {
$content = str_replace(chr($i), "", $content);
}
$content = str_replace(chr(127), "", $content);
if($content != null){
include ('../lib/tcpdf/templates/fiche_demande_acces.php');
}
}else{
Html::redirect($CFG_GLPI["root_doc"]."/front/ticket.form.php");
}