gestione gare pubbliche
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.
 
 
 
 
 

130 righe
5.7 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
$id_modulo = "partecipanti";
$cmd_info = AlboCommissione::getInfoModulo($id_modulo);
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"],$id_modulo) && $_SESSION["utente"]->permission($cmd_info["modulo_riferimento"])) {
$elenco = AlboCommissione::init($_GET["codice"]);
if (!empty($elenco)) {
$tmp = $elenco->getPartecipanti(["stato"=>$_SESSION["export{$elenco->info["codice"]}"][$_GET["exportToken"]] ?? null],[],0,-1);
if (!empty($tmp)) {
$tipoElenco = $_SESSION["export{$elenco->info["codice"]}"][$_GET["exportToken"]];
$widthDenominazione = ($tipoElenco == "generale") ? "30" : "70";
$ids = array_column($tmp,"codice_operatore");
$usrs = Utente::getInfoFromID($ids);
$ooee = [];
if (!empty($usrs)) {
foreach($usrs AS $usr) {
$ooee[$usr["codice"]] = $usr;
}
}
$return = [];
$tmpKeys = array_keys(reset($ooee));
$keys = ["codice","cognome","nome","dnascita","provincia_nascita","cf","email","pec","indirizzo","citta","provincia","regione","cap","stato","telefono","cellulare"];
foreach($tmp AS $record) {
$row = [];
foreach($keys AS $key) {
$row[$key] = $ooee[$record["codice_operatore"]][$key];
}
unset($record["codice"]);
unset($record["codice_operatore"]);
unset($record["codice_fiscale"]);
$row += $record;
$return[] = $row;
}
if (!empty($return)) {
if ($_GET["format"] == "csv") {
$data = [array_keys($return[0])];
$data = array_merge($data,$return);
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=export.csv");
header("Pragma: no-cache");
header("Expires: 0");
foreach($data AS $fornitore) {
echo "\"" . implode("\";\"",$fornitore) . "\"".PHP_EOL;
}
} else if ($_GET["format"] == "pdf") {
$enteInfo = $_SESSION["ente"]->getInfo();
ob_start();
?>
<html>
<style>
body { font-size:10px; }
td, th { padding:5px; }
tr.odd { background-color: #DDD; }
table { width:100% }
</style>
<body>
<table>
<tr>
<td rowspan="3" style="width:150px"><img src="<?= $config["link_sito"] ?>/documenti/enti/<?= $enteInfo["logo"] ?>" style="width:150px"></td>
<td>
<h1><?= $enteInfo["denominazione"] ?></h1>
<strong><?= $enteInfo["indirizzo"] . " - " . $enteInfo["citta"] . " (" . $enteInfo["provincia"] . ")" ?></strong><br>
</td>
</tr>
<tr>
<td><h2 style="margin:5px;padding:0px"><?= __("Esportazione") ?> - <?= __($tipoElenco) ?> - <?= $elenco->info["oggetto"] ?></h2></td>
</tr>
<tr>
<td><?= __("Data e ora esportazione") ?>: <?= date("d/m/Y H:i:s") ?></td>
</tr>
</table>
<table width="100%">
<tr style="background-color: #AAA; color: #FFF; font-weight:bold">
<th style="width:10%"><?= __("Codice Fiscale") ?></th>
<th style="width:<?= $widthDenominazione ?>%"><?= __("Denominazione") ?></th>
<th style="width:20%"><?= __("E-mail") ?></th>
<? if ($tipoElenco == "generale") { ?>
<th style="width:10%"><?= __("Stato") ?></th>
<th style="width:30%"><?= __("Motivazione") ?></th>
<? } ?>
</tr>
<?
$i = 0;
foreach($return AS $record) {
$i++;
$class= "even";
if ($i%2!=0) {
$class = "odd";
}
$stato = "Ammesso";
if ($record["ammesso"] == "N") {
if ($record["valutato"] == "S") {
$stato = "Non ammesso";
} else {
$stato = "Non valutato";
}
}
?>
<tr class="<?= $class ?>">
<td style="text-align:center; width:10%"><?= strtoupper($record["cf"]) ?></td>
<td style="width:<?= $widthDenominazione ?>%"><strong><?= strtoupper($record["cognome"]. " " . $record["nome"]) ?></strong></td>
<td style="width:20%"><?= strtolower($record["email"]) ?></td>
<? if ($tipoElenco == "generale") { ?>
<td style="text-align:center; width:10%"><?= __($stato) ?></td>
<td style="width:30%"><?= $record["motivazione"] ?></td>
<? } ?>
</tr>
<?
}
?>
</table>
</body>
</html>
<?
$html = ob_get_clean();
$pdf = documentConverter::getPDFWithWKHTML($html,"A3","landscape");
if (!empty($pdf)) {
$error = false;
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=export.pdf");
echo $pdf;
}
}
}
}
}
}
?>