From 0ac2969c6659e66c20a883a315e7afaffa8ea01d Mon Sep 17 00:00:00 2001 From: arman Date: Thu, 27 Feb 2025 19:40:07 +0000 Subject: [PATCH] prepare pdf-manager setup --- admin/helper_functions.inc.php | 29 +++++++++++++++++++++++++++++ admin/index.php | 2 +- admin/reports.inc.php | 7 +++++++ admin/reports_editor.php | 2 +- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 admin/helper_functions.inc.php diff --git a/admin/helper_functions.inc.php b/admin/helper_functions.inc.php new file mode 100644 index 00000000..88ddcddd --- /dev/null +++ b/admin/helper_functions.inc.php @@ -0,0 +1,29 @@ + $template_id, + 'inputs' => $inputs + ); + $postfields_json = json_encode($data); + + $ch = curl_init(); + error_log($postfields_json); + curl_setopt($ch, CURLOPT_URL,"http://10.15.183.210:3000/api/generate_pdf"); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields_json); + curl_setopt($ch, CURLOPT_HTTPHEADER, array( + 'Content-Type: application/json', + 'Connection: Keep-Alive' + )); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + $server_output = curl_exec($ch); + + curl_close($ch); +} +?> \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 48e32b3d..555fe335 100644 --- a/admin/index.php +++ b/admin/index.php @@ -67,7 +67,7 @@ echo " \n"; echo ' '; echo ' ' . theme_icon('print/export_reports') . '
' . i18n('Print / Export Reports') . '
'; echo ' ' . theme_icon('print_awards_ceremony_scripts') . '
' . i18n('Print Award Ceremony Scripts') . '
'; -//echo ' ' . theme_icon('report_management') . '
' . i18n('Report Management') . '
'; +echo ' ' . theme_icon('report_management') . '
' . i18n('Report Management') . '
'; //echo ' ' . theme_icon('translations_management') . '
' . i18n('Translations Management') . '
'; echo ''; diff --git a/admin/reports.inc.php b/admin/reports.inc.php index f230b724..49644e78 100644 --- a/admin/reports.inc.php +++ b/admin/reports.inc.php @@ -37,6 +37,7 @@ require_once("reports_tours.inc.php"); require_once("reports_fairs.inc.php"); require_once("reports_fundraising.inc.php"); + require_once("helper_functions.inc.php"); //require_once('../lpdf.php'); require_once('../lcsv.php'); @@ -628,6 +629,12 @@ foreach($report['col'] as $v) break; case 'pdf': case '': /* FIXME: handle landscape pages in here */ + $inputs = array( + "fairname" => i18n($config['fairname']), + ); + + generate_pdf($_GET['id'], $inputs); + $label_stock = $report_stock[$report['option']['stock']]; $rep=new lpdf( i18n($config['fairname']), i18n($report['name']), diff --git a/admin/reports_editor.php b/admin/reports_editor.php index 8b331176..f9774e4d 100644 --- a/admin/reports_editor.php +++ b/admin/reports_editor.php @@ -38,7 +38,7 @@ require_once ('reports_tours.inc.php'); require_once ('reports_fairs.inc.php'); require_once ('reports_fundraising.inc.php'); require_once ('reports.inc.php'); -require_once ('../tcpdf.inc.php'); +// require_once ('../tcpdf.inc.php'); $fields = array(); $locs = array('X' => 'x', 'Y' => 'y', 'W' => 'w', 'H' => 'h', 'Lines' => 'lines');