getPubblicazioni(); 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"] == "desc") { $order[$orderKey] = "DESC"; } else { $order[$orderKey] = "ASC"; } $risultati = $manager->getPubblicazioni($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) { $row = array(); $row[] = $record["titolo"]; $row[] = mysql2date($record["data"]); $row[] = ""; $row[] = ""; $return["data"][] = $row; } } else { $return["data"] = array(); } } else { $return["data"] = array(); } echo json_encode($return); } ?>