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.
 
 
 
 
 

110 righe
4.8 KiB

<?
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php";
include_once($configPath);
if (isset($_SESSION["utente"]) && isset($_GET["draw"]) && isset($_GET["modulo"]) && isset($_GET["codice_elemento"])) {
$return = array();
$return["draw"] = (int)$_GET["draw"];
$return["recordsTotal"] = (int)0;
$return["recordsFiltered"] = (int)0;
$manager = new richiesteOE($_GET["modulo"],$_GET["codice_elemento"],$_GET["sub"]);
$total = $manager->getRichieste("N");
if (!empty($total) && $manager->checkAdminPermission()) {
$infoModulo = richiesteOE::moduliAbilitati()[$manager->getModuloRiferimento()] ?? null;
$infoUtente = (!empty($infoModulo["riferimento_partecipante"]) && $infoModulo["riferimento_partecipante"] == "utente");
$return["recordsTotal"] = (int)count($total);
$filters = [];
if (!empty($_GET["search"]["value"])) {
$filters["*"] = $_GET["search"]["value"];
}
$order = [];
$orderKey = "data";
switch($_GET["order"][0]["column"]) {
case "3": $orderKey = "titolo"; break;
case "4": $orderKey = "data"; break;
case "5": $orderKey = "scadenza"; break;
case "6": $orderKey = "apertura"; break;
}
if ($_GET["order"][0]["dir"] == "desc") {
$order[$orderKey] = "DESC";
} else {
$order[$orderKey] = "ASC";
}
$risultati = $manager->getRichieste("N",$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();
foreach($risultati AS $record) {
$color = "bg-danger";
$stato = __("Disattivo");
if ($record["attivo"] == "S") {
$color = "bg-warning";
$stato = __("Attivo");
if (strtotime($record["scadenza"]) < time()) {
$stato = __("Scaduto");
}
}
$ooee = $manager->getOE($record["codice"]);
$count = 0;
$destinatari = "";
if (!empty($ooee)) {
foreach($ooee AS $oe) {
if ($infoUtente) {
$user = utente::getInfoFromID($oe["codice_operatore"]);
$destinatari .= $user["cognome"] . " " . $user["nome"] . "<br>";
} else if ($manager->modulo != "concorsi") {
$oeInfo = oeManager::getOE($oe["codice_operatore"]);
if (!empty($oeInfo["ragione_sociale"])) {
$destinatari .= $oeInfo["ragione_sociale"] . "<br>";
}
}
if (!empty($oe["sha256"])) {
$count++;
}
}
}
if (count($ooee) > 0) {
if ($count == count($ooee)) {
$color = "bg-success";
$stato = __("Completo");
}
$stato .= "<br><small>{$count} / " . count($ooee) . "</small>";
}
$row = array();
$row[] = '<div id="flag_'.$record["codice"].'" class="status_flag '.$color.'"></div>';
$row[] = $stato;
$row[] = __($manager->tipologie()[$record["tipologia"]]);
$row[] = $record["titolo"];
$row[] = mysql2datetime($record["data"]);
$row[] = mysql2datetime($record["scadenza"]);
$row[] = mysql2datetime($record["apertura"]);
$row[] = $destinatari;
$row[] = "<button title='".__("visualizza")."' class='btn btn-block btn-sm btn-info' onclick='showModalWithURL(\"/backend/common/richiesteOE/view.php?codice={$record["codice"]}&modulo={$manager->modulo}&codice_elemento={$manager->elemento}&sub={$manager->sub}\");'><span class='fa fa-search'></span></button>";
if (!$manager->lock) {
$row[] = "<button title='".__("richiedi integrazione")."' class='btn btn-block btn-sm btn-warning' onclick='showModalWithURL(\"/backend/common/richiesteOE/edit.php?codice=0&codice_derivazione={$record["codice"]}&modulo={$manager->modulo}&codice_elemento={$manager->elemento}&sub={$manager->sub}\");'><span class='fa fa-share'></span></button>";
} else {
$row[] = "";
}
if ($record["attivo"] != "S") {
$row[] = "<button title='".__("elimina")."' class='btn btn-block btn-sm btn-danger' onclick='elimina(".$record["codice"].",\"common/richiesteOE\",\"modulo={$manager->modulo}&codice_elemento={$manager->elemento}&sub={$manager->sub}\");'><span class='fa fa-times'></span></button>";
} else {
$row[] = "";
}
$return["data"][] = $row;
}
} else {
$return["data"] = array();
}
} else {
$return["data"] = array();
}
echo json_encode($return);
}
?>