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.
105 righe
4.6 KiB
105 righe
4.6 KiB
<? |
|
|
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (isset($_GET["draw"])) { |
|
$enti = $_SESSION["ente"]->entiBeneficiari(); |
|
$return = array(); |
|
$return["draw"] = (int)$_GET["draw"]; |
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
$filters = []; |
|
if (isset($_GET["stato"]) && $_GET["stato"]!=="") { |
|
$filters["b_gare.stato"] = $_GET["stato"]; |
|
} |
|
if (isset($_GET["procedura"]) && $_GET["procedura"]!=="") { |
|
$filters["b_gare.procedura"] = $_GET["procedura"]; |
|
} |
|
if (isset($_GET["tipologia"]) && $_GET["tipologia"]!=="") { |
|
$filters["b_gare.tipologia"] = $_GET["tipologia"]; |
|
} |
|
$total = publicGara::getList($_SESSION["ente"]->codice,$filters,[],0,-1); |
|
if (!empty($total)) { |
|
$return["recordsTotal"] = (int)count($total); |
|
if (!empty($_GET["search"]["value"])) { |
|
$filters["*"] = $_GET["search"]["value"]; |
|
} |
|
|
|
|
|
if (isset($_GET["ente"]) && $_GET["ente"]!=="") { |
|
$filters["b_gare.codice_ente"] = $_GET["ente"]; |
|
} |
|
$order = null; |
|
$orderKey = "b_gare.codice"; |
|
switch($_GET["order"][0]["column"]) { |
|
case "2": $orderKey = "b_gare.codice"; break; |
|
case "4": $orderKey = "b_gare.oggetto"; break; |
|
case "5": $orderKey = "b_gare.prezzoRiferimento"; break; |
|
case "6": $orderKey = "b_gare_round.pubblicazione"; break; |
|
case "7": $orderKey = "b_gare_round.scadenza"; break; |
|
} |
|
if ($_GET["order"][0]["dir"] == "desc") { |
|
$order[$orderKey] = "DESC"; |
|
} else { |
|
$order[$orderKey] = "ASC"; |
|
} |
|
|
|
$risultati = publicGara::getList($_SESSION["ente"]->codice,$filters,$order,$_GET["start"],$_GET["length"]); |
|
if (count($risultati) > 0) { |
|
if (!empty($_GET["search"]["value"])) { |
|
$return["recordsFiltered"] = (int)count($risultati); |
|
} else { |
|
$return["recordsFiltered"] = $return["recordsTotal"]; |
|
} |
|
$return["data"] = array(); |
|
$stati = gara::getStati(); |
|
$update_scadute = $pdo->prepare("UPDATE b_gare SET stato = 21 WHERE codice = :codice AND stato = 20"); |
|
$tipologie = getTipologieAffidamento(); |
|
$procedure = getProcedure(); |
|
foreach($risultati AS $record) { |
|
if (!empty($record["scadenza"]) && ($record["fase_attiva"] == $record["numero"]) && strtotime($record["scadenza"]) < time() && $record["stato"] == 20) { |
|
$update_scadute->execute([":codice"=>$record["codice"]]); |
|
$record["stato"] = 21; |
|
} |
|
$stato = $stati[$record["stato"]]; |
|
$tmpProcedura = $procedure[$record["procedura"]] ?? []; |
|
$procedura = $tmpProcedura["titolo"] ?? null; |
|
$fase = ""; |
|
if (!empty($tmpProcedura)) { |
|
$fase = $tmpProcedura["fasi"][$record["idFase"]]["titolo"] ?? null; |
|
} |
|
$tipologia = $tipologie[$record["tipologia"]] ?? []; |
|
$tipologia = $tipologia["titolo"] ?? null; |
|
$row = array(); |
|
$row[] = '<div id="flag_'.$record["codice"].'" class="status_flag" style="background-color:'.$stato["color"].'"></div>'; |
|
$row[] = __($stato["titolo"]); |
|
$row[] = $record["id"]; |
|
$row[] = str_replace(",","<br>",$record["cig"]); |
|
$path = "/gare/dettaglio.php?codice={$record["codice"]}"; |
|
ob_start(); |
|
?> |
|
<a href='<?= $path ?>' title='<?= __("dettagli") ?>'> |
|
<?php if (!empty($procedura)) : ?><small class="badge badge-primary"><?= __("Procedura") ?>: <?= $procedura ?></small><?php endif ?> |
|
<?php if (!empty($fase)) : ?><small class="badge badge-warning"><?= __("Fase") ?>: <?= $fase ?></small><?php endif ?> |
|
<?php if (!empty($tipologia)) : ?><small class="badge badge-info"><?= __("Tipologia") ?>: <?= $tipologia ?></small><?php endif ?> |
|
<br><strong><?= $record["oggetto"] ?></strong> |
|
</a> |
|
<? |
|
$row[] = ob_get_clean(); |
|
$row[] = number_format($record["prezzoRiferimento"],2,",","."); |
|
$row[] = mysql2date($record["pubblicazione"]); |
|
$row[] = mysql2datetime($record["scadenza"]); |
|
$row[] = $enti[$record["codice_ente"]]["denominazione"] ?? ""; |
|
$row[] = "<a href='{$path}' title='".__("dettagli")."' class='btn btn-info btn-sm'><span class='fa fa-search'></span><span class='sr-only'>" . __("Dettagli") . "</span></a>"; |
|
$return["data"][] = $row; |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
|
|
echo json_encode($return); |
|
} |
|
?>
|
|
|