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.
67 righe
2.5 KiB
67 righe
2.5 KiB
<? |
|
$configPath = substr(__DIR__, 0, strpos(__DIR__, "/public_html")) . "/config.php"; |
|
include_once($configPath); |
|
$error = true; |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission("albo.consip")) { |
|
$data = jsonToArray(__DIR__ . "/dataset.json"); |
|
$id = purify(base64_decode($_GET["id"])); |
|
if (!empty($data[$id])) { |
|
$error = false; |
|
$set = $data[$id]; |
|
?> |
|
<h1><?= $set["nome"] ?></h1> |
|
<? |
|
$ch = curl_init(); |
|
$query = http_build_query([ |
|
'resource_id' => $set["id-sorgente"], |
|
'distinct' => true, |
|
'fields' => 'Codice_CPV,Descrizione_Cpv', |
|
'limit' => 9999999 |
|
]); |
|
|
|
$url = "https://dati.consip.it/api/action/datastore_search?" . $query; |
|
|
|
curl_setopt($ch, CURLOPT_URL, $url); |
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
curl_setopt($ch, CURLOPT_HEADER, 0); |
|
$result = curl_exec($ch); |
|
if (!curl_errno($ch)) { |
|
$result = json_decode($result, true); |
|
} |
|
curl_close($ch); |
|
if (!empty($result["result"]["records"])) { |
|
?> |
|
<div class="form-group"> |
|
<label for="codice_cpv_oe"><?= __("Categoria CPV") ?></label> |
|
<select title="CPV" id="consip_cpv_oe"> |
|
<option value=""><?= __("Seleziona") ?>...</option> |
|
<? |
|
if (isset($result["result"]["records"]) && count($result["result"]["records"]) > 0) { |
|
foreach ($result["result"]["records"] as $cpv_element) { |
|
?> |
|
<option value="<?= $cpv_element["Codice_CPV"] ?>"><?= $cpv_element["Codice_CPV"] . " - " . $cpv_element["Descrizione_Cpv"] ?></option> |
|
<? |
|
} |
|
} |
|
?> |
|
</select> |
|
</div> |
|
<button class="btn btn-block btn-success mt-2" onClick="searchFornitoriConsip()"><?= __("Cerca") ?></button> |
|
<script> |
|
searchFornitoriConsip = async function() { |
|
let cpv = $("#consip_cpv_oe").val(); |
|
if (cpv != "") { |
|
showModalWithURL('/backend/albo/consip/search.php?idSorgente=<?= $set["id-sorgente"] ?>&cpv='+cpv); |
|
} |
|
} |
|
</script> |
|
<? |
|
} else { |
|
alertManager::printWarningBox(__("Nessun dato disponibile")); |
|
} |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
}
|
|
|