gest366/modules/campi_personalizzati/actions.php

71 lines
2.3 KiB
PHP
Raw Permalink Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once(__DIR__."/../../core.php");
switch( $html->form('op', 'post') ){
case "update":
if( $modules_info[$module_name]["permessi"] == 'rw' ){
array_push( $_SESSION['infos'], "Informazioni salvate correttamente!" );
}
break;
case "add_campo":
if( $modules_info[$module_name]["permessi"] == 'rw' ){
$id_label = save( $_POST['id_label'] );
$id_campo = save( $_POST['id_campo'] );
$iddimensione = $_POST['iddimensione'];
$rs_dimensione = $dbo->fetchArray("select descrizione from zz_pannello_righe_dimensione where id='".$iddimensione."'");
$query = "INSERT INTO zz_campi_add(id_module,id_label,id_campo,dimensione) VALUES ('".$id_record."','".$id_label."','".$id_campo."','".$rs_dimensione[0]['descrizione']."')";
$dbo->query($query);
$dbo->query("update zz_modules set campi_personalizzati='1' where id='".$id_record."'");
array_push( $_SESSION['infos'], "Aggiunto campo ".$id_label );
}
break;
case "edit_campo":
if( $modules_info[$module_name]["permessi"] == 'rw' ){
$idriga = save($_POST['idriga']);
$id_label = save( $_POST['id_label'] );
// $id_campo = save( $_POST['id_campo'] );
$iddimensione = $_POST['iddimensione'];
$rs_dimensione = $dbo->fetchArray("select descrizione from zz_pannello_righe_dimensione where id='".$iddimensione."'");
$query = "UPDATE zz_campi_add SET id_label=\"".$id_label."\" , dimensione=\"".$rs_dimensione[0]['descrizione']."\" WHERE id=\"".$idriga."\"";
$dbo->query( $query );
array_push( $_SESSION['infos'], "Campo modificato!" );
}
break;
case "unlink_campo":
if( $modules_info[$module_name]["permessi"] == 'rw' ){
$idriga = save($_POST['idriga']);
$query = "UPDATE zz_campi_add SET deleted='1' WHERE id=\"".$idriga."\"";
$dbo->query( $query );
array_push( $_SESSION['infos'], "Campo disabilitato!" );
}
break;
case "abilita_campo":
if( $modules_info[$module_name]["permessi"] == 'rw' ){
$idriga = save($_POST['idriga']);
$query = "UPDATE zz_campi_add SET deleted='0' WHERE id=\"".$idriga."\"";
$dbo->query( $query );
array_push( $_SESSION['infos'], "Campo abilitato!" );
}
break;
}
?>