. */ use HTMLBuilder\HTMLBuilder; use Models\Module; use Models\Plugin; include_once __DIR__.'/../core.php'; // Compatibilità per controller ed editor if (!empty($id_plugin)) { $structure = Plugin::find($id_plugin); } else { $structure = Module::find($id_module); } if (!empty($id_plugin)) { // Inclusione di eventuale plugin personalizzato if (!empty($structure['script'])) { $path = $structure->getEditFile(); if (!empty($path)) { include $path; } return; } echo '

'.$structure->getTranslation('title').(!empty($structure['help']) ? ' ' : '').''; if ($structure->hasAddFile()) { echo ' '; } echo '

'; } $type = $structure['option']; // Lettura risultato query del modulo // include $structure->filepath('init.php'); // Caricamento file aggiuntivo su elenco record $controller_before = $structure->filepath('controller_before.php'); if (!empty($controller_before)) { include $controller_before; } /* * Datatables con record */ if (!empty($type) && $type != 'menu' && $type != 'custom') { $total = Util\Query::readQuery($structure); if (empty($id_plugin) && count(Modules::getSegments($id_module)) > 1) { echo '
{[ "type": "select", "name": "id_segment_", "required": 0, "ajax-source": "segmenti", "select-options": '.json_encode(['id_module' => $id_module]).', "value": "'.$_SESSION['module_'.$id_module]['id_segment'].'" ]}
'; echo ' '; } // Reset della selezione precedente $_SESSION['module_'.$id_module]['selected'] = []; $selezione = array_keys($_SESSION['module_'.$id_module]['selected']); $table_id = 'main_'.random_int(0, 99); echo ' '; foreach ($total['fields'] as $key => $field) { $attr_td = ''; $name = trim((string) $field); // Check per tipologie di campi particolari if (preg_match('/^color_/', (string) $field)) { $attr_td .= " width='140'"; $field = str_replace('color_', '', $field); } // Data (larghezza fissa) elseif (preg_match('/^Data/', (string) $field)) { $attr_td .= " width='100'"; } // Icona di stampa elseif (trim((string) $field) == '_print_') { $attr_td .= " width='30'"; $field = str_replace('_print_', '', $field); } elseif (preg_match('/^icon_/', (string) $field)) { $attr_td .= " width='30'"; $name = str_replace('icon_', 'icon_title_', $name); $field = str_replace('icon_', '', $field); } elseif (preg_match('/^mailto_/', (string) $field)) { $field = str_replace('mailto_', '', $field); } elseif (preg_match('/^tel_/', (string) $field)) { $field = str_replace('tel_', '', $field); } if (isMobile()) { $attr_td .= " style='min-width:100px;'"; } echo ' '.$field.''; } echo ' '; echo ' '; foreach ($total['fields'] as $key => $field) { echo ' '; } echo '
'; echo '
'; if (!empty($bulk) && $structure->permission == 'rw' && empty($id_plugin)) { echo '
'; } echo '
'; if (setting('Abilita esportazione Excel e PDF')) { echo '
'; } else { echo ' '; } echo '
'; } /* * Inclusione modulo personalizzato */ elseif ($type == 'custom') { $path = $structure->getEditFile(); if (!empty($path)) { include $path; } } // Caricamento file aggiuntivo su elenco record $controller_after = $structure->filepath('controller_after.php'); if (!empty($controller_after)) { include $controller_after; }