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.
131 righe
5.8 KiB
131 righe
5.8 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"])) { |
|
$lock = false; |
|
$codice_messaggio = 0; |
|
$messaggio = ""; |
|
if (!empty($_GET["codice"])) { |
|
$consulenza = consulenza::init($_GET["codice"]); |
|
if (!empty($consulenza)) { |
|
$record = $consulenza->info; |
|
$messaggi = $consulenza->getMessaggi(); |
|
if (empty($record["stato"]) && !empty($messaggi)) { |
|
$codice_messaggio = $messaggi[0]["codice"]; |
|
$messaggio = $messaggi[0]["messaggio"]; |
|
} |
|
if ($record["stato"] == "100" && !empty($_SESSION["ente"]->codice)) { |
|
$lock = true; |
|
} |
|
} |
|
} else if (empty($_GET["codice"]) && !empty($_SESSION["ente"]) && consulenza::checkLimite($_SESSION["ente"]->codice)) { |
|
$record = get_campi("b_consulenze"); |
|
$messaggi = []; |
|
} |
|
if (!empty($record)) { |
|
$href = "/".$radice."/panel.php?codice=".$record["codice"]; |
|
|
|
$breadcrumb = array(); |
|
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb[""] = __("Quesito"); |
|
|
|
include_once ($beRoot."/layout/top.php"); |
|
if (!$lock) { |
|
?> |
|
<form rel="validate" method="post" action="save.php" id="edit-form"> |
|
<input id="token" type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input id="codice" type="hidden" name="codice" value="<?= $record["codice"] ?>"> |
|
<input id="stato" type="hidden" name="stato" value=""> |
|
<div id="commands" class="mb-5"> |
|
<div class="commands container-fluid"> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<button class="btn btn-sm btn-primary"><span class="fa fa-save"></span> <?= __("Salva") ?></button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? } else { ?><div id="edit-form"><?} ?> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<div class="form-group"> |
|
<? if (empty($record["stato"])) { ?> |
|
<label for="titolo"><?= __("Oggetto") ?></label> |
|
<input type="text" rel="S;0;0;A" name="titolo" id="titolo" title="<?= __("Oggetto") ?>" value="<?= $record["titolo"] ?>" class="form-control"> |
|
<? } else { ?> |
|
<strong class="card-title"><?= $record["titolo"] ?></strong> |
|
<? } ?> |
|
</div> |
|
</div> |
|
<div class="card-body"> |
|
<? |
|
if (!empty($messaggi) && !empty($record["stato"])) { |
|
foreach($messaggi AS $msg) { |
|
$utente = Utente::getInfoFromID($msg["utente_modifica"]) ?? null; |
|
?> |
|
<div class="row my-3"> |
|
<div class="col-10 <?= ($msg["tipo"] == "R") ? "offset-2" : "" ?>"> |
|
<div class="card"> |
|
<div class="card-body <?= ($msg["tipo"] == "R") ? "bg-dark text-white" : "bg-white text-dark" ?>"> |
|
<?= $msg["messaggio"] ?> |
|
</div> |
|
<div class="card-footer"> |
|
<div class="float-left"> |
|
<? filesManager::printList($msg["codice"],"consulenza","A",0,false); ?> |
|
</div> |
|
<div class="float-right"> |
|
<small> |
|
<?= mysql2completedate($msg["timestamp"]) ?> |
|
<? if (!empty($utente)) { ?> |
|
| |
|
<span class="fa fa-user"></span> <?= $utente["cognome"] . " " . $utente["nome"] ?> |
|
<? } ?> |
|
</small> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
} |
|
} |
|
?> |
|
<? if (!$lock) { ?> |
|
<input type="hidden" name="codice_messaggio" value="<?= $codice_messaggio ?>"> |
|
<textarea class="form-control ckeditor_full" rel="S;0;0;A" id="messaggio" name="messaggio" title="<?= __("Messaggio") ?>"><?= $messaggio ?></textarea> |
|
<div class="my-2"> |
|
<? |
|
filesManager::printForm("consulenza"); |
|
?> |
|
<? |
|
if (!empty($consulenza) && !empty($codice_messaggio)) { |
|
filesManager::printList($codice_messaggio,"consulenza"); |
|
} |
|
?> |
|
</div> |
|
<? } ?> |
|
</div> |
|
<? if (!$lock) { ?> |
|
<div class="card-footer"> |
|
<? if (empty($record["stato"])) { ?><button onClick="$('#stato').val('0');" class="btn btn-block btn-lg btn-primary"><span class="fa fa-save"></span> <?= __("Salva bozza") ?></button><? } ?> |
|
<button onClick="$('#stato').val('<?= (empty($_SESSION["utente"]->codice_ente)) ? "50" : "10" ?>');" class="btn btn-block btn-lg btn-success"><span class="fa fa-paper-plane"></span> <?= __("Salva e invia") ?></button> |
|
<? if (!empty($record["stato"])) { ?> |
|
<button onClick="$('#stato').val('100');" class="btn btn-block btn-lg btn-info"><span class="fa fa-check"></span> <?= __("Salva e chiudi") ?></button> |
|
<? } ?> |
|
</div> |
|
</div> |
|
</form> |
|
<? } else { ?> |
|
</div> |
|
<script>$(":input").not(".ignore-lock").attr("disabled","disabled").trigger("chosen:updated");</script> |
|
<? } |
|
include_once ($beRoot."/layout/bottom.php"); |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|