fixed reports alerts pdf view

This commit is contained in:
daniel 2017-01-04 19:41:38 +01:00
parent 9a48e52208
commit 07a8109f7a
2 changed files with 24 additions and 15 deletions

View File

@ -98,7 +98,7 @@ function reporting_get_name($id_report) {
function reporting_make_reporting_data($report = null, $id_report, function reporting_make_reporting_data($report = null, $id_report,
$date, $time, $period = null, $type = 'dinamic', $date, $time, $period = null, $type = 'dinamic',
$force_width_chart = null, $force_height_chart = null) { $force_width_chart = null, $force_height_chart = null, $pdf= false) {
global $config; global $config;
@ -164,7 +164,8 @@ function reporting_make_reporting_data($report = null, $id_report,
case 'availability_graph': case 'availability_graph':
$report['contents'][] = reporting_availability_graph( $report['contents'][] = reporting_availability_graph(
$report, $report,
$content); $content,
$pdf);
break; break;
case 'sql': case 'sql':
$report['contents'][] = reporting_sql( $report['contents'][] = reporting_sql(
@ -4995,10 +4996,14 @@ function reporting_availability($report, $content, $date=false, $time=false) {
* Generates a structure the report. * Generates a structure the report.
* *
*/ */
function reporting_availability_graph($report, $content, $date=false, $time=false) { function reporting_availability_graph($report, $content, $pdf=false) {
global $config; global $config;
$return = array(); $return = array();
$return['type'] = 'availability_graph'; $return['type'] = 'availability_graph';
$ttl = 1;
if ($pdf){
$ttl = 2;
}
if (empty($content['name'])) { if (empty($content['name'])) {
$content['name'] = __('Availability'); $content['name'] = __('Availability');
@ -5287,7 +5292,7 @@ function reporting_availability_graph($report, $content, $date=false, $time=fals
$width_graph, $width_graph,
$height_graph, $height_graph,
$urlImage, $urlImage,
1, $ttl,
$raw_graph, $raw_graph,
false); false);

View File

@ -1610,7 +1610,7 @@ function reporting_html_network_interfaces_report($table, $item) {
/** /**
* Unified alert report HTML * Unified alert report HTML
*/ */
function reporting_html_alert_report($table, $item) { function reporting_html_alert_report($table, $item, $pdf = 0) {
$table->colspan['alerts']['cell'] = 3; $table->colspan['alerts']['cell'] = 3;
$table->cellstyle['alerts']['cell'] = 'text-align: left;'; $table->cellstyle['alerts']['cell'] = 'text-align: left;';
@ -1643,25 +1643,25 @@ function reporting_html_alert_report($table, $item) {
foreach ($information["alerts"] as $alert) { foreach ($information["alerts"] as $alert) {
$row['template'] = $alert["template"]; $row['template'] = $alert["template"];
$row['actions'] = '<ul>' . "\n"; $row['actions'] = '';
$row['fired'] = '<ul style="list-style-type: none;">' . "\n"; $row['fired'] = '';
foreach ($alert['actions'] as $action) { foreach ($alert['actions'] as $action) {
$row['actions'] .= '<li>' . $action['name'] . '</li>'; if ($action['name'] == "" ) { // Removed from retrieved hash
continue;
}
$row['actions'] .= '<div style="width: 100%;">' . $action['name'] . '</div>';
if (is_numeric($action['fired'])){ if (is_numeric($action['fired'])){
$row['fired'] .= '<li>' . date("Y-m-d H:i:s", $action['fired']) . '</li>'; $row['fired'] .= '<div style="width: 100%;">' . date("Y-m-d H:i:s", $action['fired']) . '</div>';
} }
else { else {
$row['fired'] .= '<li>' . $action['fired'] . '</li>'; $row['fired'] .= '<div style="width: 100%;">' . $action['fired'] . '</div>';
} }
} }
$row['actions'] .= '</ul>';
$row['fired'] .= '</ul>';
$row['tfired'] = '<ul style="list-style-type: none;">' . "\n"; $row['tfired'] = '';
foreach ($alert['template_fired'] as $fired) { foreach ($alert['template_fired'] as $fired) {
$row['tfired'] .= '<li>' . $fired . '</li>' . "\n"; $row['tfired'] .= '<div style="width: 100%;">' . $fired . '</div>' . "\n";
} }
$row['tfired'] .= '</ul>';
// Skip first td's to avoid repeat the agent and module names // Skip first td's to avoid repeat the agent and module names
$table1->data[] = $row; $table1->data[] = $row;
@ -1674,6 +1674,10 @@ function reporting_html_alert_report($table, $item) {
} }
} }
$table->data['alerts']['cell'] = html_print_table($table1, true); $table->data['alerts']['cell'] = html_print_table($table1, true);
if($pdf){
$table1->class = 'table-beauty pdf_alert_table';
return html_print_table($table1, true);
}
} }
function reporting_html_sql_graph($table, $item) { function reporting_html_sql_graph($table, $item) {