2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2024-04-10 09:49:42 +02:00
|
|
|
use Models\Plugin;
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
include_once __DIR__.'/core.php';
|
|
|
|
|
2018-01-12 16:23:26 +01:00
|
|
|
if (!empty($id_record) && !empty($id_module)) {
|
2020-09-23 17:53:19 +02:00
|
|
|
redirect(base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record);
|
2018-01-12 16:23:26 +01:00
|
|
|
} elseif (empty($id_module)) {
|
2020-09-23 17:53:19 +02:00
|
|
|
redirect(base_path().'/index.php');
|
2018-01-12 16:23:26 +01:00
|
|
|
}
|
|
|
|
|
2018-06-26 09:41:43 +02:00
|
|
|
include_once App::filepath('include|custom|', 'top.php');
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2018-07-18 16:12:25 +02:00
|
|
|
// Inclusione gli elementi fondamentali
|
2020-09-23 13:36:37 +02:00
|
|
|
include_once base_dir().'/actions.php';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2018-02-22 12:35:22 +01:00
|
|
|
// Widget in alto
|
|
|
|
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "position": "top", "place": "controller" )}';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2024-05-10 09:28:12 +02:00
|
|
|
$segmenti = $dbo->FetchArray('SELECT `id` FROM `zz_segments` WHERE `id_module` = '.prepare($id_module));
|
|
|
|
if ($segmenti) {
|
|
|
|
$segmenti = Modules::getSegments($id_module);
|
|
|
|
if (empty($segmenti)) {
|
|
|
|
echo '<div class="alert alert-warning">
|
|
|
|
<i class="fa fa-warning-circle"></i> '.tr("Questo gruppo di utenti non ha i permessi per visualizzare nessun segmento di questo modulo").'.
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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">
|
2024-05-16 18:02:50 +02:00
|
|
|
<li class="pull-left active header nav-item">
|
|
|
|
<a class="nav-link" data-widget="tab" href="#tab_0" >
|
2024-03-20 11:13:28 +01:00
|
|
|
<i class="'.$structure['icon'].'"></i> '.$structure->getTranslation('title');
|
2018-07-18 16:12:25 +02:00
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
// Pulsante "Aggiungi" solo se il modulo è di tipo "table" e se esiste il template per la popup
|
2018-09-19 10:44:32 +02:00
|
|
|
if ($structure->hasAddFile() && $structure->permission == 'rw') {
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
2024-05-16 18:02:50 +02:00
|
|
|
<br><button type="button" class="btn btn-primary" data-widget="modal" data-title="'.tr('Aggiungi').'..." data-href="add.php?id_module='.$id_module.'&id_plugin='.$id_plugin.'"><i class="fa fa-plus"></i></button>';
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|
2018-07-18 16:12:25 +02:00
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
|
|
|
</a>
|
|
|
|
</li>';
|
|
|
|
|
2024-04-10 09:49:42 +02:00
|
|
|
$plugins = Plugin::where('idmodule_to', $id_module)->where('position', 'tab_main')->where('enabled', 1)->get();
|
2018-07-18 16:12:25 +02:00
|
|
|
|
|
|
|
// Tab dei plugin
|
2017-08-04 16:28:16 +02:00
|
|
|
foreach ($plugins as $plugin) {
|
|
|
|
echo '
|
2024-05-16 18:02:50 +02:00
|
|
|
<li class="nav-item">
|
|
|
|
<a class="nav-link" data-widget="tab" href="#tab_'.$plugin->id.'" id="link-tab_'.$plugin->id.'">'.$plugin->getTranslation('title').'</a>
|
2017-08-04 16:28:16 +02:00
|
|
|
</li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</ul>
|
|
|
|
<div class="tab-content">
|
|
|
|
<div id="tab_0" class="tab-pane active">';
|
|
|
|
|
2020-09-23 13:36:37 +02:00
|
|
|
include base_dir().'/include/manager.php';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
</div>';
|
|
|
|
|
2018-07-18 15:20:10 +02:00
|
|
|
// Plugin
|
|
|
|
$module_record = $record;
|
2017-08-04 16:28:16 +02:00
|
|
|
foreach ($plugins as $plugin) {
|
2018-07-18 15:20:10 +02:00
|
|
|
$record = $module_record;
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
2024-04-10 09:49:42 +02:00
|
|
|
<div id="tab_'.$plugin->id.'" class="tab-pane">';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2024-04-10 09:49:42 +02:00
|
|
|
$id_plugin = $plugin->id;
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2020-09-23 13:36:37 +02:00
|
|
|
include base_dir().'/include/manager.php';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
echo '
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
|
2018-07-18 15:20:10 +02:00
|
|
|
$record = $module_record;
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
|
|
|
</div>
|
2018-02-22 12:35:22 +01:00
|
|
|
</div>';
|
2017-09-07 16:51:14 +02:00
|
|
|
|
2024-04-09 17:08:35 +02:00
|
|
|
redirectOperation($id_module, !empty($id_parent) ? $id_parent : $id_record);
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2020-08-25 09:29:32 +02:00
|
|
|
// Interfaccia per la modifica dell'ordine e della visibilità delle colonne (Amministratore)
|
2020-10-29 16:48:37 +01:00
|
|
|
if ($user->is_admin && string_contains($module['option'], '|select|')) {
|
2020-08-20 15:59:13 +02:00
|
|
|
echo '
|
2021-03-11 15:09:13 +01:00
|
|
|
<a class="btn btn-xs btn-default pull-right" style="margin-top: -1.25rem;" onclick="modificaColonne(this)">
|
2020-08-20 15:59:13 +02:00
|
|
|
<i class="fa fa-th-list"></i> '.tr('Modifica colonne').'
|
2021-03-11 15:09:13 +01:00
|
|
|
</a><div class="clearfix" > </div>
|
2020-08-20 15:59:13 +02:00
|
|
|
|
|
|
|
<script>
|
|
|
|
function modificaColonne(button) {
|
2021-03-17 15:13:40 +01:00
|
|
|
openModal("'.tr('Modifica colonne').'", globals.rootdir + "/actions.php?id_module=" + globals.id_module + "&op=aggiorna_colonne")
|
2020-08-20 15:59:13 +02:00
|
|
|
}
|
|
|
|
</script>';
|
|
|
|
}
|
|
|
|
|
2018-02-22 12:35:22 +01:00
|
|
|
// Widget in basso
|
|
|
|
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "position": "right", "place": "controller" )}';
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2018-06-26 09:41:43 +02:00
|
|
|
include_once App::filepath('include|custom|', 'bottom.php');
|