gestione gare pubbliche
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.
 
 
 
 
 

79 righe
3.0 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
if (isset($_GET["draw"])) {
$enti = [];
$return = array();
$return["draw"] = (int)$_GET["draw"];
$return["recordsTotal"] = (int)0;
$return["recordsFiltered"] = (int)0;
$total = consulenza::getList([],[],0,-1);
if (!empty($total)) {
$return["recordsTotal"] = (int)count($total);
$filters = [];
if (!empty($_GET["search"]["value"])) {
$filters["b_consulenze.titolo"] = $_GET["search"]["value"];
}
if (isset($_GET["stato"]) && $_GET["stato"]!=="") {
$filters["b_consulenze.stato"] = $_GET["stato"];
}
if (isset($_GET["ente"]) && $_GET["ente"]!=="") {
$filters["b_consulenze.codice_gestore"] = $_GET["ente"];
}
$order = ["b_consulenze.id"=>"DESC"];
$orderKey = "b_consulenze.id";
switch($_GET["order"][0]["column"]) {
case "2": $orderKey = "b_consulenze.id "; break;
case "3": $orderKey = "b_consulenze_round.numero "; break;
case "4": $orderKey = "b_consulenze.oggetto "; break;
case "5": $orderKey = "b_consulenze.prezzoRiferimento "; break;
case "6": $orderKey = "b_consulenze_round.pubblicazione "; break;
case "7": $orderKey = "b_consulenze_round.chiarimenti "; break;
case "8": $orderKey = "b_consulenze_round.scadenza "; break;
}
if ($_GET["order"][0]["dir"] == "desc") {
$order[$orderKey] = "DESC";
} else {
$order[$orderKey] = "ASC";
}
$risultati = consulenza::getList($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 = consulenza::getStati();
foreach($risultati AS $record) {
$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["codice"];
$row[] = "<strong>" . $record["titolo"] . "</strong>";
$row[] = mysql2datetime($record["timestamp_creazione"]);
$row[] = mysql2datetime($record["timestamp"]);
// if (count($enti) > 1) {
// $row[] = $enti[$record["codice_ente"]]["denominazione"];
// }
$path = "/backend/consulenza/edit.php?codice={$record["codice"]}";
$row[] = "<a href='{$path}' title='".__("dettagli")."' class='btn btn-info btn-sm'><span class='fa fa-search'></span>" . __("Dettagli") . "</a>";
$return["data"][] = $row;
}
} else {
$return["data"] = array();
}
} else {
$return["data"] = array();
}
echo json_encode($return);
}
?>