From f5e7ac8d4af9a6aa6ac39b44f1e1313748f8a225 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Tue, 31 Oct 2023 17:27:28 +0100 Subject: [PATCH] #8365 PDF report added for ncm backups --- .../include/functions_reporting_html.php | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 8fc6f3cf79..76f0920e34 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -7389,44 +7389,57 @@ function reporting_html_ncm_config($table, $item, $pdf=0) /** * HTML content for ncm backup report. * - * @param array $item Content generated by reporting_ncm_config. + * @param array $item Content generated by reporting_ncm_backups. * * @return string HTML code. */ function reporting_html_ncm_backups($table, $item, $pdf=0) { - ui_require_javascript_file('diff2html-ui.min'); ui_require_css_file('diff2html.min'); ui_require_css_file('highlight.min'); ui_require_css_file('highlight/vs.min'); + ui_require_javascript_file('diff2html-ui.min'); ui_require_javascript_file('highlight.min'); ui_require_javascript_file('highlightjs-line-numbers.min'); ui_require_javascript_file('languages/plaintext.min'); ui_require_javascript_file('functions_ncm', ENTERPRISE_DIR.'/include/javascript/'); - // Create table info. + // Create table diff. $table_ncm = new stdClass(); $table_ncm->width = '100%'; $table_ncm->class = 'info_table'; $table_ncm->styleTable = 'table-layout: fixed;'; - $table_ncm->rowstyle['title'] = 'text-align: center; font-weight: bolder'; + $table_ncm->headstyle[0] = 'width: 250px'; $table_ncm->head = []; $table_ncm->head[0] = __('Date'); $table_ncm->head[1] = __('Diff'); $table_ncm->data = []; - foreach ($item['data'] as $key => $row) { - $table_ncm->data[] = [ - $row['updated_at'], - $row['diff'], - ]; - } if ($pdf === 0) { + foreach ($item['data'] as $key => $row) { + $table_ncm->data[] = [ + $row['updated_at'], + $row['diff'], + ]; + } + return $table->data[] = html_print_table( $table_ncm, true ); + } else { + foreach ($item['data'] as $key => $row) { + $table_ncm->data[] = [ + $row['updated_at'], + ($row['diffstr'] === '') ? $row['diff'] : str_replace("\n", '
', $row['diffstr']), + ]; + } + + return html_print_table( + $table_ncm, + true + ); } }