From 3652ed92fe15467ae9eb815359c9791ab3737a1f Mon Sep 17 00:00:00 2001
From: Thomas Zilio
Date: Thu, 20 Aug 2020 15:59:13 +0200
Subject: [PATCH] Aggiunto riordinamento colonne integrato nel modulo
---
actions.php | 2 ++
controller.php | 13 +++++++++
include/colonne.php | 59 ++++++++++++++++++++++++++++++++++++++++
modules/viste/fields.php | 4 +--
4 files changed, 76 insertions(+), 2 deletions(-)
create mode 100644 include/colonne.php
diff --git a/actions.php b/actions.php
index d28f25a10..6742806af 100755
--- a/actions.php
+++ b/actions.php
@@ -255,6 +255,8 @@ elseif (post('op') == 'send-email') {
$mail->delete();
flash()->error(tr('Errore durante l\'invio email! Verifica i parametri dell\'account SMTP utilizzato.'));
}
+} elseif (filter('op') == 'aggiorna_colonne') {
+ include_once DOCROOT.'/include/colonne.php';
} elseif (filter('op') == 'visualizza_riferimenti') {
include_once DOCROOT.'/include/riferimenti/riferimenti.php';
} elseif (filter('op') == 'visualizza_righe_riferimenti') {
diff --git a/controller.php b/controller.php
index fca35c605..728a03313 100755
--- a/controller.php
+++ b/controller.php
@@ -78,6 +78,19 @@ echo '
redirectOperation($id_module, isset($id_parent) ? $id_parent : $id_record);
+if ($user->is_admin && str_contains($structure['option'], '|select|')) {
+ echo '
+
+ '.tr('Modifica colonne').'
+
+
+';
+}
+
// Widget in basso
echo '{( "name": "widgets", "id_module": "'.$id_module.'", "position": "right", "place": "controller" )}';
diff --git a/include/colonne.php b/include/colonne.php
new file mode 100644
index 000000000..a37cd5be8
--- /dev/null
+++ b/include/colonne.php
@@ -0,0 +1,59 @@
+'.tr('Trascina le colonne per riordinare la struttura della tabella principale').'.
+';
+
+$fields = $dbo->fetchArray('SELECT * FROM zz_views WHERE id_module='.prepare($id_module).' ORDER BY `order` ASC');
+foreach ($fields as $field) {
+ echo '
+
+
';
+
+ if ($field['visible']) {
+ echo '
+ '.$field['name'].' ';
+ } else {
+ echo '
+ '.$field['name'].' ';
+ }
+
+ echo '
+
+
+
';
+}
+
+echo '
+
+
+
+';
diff --git a/modules/viste/fields.php b/modules/viste/fields.php
index f6e716391..ea5425697 100755
--- a/modules/viste/fields.php
+++ b/modules/viste/fields.php
@@ -128,7 +128,7 @@ echo '
foreach ($fields as $field) {
echo '
-
+
';
if ($field['visible']) {
@@ -226,7 +226,7 @@ echo '
$(document).ready(function() {
$("#save").addClass("hide");
- $(".sortable" ).disableSelection();
+ $(".sortable").disableSelection();
$(".sortable").each(function() {
$(this).sortable({
axis: "y",