summaryrefslogtreecommitdiff
path: root/autopdf.php
diff options
context:
space:
mode:
authorNiklas Olmes <niklas@olmes.de>2026-04-24 19:30:00 +0200
committerNiklas Olmes <niklas@olmes.de>2026-04-24 19:30:00 +0200
commitcdea8caa5617f0cb77bcbc9803759abd2df50644 (patch)
tree2f7f1bd3af3b2396baf5403ad1a7ad00bcb7fae9 /autopdf.php
stipcrmHEADmain
Diffstat (limited to 'autopdf.php')
-rw-r--r--autopdf.php79
1 files changed, 79 insertions, 0 deletions
diff --git a/autopdf.php b/autopdf.php
new file mode 100644
index 0000000..9afe246
--- /dev/null
+++ b/autopdf.php
@@ -0,0 +1,79 @@
+<?php
+/*
+ * 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 2 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.
+ */
+?>
+<?
+
+(function () use ($id, $pdf_sql, $pdf_file, $payload_sql, $independent_payload_sql, $payload_sql_order, $independent_payload_sql_order, $post_sql) {
+ if (!isset($pdf_file)) $pdf_file = "bescheid";
+ if (!isset($payload_sql_order)) $payload_sql_order = "";
+ if (!isset($independent_payload_sql)) $independent_payload_sql = "";
+ if (!isset($independent_payload_sql_order)) $independent_payload_sql_order = "";
+?>
+
+<div style="display: none;">
+ <form id="dopdf_<?=$id?>" action="/db/main/pdf.php" method="post">
+ <input id="dopdf_ids_<?=$id?>" name="ids" type="hidden" value="">
+ <input id="dopdf_sql_<?=$id?>" name="sql" type="hidden" value="<?=$pdf_sql?>">
+ <input id="dopdf_postsql_<?=$id?>" name="postsql" type="hidden" value="<?=$post_sql?>">
+ <input id="dopdf_file_<?=$id?>" name="file" type="hidden" value="<?=$pdf_file?>">
+
+ <input id="dopdf_payload_sql_<?=$id?>" name="payload_sql" type="hidden" value="<?=$payload_sql?>">
+ <input id="dopdf_payload_sql_order_<?=$id?>" name="payload_sql_order" type="hidden" value="<?=$payload_sql_order?>">
+ <input id="dopdf_independent_payload_sql_<?=$id?>" name="independent_payload_sql" type="hidden" value="<?=$independent_payload_sql?>">
+ <input id="dopdf_independent_payload_sql_order_<?=$id?>" name="independent_payload_sql_order" type="hidden" value="<?=$independent_payload_sql_order?>">
+ <input id="dopdf_nocount_<?=$id?>" name="nocount" type="hidden" value="<?=$nocount?>">
+ </form>
+</div>
+
+<script>
+<? minStart(); ?>
+
+function doPDF_<?=$id?>(ids) {
+ if (typeof ids === 'undefined') {
+ if (typeof autotables === 'undefined') {
+ ids = [];
+ $('#<?=$id?> tr.selected').each(function () {
+ ids.push($(this).attr('data-id'));
+ });
+ } else {
+ var g = $.grep(autotables['<?=$id?>'].table().rows().nodes(), function (e) {
+ return e.classList.contains('selected');
+ });
+ ids = [];
+ $.each(g, function (i, e) {
+ var ee = false;
+ var eee = false;
+ try { ee = e.getElementsByClassName('ajaxident')[0].getAttribute('data-id'); } catch (e) { e; }
+ try { eee = e.getElementsByClassName('ajaxident')[0].getAttribute('data-persid'); } catch (e) { e; }
+ if (ee) ids.push(ee);
+ else if (eee) ids.push(eee);
+ else if (e.getAttribute('data-id')) ids.push(e.getAttribute('data-id'))
+ else ids.push(e.getAttribute('data-persid'));
+ });
+ }
+ }
+ $('#dopdf_ids_<?=$id?>').val(ids);
+ $('#dopdf_<?=$id?>').submit();
+}
+
+if ($('#<?=$id?>Actions').length > 0) {
+ $('#<?=$id?>Actions').append('&nbsp;');
+ $('<button class="medium" onclick="return doPDF_<?=$id?>();"><i class="fas fa-file-pdf"></i> PDF generieren</button>').appendTo('#<?=$id?>Actions');
+}
+
+<? minEnd(); ?>
+</script>
+
+<?
+})();
+?>