diff --git a/include/manager.php b/include/manager.php
index f024dd555..f2981b070 100644
--- a/include/manager.php
+++ b/include/manager.php
@@ -170,10 +170,34 @@ if (!empty($module_options) && $module_options != 'menu' && $module_options != '
-
-
-
-
+
';
+
+ if (Settings::get('Abilita esportazione Excel e PDF')) {
+ echo '
+
+
+
+
+
+
+
';
+ } else {
+ echo '
+
';
+ }
+
+ echo '
+
+
+
+
';
diff --git a/include/top.php b/include/top.php
index b73543feb..d6190638e 100644
--- a/include/top.php
+++ b/include/top.php
@@ -131,7 +131,7 @@ if (Auth::check()) {
ckeditorToolbar: [
["Undo","Redo","-","Cut","Copy","Paste","PasteText","PasteFromWord","-","Scayt", "-","Link","Unlink","-","Bold","Italic","Underline","Superscript","SpecialChar","HorizontalRule","-","NumberedList","BulletedList","Outdent","Indent","Blockquote","-","Styles","Format","Image","Table", "TextColor", "BGColor" ],
],
-
+
tempo_attesa_ricerche: '.get_var('Tempo di attesa ricerche in secondi').',
};
';
@@ -154,8 +154,17 @@ echo '
});
';
-if (!empty($debugbarRenderer) && Auth::check()) {
- echo $debugbarRenderer->renderHead();
+if (Auth::check()) {
+ if (!empty($debugbarRenderer)) {
+ echo $debugbarRenderer->renderHead();
+ }
+
+ if (Settings::get('Abilita esportazione Excel e PDF')) {
+ echo '
+
+
+ ';
+ }
}
$hide_sidebar = get_var('Nascondere la barra sinistra di default');
diff --git a/lib/functions.js b/lib/functions.js
index e294034c1..d7efe2b6d 100644
--- a/lib/functions.js
+++ b/lib/functions.js
@@ -108,19 +108,31 @@ $(document).ready(function () {
// Pulsanti di Datatables
$(".btn-csv").click(function (e) {
- var table = $(document).find("#" + $(this).parent().parent().parent().data("target")).DataTable();
+ var table = $(document).find("#" + $(this).closest("[data-target]").data("target")).DataTable();
table.buttons(0).trigger();
});
+ $(".btn-excel").click(function (e) {
+ var table = $(document).find("#" + $(this).closest("[data-target]").data("target")).DataTable();
+
+ table.buttons(3).trigger();
+ });
+
+ $(".btn-pdf").click(function (e) {
+ var table = $(document).find("#" + $(this).closest("[data-target]").data("target")).DataTable();
+
+ table.buttons(4).trigger();
+ });
+
$(".btn-copy").click(function (e) {
- var table = $(document).find("#" + $(this).parent().parent().parent().data("target")).DataTable();
+ var table = $(document).find("#" + $(this).closest("[data-target]").data("target")).DataTable();
table.buttons(1).trigger();
});
$(".btn-print").click(function (e) {
- var table = $(document).find("#" + $(this).parent().parent().parent().data("target")).DataTable();
+ var table = $(document).find("#" + $(this).closest("[data-target]").data("target")).DataTable();
table.buttons(2).trigger();
});
@@ -570,7 +582,8 @@ function start_datatables() {
style: 'multi',
selector: 'td:first-child'
},
- buttons: [{
+ buttons: [
+ {
extend: 'csv',
fieldSeparator: ";",
exportOptions: {
@@ -610,6 +623,22 @@ function start_datatables() {
}
}
},
+ {
+ extend: 'excel',
+ exportOptions: {
+ modifier: {
+ selected: true
+ }
+ }
+ },
+ {
+ extend: 'pdf',
+ exportOptions: {
+ modifier: {
+ selected: true
+ }
+ }
+ },
],
scroller: {
loadingIndicator: true
@@ -724,19 +753,9 @@ function start_datatables() {
if (api.rows({
selected: true
}).count() > 0) {
- container.find('.btn-csv').removeClass('disabled');
- container.find('.btn-print').removeClass('disabled');
- container.find('.btn-copy').removeClass('disabled');
- container.find('.btn-csv').attr('disabled', false);
- container.find('.btn-print').attr('disabled', false);
- container.find('.btn-copy').attr('disabled', false);
+ container.find('.table-btn').removeClass('disabled').attr('disabled', false);
} else {
- container.find('.btn-csv').addClass('disabled');
- container.find('.btn-print').addClass('disabled');
- container.find('.btn-copy').addClass('disabled');
- container.find('.btn-csv').attr('disabled', true);
- container.find('.btn-print').attr('disabled', true);
- container.find('.btn-copy').attr('disabled', true);
+ container.find('.table-btn').addClass('disabled').attr('disabled', true);
}
// Seleziona tutto
@@ -783,8 +802,6 @@ function start_datatables() {
selected.push(id);
} else {
var index = selected.indexOf("" + id);
- console.log(selected);
- console.log(id);
if (index > -1) {
delete selected[index];
}
@@ -811,19 +828,9 @@ function start_datatables() {
if (table.rows({
selected: true
}).count() > 0) {
- container.find('.btn-csv').removeClass('disabled');
- container.find('.btn-print').removeClass('disabled');
- container.find('.btn-copy').removeClass('disabled');
- container.find('.btn-csv').attr('disabled', false);
- container.find('.btn-print').attr('disabled', false);
- container.find('.btn-copy').attr('disabled', false);
+ container.find('.table-btn').removeClass('disabled').attr('disabled', false);
} else {
- container.find('.btn-csv').addClass('disabled');
- container.find('.btn-print').addClass('disabled');
- container.find('.btn-copy').addClass('disabled');
- container.find('.btn-csv').attr('disabled', true);
- container.find('.btn-print').attr('disabled', true);
- container.find('.btn-copy').attr('disabled', true);
+ container.find('.table-btn').addClass('disabled').attr('disabled', true);
}
}
});
diff --git a/update/2_4_1.sql b/update/2_4_1.sql
index f2a3e0003..f524d62ca 100644
--- a/update/2_4_1.sql
+++ b/update/2_4_1.sql
@@ -360,3 +360,6 @@ INSERT INTO `zz_settings` (`idimpostazione`, `nome`, `valore`, `tipo`, `editable
-- Categorie zz_files
ALTER TABLE `zz_files` ADD `category` varchar(100) AFTER `original`;
+
+-- Impostazione "Abilita esportazione Excel e PDF"
+INSERT INTO `zz_settings` (`idimpostazione`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES (NULL, 'Abilita esportazione Excel e PDF', '0', 'boolean', '1', 'Generali', 18);