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.
60 righe
3.3 KiB
60 righe
3.3 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$response = ['error' => 'File non presente sul disco']; |
|
if(! empty($_POST["file"]) && isset($_POST["id"])) { |
|
$postVar = $_POST; |
|
$identifier = generateStrongPassword(9, false, 'lud'); |
|
|
|
if(!empty($_SESSION["ente"]) && $_SESSION["ente"]->hasModulo("archivio-documentale") && ! empty($_POST["modulo"]) && $_SESSION["utente"]->gerarchia <= 20) { |
|
|
|
$sql = "SELECT * FROM b_categorie_documentali WHERE b_categorie_documentali.soft_delete = :soft_delete"; |
|
$bind[":soft_delete"] = 'N'; |
|
|
|
if(! empty($_SESSION["ente"])) { |
|
$sql = "{$sql} AND (b_categorie_documentali.codice_ente IS NULL OR b_categorie_documentali.codice_ente = :codice_ente) AND b_categorie_documentali.codice NOT IN (SELECT codice_categoria FROM b_categorie_documentali_escluse WHERE codice_ente = :codice_ente)"; |
|
$bind[":codice_ente"] = $_SESSION["ente"]->codice; |
|
} |
|
|
|
$sql = "{$sql} AND (modulo = '' OR modulo = :modulo)"; |
|
$bind[":modulo"] = $_POST["modulo"]; |
|
|
|
$classificazione = $pdo->go($sql, $bind)->fetchAll(PDO::FETCH_ASSOC); |
|
|
|
} |
|
|
|
ob_start(); |
|
?> |
|
<div id="<?= $identifier ?>" class="card rounded-0 border-dark mb-2"> |
|
<input type="hidden" name="allegato<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>[<?= $identifier ?>][filename]" value="<?= $postVar["file"] ?>"> |
|
<div class="card-body"> |
|
<div class="row"> |
|
<div class="form-group col-<?= ! empty($classificazione) ? 8 : 12 ?>"> |
|
<label for="nome<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>"><i class="far fa-file-alt mr-2"></i>Nome file: (<?= sanitize_string($postVar["file"]) ?>)</label> |
|
<input id="nome<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>" type="text" name="allegato<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>[<?= $identifier ?>][nome]" value="<?= sanitize_string($postVar["file"]) ?>" rel="S;3;0;A" class="form-control"> |
|
</div> |
|
<? if(! empty($classificazione)) : ?> |
|
<div class="form-group col-4"> |
|
<label for="classificazione<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>"><i class="fas fa-clipboard-list mr-2"></i>Classificazione: </label> |
|
<select class="form-control custom-select" name="allegato<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>[<?= $identifier ?>][classificazione]" id="classificazione<?= ! empty($postVar["id"]) ? "-{$postVar["id"]}" : null ?>"> |
|
<option value="">Nessuna</option> |
|
<? foreach($classificazione as $elemento) : ?> |
|
<option value="<?= $elemento["codice"] ?>"><?= $elemento["titolo"] ?></option> |
|
<? endforeach ?> |
|
</select> |
|
</div> |
|
<? endif ?> |
|
</div> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<button type="button" onClick="$('#<?= $identifier ?>').remove();" class="btn btn-block btn-danger btn-sm"><i class="fa fa-trash-alt mr-3"></i>Elimina</button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
$response["html"] = ob_get_clean(); |
|
unset($response['error']); |
|
} |
|
echo json_encode($response, JSON_FORCE_OBJECT); |
|
?>
|
|
|