2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/core.php' ;
2018-01-12 16:23:26 +01:00
if ( ! empty ( $id_record ) && ! empty ( $id_module )) {
redirect ( ROOTDIR . '/editor.php?id_module=' . $id_module . '&id_record=' . $id_record );
} elseif ( empty ( $id_module )) {
redirect ( ROOTDIR . '/index.php' );
}
2017-08-04 16:28:16 +02:00
if ( file_exists ( $docroot . '/include/custom/top.php' )) {
include $docroot . '/include/custom/top.php' ;
} else {
include $docroot . '/include/top.php' ;
}
// Lettura parametri iniziali del modulo
2017-09-22 15:19:59 +02:00
$module = Modules :: get ( $id_module );
2017-08-04 16:28:16 +02:00
if ( empty ( $module ) || empty ( $module [ 'enabled' ])) {
2017-09-04 12:02:29 +02:00
die ( tr ( 'Accesso negato' ));
2017-08-04 16:28:16 +02:00
}
$module_dir = $module [ 'directory' ];
include $docroot . '/actions.php' ;
/*
* Widget top
*/
2018-01-12 16:23:26 +01:00
2017-11-14 17:42:09 +01:00
//se non sono mobile nascondo i widget controller_top
2018-01-12 16:23:26 +01:00
if ( ! isMobile ()) {
echo Widgets :: addModuleWidgets ( $id_module , 'controller_top' );
2017-11-14 17:42:09 +01:00
}
2017-08-04 16:28:16 +02:00
// Lettura eventuali plugins modulo da inserire come tab
echo '
< div class = " nav-tabs-custom " >
2017-10-08 18:28:26 +02:00
< ul class = " nav nav-tabs pull-right " id = " tabs " role = " tablist " >
2017-08-04 16:28:16 +02:00
< li class = " pull-left active header " > ' ;
// Verifico se ho impostato un nome modulo personalizzato
$name = $module [ 'title' ];
echo '
< a data - toggle = " tab " href = " #tab_0 " >
< i class = " '. $module['icon'] .' " ></ i > ' . $name ;
// Pulsante "Aggiungi" solo se il modulo è di tipo "table" e se esiste il template per la popup
if ( file_exists ( $docroot . '/modules/' . $module_dir . '/add.php' ) && $module [ 'permessi' ] == 'rw' ) {
echo '
2017-09-04 12:02:29 +02:00
< button type = " button " class = " btn btn-primary " data - toggle = " modal " data - title = " '.tr('Aggiungi').'... " data - target = " #bs-popup " data - href = " add.php?id_module='. $id_module .' " >< i class = " fa fa-plus " ></ i ></ button > ' ;
2017-08-04 16:28:16 +02:00
}
echo '
</ a >
</ li > ' ;
$plugins = $dbo -> fetchArray ( 'SELECT id, title FROM zz_plugins WHERE idmodule_to=' . prepare ( $id_module ) . " AND position='tab_main' AND enabled = 1 " );
foreach ( $plugins as $plugin ) {
echo '
< li >
< a data - toggle = " tab " href = " #tab_'. $plugin['id'] .' " id = " link-tab_'. $plugin['id'] .' " > '.$plugin[' title '].' </ a >
</ li > ' ;
}
echo '
</ ul >
< div class = " tab-content " >
< div id = " tab_0 " class = " tab-pane active " > ' ;
include $docroot . '/include/manager.php' ;
echo '
</ div > ' ;
// Inclusione contenuti varie tab dei plugin
foreach ( $plugins as $plugin ) {
echo '
< div id = " tab_'. $plugin['id'] .' " class = " tab-pane " > ' ;
$id_plugin = $plugin [ 'id' ];
include $docroot . '/include/manager.php' ;
echo '
</ div > ' ;
}
echo '
</ div >
</ div >
2017-09-07 16:51:14 +02:00
</ div > ' ;
2017-09-08 13:24:48 +02:00
redirectOperation ( $id_module , $id_record );
2017-08-04 16:28:16 +02:00
2018-01-12 16:23:26 +01:00
/*
2017-08-04 16:28:16 +02:00
* Widget laterali .
*/
// Controllo se ho widget per il lato destro dello schermo, altrimenti non creo la colonna di destra
2017-11-14 17:42:09 +01:00
//se sono mobile pesco anche i widget di controller_top
2018-01-12 16:23:26 +01:00
if ( isMobile ()) {
$extra_where = " OR location = 'controller_top' " ;
} else {
$extra_where = '' ;
2017-11-14 17:42:09 +01:00
}
2018-01-12 16:23:26 +01:00
$result_widgets = $dbo -> fetchArray ( 'SELECT `id`, `location`, `class` FROM `zz_widgets` WHERE `id_module`=' . prepare ( $id_module ) . " AND (`location`='controller_right' " . $extra_where . ' ) AND `enabled`=1 ORDER BY `order` ASC' );
2017-08-04 16:28:16 +02:00
if ( count ( $result_widgets ) > 0 ) {
echo '
< div class = " col-md-12 " > ' ;
echo Widgets :: addModuleWidgets ( $id_module , 'controller_right' );
echo '
</ div > ' ;
}
if ( file_exists ( $docroot . '/include/custom/bottom.php' )) {
include $docroot . '/include/custom/bottom.php' ;
} else {
include $docroot . '/include/bottom.php' ;
}