gest366/modules/campi_personalizzati/edit_riga.php

109 lines
3.8 KiB
PHP

<?php
include_once(__DIR__."/../../core.php");
$idrecord = $html->form('idrecord');
$idriga = $html->form('idriga');
$module_name = 'Campi Personalizzati';
$query = "SELECT * FROM `zz_campi_add` WHERE id='".$idriga."'";
$rs_tipi = $dbo->fetchArray( $query );
$dimensione=query_secca("","descrizione","zz_pannello_righe_dimensione","where descrizione ='".$rs_tipi[0]['dimensione']."'");
$iddimensione_edit=query_secca("","id","zz_pannello_righe_dimensione","where descrizione ='".$rs_tipi[0]['dimensione']."'");
$rs = $dbo->fetchArray("select id as idpannello , descrizione from zz_pannello_righe");
$n2 = sizeof($rs);
$rs_stati = $dbo->fetchArray("select id as iddimensione , descrizione from zz_pannello_righe_dimensione");
$n3 = sizeof($rs_stati);
echo "<label></label><br><br>\n";
echo "<form id=\"link_form\" action=\"".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$idrecord."\" method=\"post\">\n";
echo " <input type='hidden' name='idriga' value='".$idriga."'>\n";
echo " <input type='hidden' name='op' value='edit_campo'>\n";
echo " <input type='hidden' name='backto' value='record-edit'>\n";
//Seleziona tipologia documento
echo "<div class='row'>\n";
echo " <div class='col-md-4'>\n";
echo " <label>Label</label>\n";
echo " <input type='text' name='id_label' id='id_label' class='form-control' value='".$rs_tipi[0]['id_label']."'>\n";
echo " </div>\n";
// echo " <div class='col-md-4'>\n";
// echo " <label>Nome campo</label>\n";
// echo " <input type='text' name='id_campo' id='id_campo' class='form-control' value='".$rs_tipi[0]['id_campo']."'>\n";
// echo " </div>\n";
echo " <div class='col-md-4'>\n";
echo " <div class='form-group'>\n";
echo " <label>Dimensione</label>\n";
if( ($n3) == 0 ){
echo " ... Non ci sono dimensioni in archivio ...<br><br>\n";
echo " <input type=\"hidden\" id=\"iddimensione\" value=\"\">\n";
}
else{
echo " <select id=\"iddimensione\" name=\"iddimensione\" class=\"superselect\" onchange=\"$('#descrizione').val( $(this).find(':selected').text() ); ;\">\n";
echo " <option value=\"".$iddimensione_edit."\" >".$dimensione." </option>\n";
for( $i=0;$i<$n3;$i++ ){
echo " <option value=\"".$rs_stati[$i]['iddimensione']."\" >".$rs_stati[$i]['descrizione']." </option>\n";
}
}
echo " </select>\n";
echo " </div>\n";
echo " </div>\n";
echo " </div>\n";
echo " <a onclick=\"aggiorna();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-plus\"></i> Aggiorna</a>\n";
echo "</form>\n";
if( $rs_tipi[0]['deleted'] == '0' ) {
$testo_abilitato="Disabilita";
$op="unlink_campo";
}
if( $rs_tipi[0]['deleted'] == '1' ) {
$testo_abilitato="Abilita";
$op="abilita_campo";
}
echo " <form action='".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$idrecord."' method='post' id='delete-form-".$idrecord."' role='form'>\n";
echo " <input type='hidden' name='backto' value='record-edit'>\n";
echo " <input type='hidden' name='idriga' value='".$idriga."'>\n";
echo " <input type='hidden' name='op' value='".$op."'>\n";
echo " <div class='input-group-btn'>\n";
echo " <a class='btn btn-info pull-left' title='".$testo_abilitato." campo...' onclick=\"if( confirm('".$testo_abilitato." questo campo?') ){ $('#delete-form-".$idrecord."').submit(); }\"> ".$testo_abilitato."</a>\n";
echo " </div>\n";
echo " </form>\n";
?>
<script type="text/javascript">
function aggiorna(){
$("#link_form").submit();
}
$(document).ready( function(){
start_superselect();
start_inputmask();
});
</script>
<div class="clearfix"></div>