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.
91 righe
3.5 KiB
91 righe
3.5 KiB
<? |
|
|
|
use phpDocumentor\Reflection\DocBlock\Tags\Var_; |
|
|
|
$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_concorsi.stato"] = $_GET["stato"]; |
|
} |
|
$total = publicConcorso::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_concorsi.codice_ente"] = $_GET["ente"]; |
|
} |
|
$order = null; |
|
$orderKey = "b_concorsi.codice"; |
|
switch($_GET["order"][0]["column"]) { |
|
case "2": $orderKey = "b_concorsi.codice"; break; |
|
case "4": $orderKey = "b_concorsi.oggetto"; break; |
|
case "5": $orderKey = "b_concorsi_round.pubblicazione"; break; |
|
case "6": $orderKey = "b_concorsi_round.scadenza"; break; |
|
} |
|
if ($_GET["order"][0]["dir"] == "desc") { |
|
$order[$orderKey] = "DESC"; |
|
} else { |
|
$order[$orderKey] = "ASC"; |
|
} |
|
|
|
$risultati = publicConcorso::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 = concorso::getStati(); |
|
$update_scadute = $pdo->prepare("UPDATE b_concorsi 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"]]; |
|
|
|
$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 = "/concorsi/dettaglio.php?codice={$record["codice"]}"; |
|
ob_start(); |
|
?> |
|
<a href='<?= $path ?>' title='<?= __("dettagli") ?>'> |
|
<strong><?= $record["oggetto"] ?></strong> |
|
</a> |
|
<? |
|
$row[] = ob_get_clean(); |
|
$row[] = mysql2date($record["pubblicazione"]); |
|
$row[] = mysql2datetime($record["scadenza"]); |
|
if (count($enti) > 1) { |
|
$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); |
|
} |
|
?>
|
|
|