$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();
?>
/documenti/enti/= $enteInfo["logo"] ?>" style="width:150px"> |
= $enteInfo["denominazione"] ?>
= $enteInfo["indirizzo"] . " - " . $enteInfo["citta"] . " (" . $enteInfo["provincia"] . ")" ?>
|
= __("Esportazione") ?> - = __($tipoElenco) ?> - = $elenco->info["oggetto"] ?> |
| = __("Data e ora esportazione") ?>: = date("d/m/Y H:i:s") ?> |
| = __("Codice Fiscale") ?> |
= __("Denominazione") ?> |
= __("E-mail") ?> |
if ($tipoElenco == "generale") { ?>
= __("Stato") ?> |
= __("Motivazione") ?> |
} ?>
$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";
}
}
?>
| = strtoupper($record["cf"]) ?> |
= strtoupper($record["cognome"]. " " . $record["nome"]) ?> |
= strtolower($record["email"]) ?> |
if ($tipoElenco == "generale") { ?>
= __($stato) ?> |
= $record["motivazione"] ?> |
} ?>
}
?>
$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;
}
}
}
}
}
}
?>