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.
140 righe
7.0 KiB
140 righe
7.0 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($radice)) { |
|
$breadcrumb = []; |
|
$breadcrumb["/impostazioni/index.php"] = __("Avanzate"); |
|
$breadcrumb[""] = __("Modelli"); |
|
include_once ($beRoot."/layout/top.php"); |
|
$sql = "SELECT * FROM b_modelli WHERE soft_delete = 'N' "; |
|
$risultato = $pdo->go($sql); |
|
if ($risultato->rowCount() > 0) { |
|
?> |
|
<div class="container-fluid pt-5"> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<p class="d-block display-4"> |
|
<?= Modulo::header($radice) ?> |
|
</p> |
|
</div> |
|
</div> |
|
</div> |
|
<div id="commands" class="mb-5"> |
|
<div class="commands container-fluid"> |
|
<div class="row"> |
|
<div class="col-12 text-right"> |
|
<button onclick="showModalWithURL('/backend/modelli-gara/edit.php?codice=0')" class="btn btn-success" title="<?= __('Aggiungi nuovo') ?>"><em class="fa fa-plus-circle mr-3"></em><?= __('Aggiungi nuovo') ?></a><br> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<div class="container-fluid"> |
|
<div class="row"> |
|
<div class="col-12"> |
|
<div class="card"> |
|
<div class="card-body"> |
|
<? |
|
$bind = array(); |
|
$sql = "SELECT * FROM b_impostazioni_modelli_gara WHERE soft_delete = 'N' ORDER BY ordinamento ASC, codice ASC"; |
|
$risultato = $pdo->go($sql,$bind); |
|
if ($risultato->rowCount() > 0) { |
|
?> |
|
<div class="table-responsive"> |
|
<table class="table table-striped table-hover table-condensed" id="tab-data" width="100%"> |
|
<thead> |
|
<tr> |
|
<th width="10"></th> |
|
<th width="10"></th> |
|
<th><?= __("Titolo") ?></th> |
|
<th><?= __("Tipo") ?></th> |
|
<th width="120"><?= __("Inizio validità") ?></th> |
|
<th width="120"><?= __("Fine validità") ?></th> |
|
<th width="10"></th> |
|
<th width="10"></th> |
|
</tr> |
|
</thead> |
|
<tbody id="sortable"> |
|
<? while($record = $risultato->fetch(PDO::FETCH_ASSOC)) { |
|
$stato = "bg-danger"; |
|
$stato_label = __('disattivo'); |
|
if ($record["attivo"]=="S") { |
|
$stato = "bg-success"; |
|
$stato_label = __('attivo'); |
|
} |
|
$norme = json_decode($record["norma"]); |
|
?> |
|
<tr> |
|
<td><span class="handle"><span class="fa fa-bars"></span></span></td> |
|
<td><div id="flag_<?= $record["codice"] ?>" class="status_flag <?= $stato ?>"><span class="sr-only"><?= $stato_label ?></span></div></td> |
|
<td> |
|
<input class="ordinamento" type="hidden" name="ordinamento[<?= $record["codice"] ?>]" value="<?= $record["ordinamento"] ?>"> |
|
<?= $record["titolo"]; ?><br> |
|
<? if (!empty($norme)) { |
|
foreach($norme AS $norma) { |
|
$norma = gara::riferimentiNormativi()[$norma]; |
|
echo "<small class='badge badge-info'>{$norma["label"]}</small>"; |
|
} |
|
} ?> |
|
</td> |
|
<td> |
|
<? |
|
if (strpos($record["tipo"],"__reserved-") !== false) { |
|
$code = explode("-",$record["tipo"]); |
|
$code = $code[1]; |
|
$ente = ente::getInfoFromID($code)[0] ?? null; |
|
if (!empty($ente)) { |
|
$record["tipo"] = str_replace("__reserved-{$ente["codice"]}-","",$record["tipo"]); |
|
?> |
|
<span class="badge badge-warning"><?= __("Riservato") ?>: <?= $ente["denominazione"] ?></span><br> |
|
<? |
|
} |
|
} |
|
echo $record["tipo"]; |
|
?> |
|
</td> |
|
<td class="text-center"><?= mysql2date($record["dataInizio"]) ?></td> |
|
<td class="text-center"><?= mysql2date($record["dataFine"]) ?></td> |
|
<td><button onClick="showModalWithURL('/backend/modelli-gara/edit.php?codice=<?= $record["codice"] ?>')" title='<?= __("modifica") ?>' class='btn-info btn btn-sm' style='padding-top:6px;'><span class='fa fa-pencil-alt'></span></a></td> |
|
<td><button title='<?= __("disabilita") ?>' class='btn btn-sm btn-warning' onclick='disabilita(<?= $record["codice"] ?>,"modelli-gara");'><span class='fa fa-sync'></span></button></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 |
|
}); |
|
} |
|
}); |
|
</script> |
|
</div> |
|
<? |
|
} else { |
|
alertManager::printWarningBox(__("Nessun risultato")); |
|
} |
|
?> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<? |
|
} else { |
|
alertManager::printAlertBox(__("Impossibile continuare"),__("Nessun modello disponibile") . "<a href='/backend/editor/index.php' class='btn btn-block btn-primary'>" . __("Gestisci modelli") ."</a>"); |
|
} |
|
include_once ($beRoot."/layout/bottom.php"); |
|
} else { |
|
echo '<meta http-equiv="refresh" content="0;URL=/index.php">'; |
|
die(); |
|
} |
|
?>
|
|
|