#8365 PDF report added for ncm backups

This commit is contained in:
Jorge Rincon 2023-10-31 17:27:28 +01:00
parent dda21b162d
commit f5e7ac8d4a

View File

@ -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", '<br>', $row['diffstr']),
];
}
return html_print_table(
$table_ncm,
true
);
}
}