2018-03-20 00:57:36 +01:00
< ? php
2018-03-22 15:40:20 +01:00
/*deve sempre essere impostato almeno un sezionale*/
if ( empty ( $_SESSION [ 'm' . $id_module ][ 'id_segment' ])) {
$rs = $dbo -> fetchArray ( 'SELECT id FROM zz_segments WHERE predefined = 1 AND id_module = ' . prepare ( $id_module ) . 'LIMIT 0,1' );
$_SESSION [ 'm' . $id_module ][ 'id_segment' ] = $rs [ 0 ][ 'id' ];
}
if ( count ( $dbo -> fetchArray ( " SELECT id FROM zz_segments WHERE id_module = \" $id_module\ " " )) > 1) {
?>
2018-03-20 00:57:36 +01:00
< div class = " row " >
< div class = " col-md-4 pull-right " >
2018-03-21 19:33:33 +01:00
{[ " type " : " select " , " label " : " " , " name " : " idsezionale_ " , " required " : 0 , " class " : " " , " values " : " query=SELECT id, name AS descrizione FROM zz_segments WHERE id_module = '<?php echo $id_module ; ?>' " , " value " : " <?php echo $_SESSION['m'.$id_module] ['id_segment']; ?> " , " extra " : " " ]}
2018-03-20 00:57:36 +01:00
</ div >
</ div >
< script >
$ ( document ) . ready ( function () {
$ ( " #idsezionale_ " ) . on ( " change " , function (){
if ( $ ( this ) . val () < 1 ){
2018-03-21 19:33:33 +01:00
session_set ( '<?php echo ' m '.$id_module; ?>,id_segment' , '' , 1 , 1 );
2018-03-20 00:57:36 +01:00
} else {
2018-03-21 19:33:33 +01:00
session_set ( '<?php echo ' m '.$id_module; ?>,id_segment' , $ ( this ) . val (), 0 , 1 );
2018-03-20 00:57:36 +01:00
}
});
});
2018-03-22 12:45:29 +01:00
</ script >
< ? php
2018-03-22 15:40:20 +01:00
}
2018-03-22 12:45:29 +01:00
?>