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.
174 righe
9.0 KiB
174 righe
9.0 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice,$_GET["codice"])) { |
|
$bind = array(); |
|
$bind[":codice"]=$_GET["codice"]; |
|
$sql = "SELECT * FROM b_form WHERE codice = :codice AND soft_delete = 'N' "; |
|
$risultato = $pdo->go($sql,$bind); |
|
if ($risultato->rowCount() > 0) { |
|
$record = $risultato->fetch(PDO::FETCH_ASSOC); |
|
} else if (empty($_GET["codice"])) { |
|
$record = get_campi("b_form"); |
|
} |
|
if (!empty($record)) { |
|
$breadcrumb = array(); |
|
$breadcrumb["/impostazioni/index.php"] = __("Avanzate"); |
|
$breadcrumb["/".$radice."/"] = Modulo::getInfo($radice)["titolo"]; |
|
$breadcrumb[""] = __("Modifica"); |
|
include_once ($beRoot."/layout/top.php"); |
|
?> |
|
<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"] ?>"> |
|
<div id="commands" class="mb-5"> |
|
<div class="commands container-fluid"> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<button class="btn btn-primary"><span class="fa fa-save"></span> <?= __("Salva") ?></button> |
|
<? if (!empty($record["codice"])) { ?> |
|
<a href="edit-group.php?codice_form=<?= $record["codice"] ?>&codice=0" title="<?= __("Aggiungi nuovo") ?> <?= __("gruppo") ?>" class="btn btn-success"><span class="fa fa-plus-circle mr-3"></span> <?= __("Aggiungi nuovo") ?> <?= __("TAB") ?></a> |
|
<button title='<?= __("anteprima") ?>' class='btn btn-warning' onclick='showModalWithURL("preview.php?codice=<?= $record["codice"] ?>"); return false;'><span class='fa fa-search'></span> <?= __("Anteprima") ?></button> |
|
<button onClick="elimina(<?= $record["codice"] ?>,'form'); return false" class="btn btn-danger"><span class="fa fa-times"></span> <?= __("Elimina") ?></button> |
|
<? } ?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="card mb-3"> |
|
<div class="card-header"> |
|
<h4 class="mb-0"><?= __("Info") ?></h4> |
|
</div> |
|
<div class="card-body"> |
|
<div class="row"> |
|
<div class="col-sm-4"> |
|
<strong class="h4"><?= __("Titolo") ?></strong><br> |
|
<? |
|
foreach($lang_disp AS $sigla => $arrLang) { |
|
$input = array("name"=>"titolo","id"=>"form-titolo","title"=>__("Titolo")); |
|
$valori = json_decode($record["titolo"],TRUE); |
|
include("dict-form.php"); |
|
} |
|
?> |
|
</div> |
|
<div class="col-sm-8"> |
|
<strong class="h4"><?= __("Descrizione") ?></strong><br> |
|
<? |
|
foreach($lang_disp AS $sigla => $arrLang) { |
|
$input = array("name"=>"descrizione","id"=>"form-descrizione","title"=>__("Descrizione")); |
|
$valori = json_decode($record["descrizione"],TRUE); |
|
include("dict-form.php"); |
|
} |
|
?> |
|
</div> |
|
<div class="form-group col-sm-3"> |
|
<label>ID</label> |
|
<input type="text" id="form-id" class="form-control" name="id" value="<?= $record["id"] ?>" title="ID" rel="S;2;0;A"> |
|
</div> |
|
<div class="form-group col-sm-3"> |
|
<label><?= __("attivo") ?></label> |
|
<select class="form-control" id="form-attivo" name="attivo" rel="S;1;1;A" title="<?= __("attivo") ?>"> |
|
<option value=""><?= __("seleziona") ?></option> |
|
<option value="S">Si</option> |
|
<option value="N">No</option> |
|
</select> |
|
<? if (!empty($record["attivo"])) { ?> |
|
<script>$("#form-attivo").val('<?= $record["attivo"] ?>');</script> |
|
<? } ?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? if (!empty($record["codice"])) { ?> |
|
<div class="card"> |
|
<div class="card-body"> |
|
<div class="table-responsive" id="groups"> |
|
<? |
|
$sql = "SELECT * FROM b_form_group WHERE codice_form = :codice_form AND codice_gruppo = 0 AND soft_delete = 'N' ORDER BY ordinamento ASC"; |
|
$ris = $pdo->go($sql,array(":codice_form"=>$record["codice"])); |
|
if ($ris->rowCount() > 0) { |
|
?> |
|
<table class="table table-striped table-hover table-condensed"> |
|
<thead> |
|
<tr> |
|
<th width="10"></th> |
|
<th><?= __("Titolo") ?></th> |
|
<th><?= __("Descrizione") ?></th> |
|
<th width="10"><?= __("Multi") ?></th> |
|
<th width="10"></th> |
|
<th width="10"></th> |
|
<th width="10"></th> |
|
<th width="10"></th> |
|
</tr> |
|
</thead> |
|
<tbody id="sortable"> |
|
<? while($group = $ris->fetch(PDO::FETCH_ASSOC)) { |
|
$stato = "bg-disabled"; |
|
$stato_label = __('disattivo'); |
|
if ($group["attivo"]=="S") { |
|
$stato = "bg-active"; |
|
$stato_label = __('attivo'); |
|
} |
|
$group["titolo"] = json_decode($group["titolo"],true)[$_SESSION["language"]]; |
|
$group["descrizione"] = json_decode($group["descrizione"],true)[$_SESSION["language"]]; |
|
?> |
|
<tr id="gruppo-<?= $group["codice"] ?>"> |
|
<td> |
|
<input class="ordinamento" type="hidden" name="ordinamento[<?= $group["codice"] ?>]" value="<?= $group["ordinamento"] ?>"> |
|
<div id="flag_<?= $group["codice"] ?>" class="status_flag <?= $stato ?>"><span class="sr-only"><?= $stato_label ?></span></div> |
|
</td> |
|
<td><strong><?= $group["titolo"] ?></strong></td> |
|
<td><?= $group["descrizione"] ?></td> |
|
<td class="text-center"><?= $group["multi"] ?></td> |
|
<td> |
|
<a href="edit-group.php?codice_form=<?= $record["codice"] ?>&codice=<?= $group["codice"] ?>" title="<?= __("modifica") ?>" class="btn btn-sm btn-info" style="padding: 5px 8px"><span class="fa fa-pencil-alt"></span></a> |
|
</td> |
|
<td><button title="<?= __("Attiva/Disattiva") ?>" class='btn btn-sm btn-warning' onclick='disabilita("<?= $group["codice"] ?>","form/group"); return false;'><span class='fa fa-sync'></span></button></td> |
|
<td><button title="<?= __("elimina") ?>" class='btn btn-sm btn-danger' onclick='elimina("<?= $group["codice"] ?>","form/group"); return false;'><span class='fa fa-times'></span></button></td> |
|
<td> |
|
<span class="handle btn btn-sm btn-muted"><span class="fa fa-sort"></span></span> |
|
</td> |
|
</tr> |
|
<? } ?> |
|
</tbody> |
|
</table> |
|
<script> |
|
$( "#sortable" ).sortable({ |
|
handle: ".handle", |
|
update: function( event, ui ) { |
|
$("tr","#sortable").each(function(index, el) { |
|
$(this).find(".ordinamento").val(index); |
|
}); |
|
$.ajax({ |
|
type: "POST", |
|
url: 'save-order.php', |
|
data: $('.ordinamento').serialize(), |
|
async: true |
|
}); |
|
} |
|
}); |
|
// $( "#sortable" ).disableSelection(); |
|
</script> |
|
<? |
|
} |
|
?> |
|
</div> |
|
</div> |
|
<div class="card-footer"> |
|
<a href="edit-group.php?codice_form=<?= $record["codice"] ?>&codice=0" title="<?= __("Aggiungi nuovo") ?> <?= __("gruppo") ?>" class="btn btn-block btn-success"><span class="fa fa-plus-circle mr-3"></span> <?= __("Aggiungi nuovo") ?> <?= __("TAB") ?></a> |
|
</div> |
|
</div> |
|
<? } ?> |
|
|
|
</form> |
|
<? |
|
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(); |
|
} |
|
?>
|
|
|