From 7db3e3bb2b52c03290523778e550416ddb761d8e Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Mon, 30 Oct 2023 17:20:58 +0100 Subject: [PATCH] #8365 Added html report for ncm backups --- .../include/functions_reporting_html.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 99f3af63ad..8fc6f3cf79 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -480,6 +480,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1, $cust reporting_html_ncm_config($table, $item); break; + case 'ncm_backups': + reporting_html_ncm_backups($table, $item); + break; + case 'top_n_agents_sh': reporting_html_top_n_agents_sh($table, $item); break; @@ -7380,3 +7384,49 @@ function reporting_html_ncm_config($table, $item, $pdf=0) return $content; } } + + +/** + * HTML content for ncm backup report. + * + * @param array $item Content generated by reporting_ncm_config. + * + * @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('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. + $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->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) { + return $table->data[] = html_print_table( + $table_ncm, + true + ); + } + +}