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.
 
 
 
 
 

43 righe
1.6 KiB

<?
$configPath = substr(__DIR__, 0, strpos(__DIR__, "/public_html")) . "/config.php";
include_once($configPath);
$error = true;
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && !empty($_GET["tokenEsportazione"])) {
if (!empty($_SESSION["exportoperatori"][$_GET["tokenEsportazione"]])) {
$alloperatori = array_column($_SESSION["exportoperatori"][$_GET["tokenEsportazione"]], "codice");
} else if ($_SESSION["exportoperatoriRelazioni"][$_GET["tokenEsportazione"]]) {
$alloperatori = array_column(json_decode(gzuncompress($_SESSION["exportoperatoriRelazioni"][$_GET["tokenEsportazione"]]),true),"codice_operatore");
}
if (!empty($alloperatori)) {
$error = false;
session_write_close();
$manager = new oeManager;
$manager->countInviti = true;
$manager->countAggiudicato = true;
$ooee = $manager->exportInfo($alloperatori, $_SESSION["ente"]->codice);
if (!empty($ooee)) {
$exportPath = sys_get_temp_dir() . "/export.zip";
$zip = new ZipArchive;
if ($zip->open($exportPath, ZipArchive::CREATE) === TRUE) {
$json = json_encode($ooee["data"], JSON_PRETTY_PRINT);
$zip->addFromString("data.json", $json);
if (!empty($ooee["allegati"])) {
foreach ($ooee["allegati"] as $allegato) {
$zip->addFromString($allegato["path"], $allegato["content"]);
}
}
$zip->close();
header('Content-Type: application/zip');
header('Content-Length: ' . filesize($exportPath));
header('Content-Disposition: attachment; filename="exportFornitori.zip"');
readfile($exportPath);
} else {
$error = true;
}
}
}
}
if ($error) {
header('HTTP/1.0 403 Forbidden');
die();
}