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.
90 righe
3.8 KiB
90 righe
3.8 KiB
<? |
|
$configPath = substr(__DIR__,0,strpos(__DIR__,"/public_html"))."/config.php"; |
|
include_once($configPath); |
|
$id_modulo = "criteri"; |
|
$cmd_info = gara::getInfoModulo($id_modulo); |
|
$error = true; |
|
if (!empty($_SESSION["utente"]) && $_SESSION["utente"]->permission($cmd_info["modulo_riferimento"]) && $_SESSION["utente"]->permission($radice,$_GET["codice_gara"],$id_modulo)) { |
|
$codice_round = $_GET["codice_round"] ?? NULL; |
|
$gara = gara::init($_GET["codice_gara"],$codice_round); |
|
if (!empty($gara)) { |
|
$record = $gara->info; |
|
$round = $gara->round; |
|
$lock = $gara->checkLock($cmd_info["id"]); |
|
$criterio = $gara->getCriteri($_GET["codice"])[0] ?? false; |
|
} |
|
if (!empty($criterio)) { |
|
$error = false; |
|
if (!$lock) { |
|
?> |
|
<form rel="validate" method="post" action="form/save.php" id="edit-form"> |
|
<input id="token" type="hidden" name="token" value="<?= tokenGen() ?>"> |
|
<input id="codice" type="hidden" name="codice_criterio" value="<?= $criterio["codice"] ?>"> |
|
<input id="codice_gara" type="hidden" name="codice_gara" value="<?= $record["codice"] ?>"> |
|
<input id="codice_round" type="hidden" name="codice_round" value="<?= $round["codice"] ?>"> |
|
<? } else { ?> |
|
<div id="edit-form"> |
|
<? } ?> |
|
<div class="card"> |
|
<div class="card-header"> |
|
<span class="card-title"><?= __("Quesiti") ?></span> |
|
</div> |
|
<div class="card-body" id="list-question"> |
|
<? |
|
$quesiti = $gara->getFormCriterio($_GET["codice"]); |
|
$showSave = false; |
|
if (!empty($quesiti)) { |
|
$showSave = true; |
|
foreach($quesiti AS $input) { |
|
$id = $input["codice"]; |
|
include("form/tr-edit.php"); |
|
} |
|
} |
|
|
|
?> |
|
</div> |
|
<? if (empty($lock)) { ?> |
|
<script> |
|
$( "#list-question" ).sortable({ |
|
handle: ".handle", |
|
update: function( event, ui ) { |
|
$(".input-edit","#list-question").each(function(index, el) { |
|
$(this).find(".ordinamento").val(index); |
|
}); |
|
} |
|
}); |
|
// $( "#sortable" ).disableSelection(); |
|
</script> |
|
<div class="card-footer"> |
|
<button onclick="aggiungi('form/tr-edit.php','#list-question'); $('#form-save').slideDown(); return false" class="btn btn-sm btn-info btn-block"><span class="fa fa-plus-circle"></span> <?= __("Aggiungi nuovo") ?></button> |
|
</div> |
|
</div> |
|
<button id="form-save" class="btn <?= ($showSave) ? "" :"collapse" ?> btn-success btn-block mt-2"><span class="fa fa-save"></span> <?= __("Salva") ?></button> |
|
</form> |
|
<? |
|
} else { |
|
?> |
|
</div> |
|
</div> |
|
<script>$(":input","#edit-form").not(".ignore-lock").attr("disabled","disabled").trigger("chosen:updated");</script> |
|
<? |
|
} |
|
?> |
|
<script> |
|
function addOption(id) { |
|
html = '<div class="input-group input-group-sm" style="margin-bottom:2px;">'; |
|
html += '<input type="text" rel="S;1;0;A" title="Option" class="input-sm form-control" name="input['+id+'][opzioni][]">'; |
|
html += '<div class="input-group-append"><button class="btn btn btn-sm btn-danger" onClick="$(this).parent().parent().remove(); return false;"><span class="fa fa-times"></span></button></div>'; |
|
html += '</div>'; |
|
$('#options-'+id+'-list').append(html); |
|
f_ready(); |
|
} |
|
</script> |
|
<? |
|
} |
|
} |
|
if ($error) { |
|
header('HTTP/1.0 403 Forbidden'); |
|
die(); |
|
} |
|
?>
|