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.
54 righe
2.1 KiB
54 righe
2.1 KiB
<?php |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (isset($_GET["draw"]) && isset($_SESSION["ente"]) && isset($_SESSION["utente"]) && empty($_SESSION["utente"]->oe)) { |
|
|
|
$return = array(); |
|
$return["draw"] = (int)$_GET["draw"]; |
|
$return["recordsTotal"] = (int)0; |
|
$return["recordsFiltered"] = (int)0; |
|
|
|
$comunicazioni = Communicator::getMyChats(); |
|
if (!empty($comunicazioni)) { |
|
$return["recordsTotal"] = (int)count($comunicazioni); |
|
if (!empty($_GET["search"]["value"])) { |
|
$search = $_GET["search"]["value"]; |
|
$comunicazioni = array_filter($comunicazioni,function($element) { |
|
global $search; |
|
foreach($element AS $e) { |
|
return (strpos($e,$search) !== false); |
|
} |
|
}); |
|
} |
|
|
|
if (!empty($comunicazioni)) { |
|
$return["recordsFiltered"] = $return["recordsTotal"]; |
|
$return["data"] = array(); |
|
foreach($comunicazioni AS $comunicazione) { |
|
$row = array(); |
|
ob_start(); |
|
$url = "/backend/comunicazioni/chat.php?fromList=1&ente={$comunicazione["codice_ente"]}&sezione={$comunicazione["sezione"]}&sub_elemento={$comunicazione["sub_elemento"]}&codice_elemento={$comunicazione["elemento"]}"; |
|
addBypassCheckURL($url); |
|
?> |
|
<a href="#" onClick="showModalWithURL('<?= $url ?>');" title="<?= __('visualizza') ?>"> |
|
<?= ($comunicazione["letto"] == "N") ? "<strong>" : ""; ?> |
|
<?= substr($comunicazione["corpo"],0,255) ?> |
|
<?= (strlen($comunicazione["corpo"]) > 255) ? "..." : "" ?> |
|
<?= ($comunicazione["letto"] == "N") ? "</strong>" : ""; ?> |
|
</a> |
|
<?php |
|
$row[] = ob_get_clean(); |
|
$row[] = Modulo::getInfo($comunicazione["sezione"])["titolo"] ?? ""; |
|
$row[] = mysql2datetime($comunicazione["timestamp"]); |
|
$return["data"][] = $row; |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
} else { |
|
$return["data"] = array(); |
|
} |
|
|
|
echo json_encode($return); |
|
} |
|
?>
|
|
|