From f91635c67cd0f07dba6086256bf0d2f4c6d17697 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Date: Thu, 14 Feb 2019 07:46:19 +0100 Subject: [PATCH] fixed errors in pdf reports Former-commit-id: fbc3598ab2dfd11cc2bfa850ba49b3e35481218d --- .../include/functions_reporting.php | 24 +++++++++++++++++++ .../include/functions_reporting_html.php | 16 ++++++++++--- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 2e2e2e6bd4..1aa9ecf618 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11334,3 +11334,27 @@ function reporting_translate_sla_status_for_graph($status) ]; return $sts[$status]; } + + +/** + * Print header to report pdf and add page break + * + * @param string $title Title of report. + * @param string $description Description of report. + * + * @return html Return table of header. + */ +function reporting_header_table_for_pdf(string $title='', string $description='') +{ + $result_pdf .= ''; + $result_pdf .= ''; + $result_pdf .= ''; + $result_pdf .= '
'; + $result_pdf .= $title; + $result_pdf .= ''; + $result_pdf .= '
'; + $result_pdf .= $description; + $result_pdf .= '
'; + + return $result_pdf; +} diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 84c4e0d7ba..2c29258d05 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2940,7 +2940,17 @@ function reporting_html_availability(&$table, $item) } -function reporting_html_availability_graph(&$table, $item, $pdf=0) +/** + * The availability report shows in detail the reached + * status of a module in a given time interval. + * + * @param string $table Reference table in pdf a false. + * @param array $item Parameters for item pdf. + * @param boolean $pdf Send pdf. + * + * @return html + */ +function reporting_html_availability_graph($table, $item, $pdf=0) { global $config; $metaconsole_on = is_metaconsole(); @@ -2999,7 +3009,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) } if ($item['type'] == 'availability_graph') { - // table_legend_graphs; + // Table_legend_graphs. $table2 = new stdClass(); $table2->width = '99%'; $table2->data = []; @@ -3040,7 +3050,7 @@ function reporting_html_availability_graph(&$table, $item, $pdf=0) $table->colspan['legend']['cell'] = 2; $table->data['legend']['cell'] = html_print_table($table2, true); - if ($pdf) { + if ($pdf !== 0) { return $tables_chart.'
'.html_print_table($table2, true); } }