openstamanager/controller.php

116 lines
3.8 KiB
PHP
Raw Normal View History

<?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/>.
*/
include_once __DIR__.'/core.php';
if (!empty($id_record) && !empty($id_module)) {
redirect(base_path().'/editor.php?id_module='.$id_module.'&id_record='.$id_record);
} elseif (empty($id_module)) {
redirect(base_path().'/index.php');
}
2018-06-26 09:41:43 +02:00
include_once App::filepath('include|custom|', 'top.php');
// Inclusione gli elementi fondamentali
include_once base_dir().'/actions.php';
2018-02-22 12:35:22 +01:00
// Widget in alto
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "position": "top", "place": "controller" )}';
// Lettura eventuali plugins modulo da inserire come tab
echo '
<div class="nav-tabs-custom">
<ul class="nav nav-tabs pull-right" id="tabs" role="tablist">
<li class="pull-left active header">
<a data-toggle="tab" href="#tab_0">
2018-09-19 10:44:32 +02:00
<i class="'.$structure['icon'].'"></i> '.$structure['title'];
// 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') {
echo '
2018-10-25 17:11:02 +02:00
<button type="button" class="btn btn-primary" data-toggle="modal" data-title="'.tr('Aggiungi').'..." data-href="add.php?id_module='.$id_module.'&id_plugin='.$id_plugin.'"><i class="fa fa-plus"></i></button>';
}
echo '
</a>
</li>';
2024-03-05 16:01:45 +01:00
$plugins = $dbo->fetchArray('SELECT `zz_plugins`.`id`,`title` FROM `zz_plugins` LEFT JOIN `zz_plugins_lang` ON (`zz_plugins`.`id` = `zz_plugins_lang`.`id_record` AND `zz_plugins_lang`.`id_lang` = '.setting('Lingua').') WHERE `idmodule_to`='.prepare($id_module)." AND `position`='tab_main' AND `enabled` = 1");
// Tab dei plugin
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 base_dir().'/include/manager.php';
echo '
</div>';
2018-07-18 15:20:10 +02:00
// Plugin
$module_record = $record;
foreach ($plugins as $plugin) {
2018-07-18 15:20:10 +02:00
$record = $module_record;
echo '
<div id="tab_'.$plugin['id'].'" class="tab-pane">';
$id_plugin = $plugin['id'];
include base_dir().'/include/manager.php';
echo '
</div>';
}
2018-07-18 15:20:10 +02:00
$record = $module_record;
echo '
</div>
2018-02-22 12:35:22 +01:00
</div>';
2018-07-09 12:57:55 +02:00
redirectOperation($id_module, isset($id_parent) ? $id_parent : $id_record);
// Interfaccia per la modifica dell'ordine e della visibilità delle colonne (Amministratore)
if ($user->is_admin && string_contains($module['option'], '|select|')) {
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)">
<i class="fa fa-th-list"></i> '.tr('Modifica colonne').'
2021-03-11 15:09:13 +01:00
</a><div class="clearfix" >&nbsp;</div>
<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")
}
</script>';
}
2018-02-22 12:35:22 +01:00
// Widget in basso
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "position": "right", "place": "controller" )}';
2018-06-26 09:41:43 +02:00
include_once App::filepath('include|custom|', 'bottom.php');