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.
127 righe
5.3 KiB
127 righe
5.3 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice)) { |
|
if (isset($_GET["draw"])) { |
|
|
|
$return = array(); |
|
$return["draw"] = (int)$_GET["draw"]; |
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
$colonnaEnte = false; |
|
$enti = $_SESSION["utente"]->getEntiBeneficiari(); |
|
if (!empty($enti)) { |
|
$enti[$_SESSION["ente"]->codice] = $_SESSION["ente"]->getInfo(); |
|
} |
|
$bind = array(":codice_gestore"=>$_SESSION["ente"]->codice); |
|
$sql = "SELECT b_programmi_art21.codice, |
|
b_programmi_art21.codice_ente, |
|
b_programmi_art21.tipologia, |
|
b_programmi_art21.anno, |
|
b_programmi_art21.invio_cpn, |
|
b_programmi_art21.stato |
|
FROM b_programmi_art21 |
|
WHERE b_programmi_art21.codice > 0 "; |
|
if (!empty($_GET["ente"])) { |
|
$bind[":enteFiltro"] = $_GET["ente"]; |
|
$sql .= " AND b_programmi_art21.codice_ente = :enteFiltro "; |
|
} |
|
if (!$_SESSION["utente"]->fromHere()) { |
|
$sql .= " AND codice_ente = :codice_ente"; |
|
$bind[":codice_ente"] = $_SESSION["utente"]->codice_ente; |
|
} |
|
$risultati = $pdo->go($sql. " GROUP BY b_programmi_art21.codice",$bind); |
|
if ($risultati->rowCount() > 0) { |
|
$return["recordsTotal"] = (int)$risultati->rowCount(); |
|
|
|
if (isset($_GET["tipologia"]) && $_GET["tipologia"]!=="") { |
|
$bind[":tipologia"] = $_GET["tipologia"]; |
|
$sql .= " AND b_programmi_art21.tipologia = :tipologia "; |
|
} |
|
|
|
switch($_GET["order"][0]["column"]) { |
|
case "1": $order = "b_programmi_art21.stato "; break; |
|
case "2": $order = "b_programmi_art21.anno "; break; |
|
case "3": $order = "b_programmi_art21.tipologia "; break; |
|
default: $order = "b_programmi_art21.codice "; |
|
} |
|
if ($_GET["order"][0]["dir"] == "desc") { |
|
$order.= "DESC "; |
|
} else { |
|
$order.= "ASC "; |
|
} |
|
|
|
$sql .= " GROUP BY b_programmi_art21.codice ORDER BY " . $order . " "; |
|
if ($_GET["length"] !== "-1") { $sql.= "LIMIT ". (int)$_GET["start"] .", " . (int)$_GET["length"]; } |
|
$risultati = $pdo->go($sql,$bind); |
|
if ($risultati->rowCount() > 0) { |
|
$return["recordsFiltered"] = $return["recordsTotal"]; |
|
$return["data"] = array(); |
|
$stati = Programma::getStati(); |
|
$tipologie = Programma::tipologie(); |
|
while($record = $risultati->fetch(PDO::FETCH_ASSOC)) { |
|
$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["anno"]; |
|
$row[] = __($tipologie[$record["tipologia"]]); |
|
if (!empty($enti)) { |
|
$row[] = $enti[$record["codice_ente"]]["denominazione"] ?? ""; |
|
} |
|
ob_start(); |
|
?> |
|
<button class="btn btn-warning btn-sm" onClick="showModalWithURL('/backend/progetti/programmazione/edit.php?codice=<?= $record["codice"] ?>')" title="<?= __("Modifica") ?>"> |
|
<span class="fa fa-edit"></span> |
|
</button> |
|
<? |
|
$row[] = ob_get_clean(); |
|
ob_start(); |
|
?> |
|
<button class="btn btn-primary btn-sm" onClick="showModalWithURL('/backend/progetti/programmazione/pdf/list.php?codice=<?= $record["codice"] ?>')" title="<?= __("Schede") ?>"> |
|
<span class="fa fa-file"></span> |
|
</button> |
|
<? |
|
$row[] = ob_get_clean(); |
|
if ($_SESSION["utente"]->permission("cpn")) { |
|
ob_start(); |
|
?> |
|
<button class="btn btn-info btn-sm" onClick="showModalWithURL('/backend/progetti/programmazione/cpn/dialog.php?codice=<?= $record["codice"] ?>')" title="<?= __("Invio") ?>"> |
|
<span class="fa fa-paper-plane"></span> |
|
</button> |
|
<? |
|
$row[] = ob_get_clean(); |
|
if (!empty($record["invio_cpn"])) { |
|
ob_start(); |
|
if (empty($_SESSION["cpn"]["token"])) { |
|
?> |
|
<button class="btn btn-success btn-sm" onClick="showModalWithURL('/backend/progetti/programmazione/cpn/download.php?codice=<?= $record["codice"] ?>')" title="<?= __("Login") ?>"> |
|
<span class="fa fa-download"></span> |
|
</button> |
|
<? |
|
} else { |
|
?> |
|
<a class="btn btn-success btn-sm" href="/backend/progetti/programmazione/cpn/pdf.php?codice=<?= $record["codice"] ?>" title="<?= __("Download") ?>" target="_blank"> |
|
<span class="fa fa-download"></span> |
|
</a> |
|
<? |
|
} |
|
$row[] = ob_get_clean(); |
|
} else { |
|
$row[] = ""; |
|
} |
|
} |
|
|
|
$return["data"][] = $row; |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
|
|
echo json_encode($return); |
|
} |
|
} |
|
?>
|
|
|