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.
46 righe
2.1 KiB
46 righe
2.1 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; |
|
include_once($configPath); |
|
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && tokenVerify()) { |
|
ini_set('memory_limit', "512M"); |
|
ini_set("max_execution_time",600); |
|
$enti = $_SESSION["utente"]->getEntiBeneficiari(false); |
|
if (!empty($enti[$_POST["ente"]])) { |
|
$ente = $enti[$_POST["ente"]]; |
|
if (is_numeric($_POST["anno"])) { |
|
anac::importazioneMassivaSuggerimenti190($_POST["anno"],(!empty($_POST["gestore"])) ? $ente["codice"] : null); |
|
$data = anac::get190Data($ente["codice"],$_POST["anno"],(empty($_POST["gestore"])) ? false : true); |
|
$rows = [ |
|
["cig","strutturaProponente - Codice Fiscale","strutturaProponente - Denominazione","oggetto","id_scelta_contraente","partecipanti","aggiudicatari","importoAggiudicazione","dataInizio","dataUltimazione","importoSommeLiquidate"] |
|
]; |
|
if (!empty($data["lotto"])) { |
|
foreach($data["lotto"] AS $lotto) { |
|
$rows[] = [ |
|
$lotto["cig"], |
|
$lotto["strutturaProponente"]["codiceFiscaleProp"], |
|
$lotto["strutturaProponente"]["denominazione"], |
|
strip_tags($lotto["oggetto"]), |
|
$lotto["sceltaContraente"], |
|
str_replace(";","",json_encode($lotto["partecipanti"] ?? [])), |
|
str_replace(";","",json_encode($lotto["aggiudicatari"] ?? [])), |
|
$lotto["importoAggiudicazione"] ?? 0, |
|
$lotto["tempiCompletamento"]["dataInizio"] ?? "", |
|
$lotto["tempiCompletamento"]["dataUltimazione"] ?? "", |
|
$lotto["importoSommeLiquidate"] ?? 0 |
|
]; |
|
} |
|
header('Content-type: text/csv'); |
|
header('Content-Disposition: attachment; filename=esportazione.csv'); |
|
foreach($rows AS $row) { |
|
echo "\"" . preg_replace( "/\r|\n/", "", implode("\";\"",$row)) . "\"".PHP_EOL; |
|
} |
|
$error = false; |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |