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.
65 righe
2.5 KiB
65 righe
2.5 KiB
<? |
|
$error = true; |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"public_html/"))."config.php"; |
|
include_once($configPath); |
|
$id_modulo = "partecipanti"; |
|
if (isset($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice_gara"],$id_modulo) && tokenVerify($_GET["token"])) { |
|
$gara = gara::init($_GET["codice_gara"]); |
|
if (!empty($gara) && $gara->setLotto($_GET["codice_lotto"])) { |
|
if (!$gara->checkLock($id_modulo)) { |
|
if (!empty($gara->lotto)) { |
|
$partecipanti = $gara->getPartecipanti(); |
|
if (!empty($partecipanti)) { |
|
$maxEconomico = 0; |
|
$maxTecnico = 0; |
|
$criteri = $gara->getMacroCriteri(); |
|
foreach($criteri AS $criterio) { |
|
if ($criterio["economico"] == "S") { |
|
$maxEconomico += $criterio["peso"]; |
|
} else { |
|
$maxTecnico += $criterio["peso"]; |
|
} |
|
} |
|
$error = false; |
|
header('Content-Description: File Transfer'); |
|
header('Content-Type: application/octet-stream'); |
|
header('Content-Disposition: attachment; filename=model.csv'); |
|
header('Expires: 0'); |
|
header('Cache-Control: must-revalidate'); |
|
header('Pragma: public'); |
|
$campi = array_keys(jsonToArray(__DIR__."/elements.json")); |
|
if ($maxTecnico == 0) { |
|
unset($campi[7]); |
|
} |
|
if ($maxEconomico == 0) { |
|
unset($campi[8]); |
|
} |
|
$campi = array_values($campi); |
|
echo '"'; echo implode('";"',$campi); echo '"' . PHP_EOL; |
|
foreach($partecipanti AS $tmp) { |
|
$partecipante = []; |
|
$partecipante[] = $tmp["codice"]; |
|
$partecipante[] = $tmp["codice_fiscale"]; |
|
$partecipante[] = $tmp["ragione_sociale"]; |
|
$partecipante[] = $tmp["escluso"]; |
|
$partecipante[] = $tmp["motivazione"]; |
|
$partecipante[] = $tmp["a_facoltativa"]; |
|
$partecipante[] = $tmp["motivazione_anomalia"]; |
|
if ($maxTecnico > 0) { |
|
$partecipante[] = $tmp["totaleTecnico"]; |
|
} |
|
if ($maxEconomico > 0) { |
|
$partecipante[] = $tmp["totaleEconomico"]; |
|
} |
|
echo '"'; echo implode('";"',$partecipante); echo '"'. PHP_EOL; |
|
} |
|
exit; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
}
|
|
|