Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
91 righe
4.0 KiB
91 righe
4.0 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->gerarchia < 100) { |
|
if (!empty($_POST["tokenExport"]) && !empty($_POST["format"]) && !empty($_POST["export"])) { |
|
$tokenExport = base64_decode($_POST["tokenExport"]); |
|
if (!empty($_SESSION["esportazione-chiarimenti"][$tokenExport])) { |
|
$tmp = $_SESSION["esportazione-chiarimenti"][$tokenExport]; |
|
$chiarimenti = []; |
|
foreach($tmp AS $chiarimento) { |
|
if (in_array($chiarimento["codice"],$_POST["export"]) !== false) { |
|
$chiarimenti[] = $chiarimento; |
|
} |
|
} |
|
if (!empty($chiarimenti)) { |
|
ob_start(); |
|
?> |
|
<div style="margin:0.5cm"> |
|
<div style="width:48%; float:left; background-color: #DDD; border: 1px solid #DDD; padding:0.2cm;"> |
|
<?= __("Quesito") ?> |
|
</div> |
|
<div style="width:48%; float:right; background-color: #DDD; border: 1px solid #DDD; padding:0.2cm;"> |
|
<?= __("Risposta") ?> |
|
</div> |
|
<div style="clear: both"></div> |
|
</div> |
|
<? |
|
foreach($chiarimenti AS $chiarimento) { |
|
$utente = Utente::getInfoFromID($chiarimento["utente_modifica"]); |
|
?> |
|
<div style="margin:0.5cm"> |
|
<div style="width:48%; float:left; border: 1px solid #DDD; padding:0.2cm;"> |
|
<div style="text-align:right"><small><?= __("Data richiesta") ?>: <?= mysql2datetime($chiarimento["timestamp_richiesta"]) ?></small></div> |
|
<p><?= convert_to_utf8((!empty($chiarimento["revisione"])) ? $chiarimento["revisione"] : $chiarimento["quesito"]) ?></p> |
|
</div> |
|
<div style="width:48%; float:right; border: 1px solid #DDD; padding:0.2cm;"> |
|
<?php if (!empty(trim($chiarimento["risposta"]))) : ?> |
|
<div style="text-align:right"><small><?= $utente["cognome"] ." ".$utente["nome"] ?> - <?= __("Data risposta") ?>: <?= mysql2datetime($chiarimento["timestamp"]) ?></small></div> |
|
<p><?= convert_to_utf8($chiarimento["risposta"]) ?></p> |
|
<? |
|
$list = filesManager::listFiles($chiarimento["codice"],"{$_POST["radice"]}-risposte"); |
|
if (!empty($list)) { |
|
?> |
|
<p> |
|
<small> |
|
<strong><?= __("Allegati") ?></strong> |
|
<? |
|
foreach($list AS $attch) { |
|
?> |
|
<p><?= $attch["titolo"] ?> - MD5: <?= $attch["md5"] ?></p> |
|
<? |
|
} |
|
?> |
|
</small> |
|
</p> |
|
<? |
|
} |
|
?> |
|
<?php else: ?> |
|
<?= __("In attesa di risposta") ?> |
|
<?php endif ?> |
|
</div> |
|
<div style="clear: both"></div> |
|
</div> |
|
<? |
|
} |
|
$table = ob_get_clean(); |
|
if ($_POST["format"] == "pdf") { |
|
$content = documentConverter::getPDFWithDOMPDF($table,"A3","landscape"); |
|
$fileName = 'Chiarimenti.pdf'; |
|
if (!empty($content)) { |
|
$error = false; |
|
header("Content-type:application/pdf"); |
|
header("Content-Disposition:attachment;filename={$fileName}"); |
|
echo $content; |
|
} |
|
} else if ($_POST["format"] == "odt") { |
|
if (documentConverter::generateODT($table,"Chiarimenti")) { |
|
$error = false; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|
|
|