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.
123 righe
3.8 KiB
123 righe
3.8 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
|
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice) && $_SESSION["utente"]->permission('rda')) { |
|
if (isset($_GET["draw"])) { |
|
$error = false; |
|
$return = array(); |
|
$return["draw"] = (int)$_GET["draw"]; |
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
|
|
$filters = []; |
|
|
|
$filters['codice_stato'] = 10; |
|
|
|
$count = rda::getList($filters); |
|
|
|
if (!empty($count) && $count > 0) { |
|
$return["recordsTotal"] = (int) count($count); |
|
|
|
if(!empty($_GET['codice'])){ |
|
$filters['exclude']['codice'] = $_GET['codice']; |
|
} |
|
|
|
if (!empty($_GET["search"]["value"])) { |
|
|
|
$filters["search"]["id"] = $_GET["search"]["value"]; |
|
$filters["search"]["oggetto"] = $_GET["search"]["value"]; |
|
} |
|
|
|
|
|
$order = null; |
|
$orderKey = "codice"; |
|
|
|
switch($_GET["order"][0]["column"]) { |
|
case "0": $orderKey = "codice"; break; |
|
case "1": $orderKey = "id"; break; |
|
case "2": $orderKey = "oggetto"; break; |
|
} |
|
|
|
if ($_GET["order"][0]["dir"] == "desc") { |
|
$filters['order'][$orderKey] = "DESC"; |
|
} else { |
|
$filters['order'][$orderKey] = "ASC"; |
|
} |
|
|
|
$filtered = rda::getList($filters); |
|
|
|
$filters['paginate'] = [ |
|
'start' => $_GET["start"], |
|
'length' => $_GET["length"] |
|
]; |
|
|
|
|
|
$stati = array_values(rda::getStati(null, null, true, true, false, true)); |
|
|
|
$enti = $_SESSION["ente"]->entiBeneficiari(); |
|
|
|
$risultati = rda::getList($filters); |
|
|
|
if (!empty($risultati) && !empty($stati)) { |
|
$return["recordsFiltered"] = count($filtered); |
|
$return["data"] = array(); |
|
|
|
foreach($risultati AS $record) { |
|
|
|
$index = array_search($record['stato'], array_column($stati, 'stato')); |
|
|
|
$stato = !empty($stati[$index]) ? $stati[$index] : "n.a."; |
|
$row = array(); |
|
$row[] = '<div id="flag_'.$record["codice"].'" class="fa fa-circle" style="color:'.($stato["colore"] ?? '').'"></div>'; |
|
$row[] = __($stato["titolo"] ?? ""); |
|
$row[] = $record["id"]; |
|
$row[] = "<strong>" . $record["oggetto"] . "</strong>"; |
|
$row[] = mysql2date($record["scadenza"]); |
|
|
|
ob_start(); |
|
$richiedente = Utente::getInfoFromID($record["utente_creazione"]); |
|
echo $richiedente["cognome"] . " " . $richiedente["nome"]; |
|
$row[] = ob_get_clean(); |
|
|
|
$row[] = $enti[$record["codice_ente"]]["denominazione"] ?? ""; |
|
|
|
$tmpData = [ |
|
'codice' => $record['codice'], |
|
'stato' => $stato, |
|
'colore' => !empty($stato['colore']) ? $stato['colore'] : '', |
|
'titolo' => !empty($stato['titolo']) ? $stato['titolo'] : '', |
|
'id' => $record['id'], |
|
'oggetto' => $record['oggetto'], |
|
'richiedente' => $richiedente["cognome"] . " " . $richiedente["nome"], |
|
'beneficiario' => $enti[$record["codice_ente"]]["denominazione"] ?? "", |
|
'scadenza' => mysql2date($record["scadenza"]), |
|
]; |
|
|
|
ob_start(); |
|
?> |
|
<button class="btn btn-sm btn-success add-rda" data-params='<?= json_encode($tmpData) ?>'> |
|
<i class="fas fa-plus"></i> |
|
</button> |
|
<? |
|
$row[] = ob_get_clean(); |
|
$return["data"][] = $row; |
|
} |
|
|
|
} else { |
|
$return["data"] = array(); |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
|
|
echo json_encode($return); |
|
} |
|
} |
|
|
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?> |
|
|
|
|