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.
78 righe
3.3 KiB
78 righe
3.3 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"]) && $_SESSION["utente"]->permission($_GET["modulo"],$_GET["codice_elemento"])) { |
|
|
|
$return = array(); |
|
$return["draw"] = (int)$_GET["draw"]; |
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
$manager = new avvisiProcedura($_SESSION["ente"]->codice,$_GET["modulo"],$_GET["codice_elemento"],$_GET["sub"]); |
|
$total = $manager->getAvvisi("N"); |
|
if (!empty($total)) { |
|
$return["recordsTotal"] = (int)count($total); |
|
$filters = []; |
|
if (!empty($_GET["search"]["value"])) { |
|
$filters["*"] = $_GET["search"]["value"]; |
|
} |
|
|
|
$order = []; |
|
$orderKey = "data"; |
|
switch($_GET["order"][0]["column"]) { |
|
case "1": $orderKey = "titolo"; break; |
|
case "2": $orderKey = "data"; break; |
|
} |
|
if ($_GET["order"][0]["dir"] == "asc") { |
|
$order[$orderKey] = "ASC"; |
|
} else { |
|
$order[$orderKey] = "DESC"; |
|
} |
|
$risultati = $manager->getAvvisi("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-success"; |
|
$stato = __("Attivo"); |
|
if (strtotime($record["data"]) > time()) { |
|
$color = "bg-warning"; |
|
$stato = __("Programmato"); |
|
} |
|
} |
|
if ($record["attivo"] == "I") { |
|
$color = "bg-info"; |
|
$stato = __("Inviato ed attivo"); |
|
} |
|
$row = array(); |
|
$row[] = '<div id="flag_'.$record["codice"].'" class="status_flag '.$color.'"></div>'; |
|
$row[] = $stato; |
|
$row[] = $record["titolo"]; |
|
$row[] = mysql2datetime($record["data"]); |
|
if (!$_SESSION["utente"]->readOnly) { |
|
$row[] = "<button title='".__("modifica")."' class='btn btn-block btn-sm btn-primary' onclick='showModalWithURL(\"/backend/common/avvisi/edit.php?codice={$record["codice"]}&modulo={$manager->modulo}&codice_elemento={$manager->elemento}&sub={$manager->sub}\");'><span class='fa fa-edit'></span></button>"; |
|
$row[] = "<button title='".__("Attiva/Disattiva")."' class='btn btn-block btn-sm btn-warning' onclick='disabilita(".$record["codice"].",\"common/avvisi\");'><span class='fa fa-sync'></span></button>"; |
|
// $row[] = "<button title='".__("elimina")."' class='btn btn-block btn-sm btn-danger' onclick='elimina(".$record["codice"].",\"common/avvisi\");'><span class='fa fa-times'></span></button>"; |
|
} else { |
|
$row[] = ""; |
|
$row[] = ""; |
|
// $row[] = ""; |
|
} |
|
$return["data"][] = $row; |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
|
|
echo json_encode($return); |
|
} |
|
?>
|
|
|