fixed errors in pdf reports

Former-commit-id: fbc3598ab2dfd11cc2bfa850ba49b3e35481218d
This commit is contained in:
Daniel Barbero 2019-02-14 07:46:19 +01:00
parent eeb5f0e296
commit f91635c67c
2 changed files with 37 additions and 3 deletions

View File

@ -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 .= '<pagebreak>';
$result_pdf .= '<table class="header_table databox">';
$result_pdf .= '<thead class="header_tr"><tr>';
$result_pdf .= '<th class="th_first" colspan="2">';
$result_pdf .= $title;
$result_pdf .= '</th><th style="font-size: 15px;" align="right">';
$result_pdf .= '</th></tr><tr><th colspan="3" class="th_description">';
$result_pdf .= $description;
$result_pdf .= '</th></tr></thead></table>';
return $result_pdf;
}

View File

@ -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.'<br />'.html_print_table($table2, true);
}
}