. */ include_once __DIR__.'/core.php'; use Carbon\Carbon; use Models\Module; // Disabilitazione dei campi $read_only = $structure->permission == 'r'; if (empty($id_record) && !empty($id_module) && empty($id_plugin)) { redirect(base_path().'/controller.php?id_module='.$id_module); } elseif (empty($id_record) && empty($id_module) && empty($id_plugin)) { redirect(base_path().'/index.php'); } include_once App::filepath('include|custom|', 'top.php'); if (!empty($id_record)) { Util\Query::setSegments(false); $query = Util\Query::getQuery($structure, [ 'id' => $id_record, ]); Util\Query::setSegments(true); } // Rimozione della condizione deleted_at IS NULL per visualizzare anche i record eliminati if (!empty($query)) { if (preg_match('/[`]*([a-z0-9_]*)[`]*[\.]*([`]*deleted_at[`]* IS NULL)/si', $query, $m)) { $query = str_replace(["\n", "\t"], ' ', $query); $conditions_to_remove = []; $condition = trim($m[0]); if (!empty($table_name)) { $condition = $table_name.'.'.$condition; } $conditions_to_remove[] = ' AND\s*'.$condition; $conditions_to_remove[] = $condition.'\s*AND '; foreach ($conditions_to_remove as $condition_to_remove) { $query = preg_replace('/'.$condition_to_remove.'/si', '', $query); } $query = str_replace($condition, '', $query); } } $has_access = !empty($query) ? $dbo->fetchNum($query) !== 0 : true; if ($has_access) { // Inclusione gli elementi fondamentali include_once base_dir().'/actions.php'; } if (empty($record) || !$has_access) { echo '

'. ' '.tr('Record non trovato').'

'.tr('Stai cercando di accedere ad un record eliminato o non presente').'.


'.tr('Indietro').'
'; } else { // Widget in alto echo '{( "name": "widgets", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "position": "top", "place": "editor" )}'; $advanced_sessions = setting('Attiva notifica di presenza utenti sul record'); if (!empty($advanced_sessions)) { $dbo->query('DELETE FROM zz_semaphores WHERE id_utente='.prepare(Auth::user()['id']).' AND posizione='.prepare($id_module.', '.$id_record)); $dbo->query('INSERT INTO zz_semaphores (id_utente, posizione, updated) VALUES ('.prepare(Auth::user()['id']).', '.prepare($id_module.', '.$id_record).', NOW())'); echo '

'.tr('Attenzione!').'

'.tr('I seguenti utenti stanno consultando questa scheda').':

'.tr('Prestare attenzione prima di effettuare modifiche, poiché queste potrebbero essere perse a causa di una sovrascrittura delle informazioni').'.

'; } echo '

'.$structure->getTranslation('title'); // Pulsante "Aggiungi" solo se il modulo è di tipo "table" e se esiste il template per la popup if ($structure->hasAddFile() && $structure->permission == 'rw') { echo ' '; } echo '

'; // Campi personalizzati echo '
{( "name": "custom_fields", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "position": "top" )}
{( "name": "custom_fields", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )}
'; if ($structure->permission != '-' && $structure->use_notes && $user->gruppo != 'Clienti') { echo '
'; include base_dir().'/plugins/notes.php'; echo '
'; } if ($structure->permission != '-' && $structure->use_checklists) { echo '
'; include base_dir().'/plugins/checks.php'; echo '
'; } // Informazioni sulle operazioni if (Auth::admin()) { echo '
'; $operations = $dbo->fetchArray('SELECT `zz_operations`.*, `zz_users`.`username` FROM `zz_operations` LEFT JOIN `zz_users` ON `zz_operations`.`id_utente` = `zz_users`.`id` WHERE id_module = '.prepare($id_module).' AND id_record = '.prepare($id_record).' ORDER BY `created_at` DESC LIMIT 200'); if (!empty($operations)) { foreach ($operations as $operation) { $description = $operation['op']; $icon = 'pencil-square-o'; $color = 'warning'; switch ($operation['op']) { case 'add': $description = tr('Creazione'); $icon = 'plus'; $color = 'success'; break; case 'update': $description = tr('Modifica'); $icon = 'pencil'; $color = 'info'; break; case 'delete': $description = tr('Eliminazione'); $icon = 'times'; $color = 'danger'; break; case 'copy': $description = tr('Duplicato'); $icon = 'clone'; $color = 'info'; break; } echo '
'.Carbon::parse($operation['created_at'])->diffForHumans().'

'.$description.'

'.$operation['username'].'
'; } echo '
'; } else { echo '
'.tr('Informazione:').' '.tr('Nessun log disponibile per questa scheda').'.
'; } echo '
'; } // Plugin $module_record = $record; foreach ($plugins as $plugin) { $record = $module_record; echo '
'; $id_plugin = $plugin['id']; include base_dir().'/include/manager.php'; echo '
'; } $record = $module_record; echo '
'; } redirectOperation($id_module, !empty($id_parent) ? $id_parent : $id_record); // Widget in basso echo '{( "name": "widgets", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'", "position": "right", "place": "editor" )}'; if (!empty($record)) { echo '
'.tr('Indietro').' '; } echo '