mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
fixed pdf report
Former-commit-id: 515b8f06f3584c6aaa1a32ea29a2f555e7afccad
This commit is contained in:
parent
ec97e54dec
commit
20e0508e01
@ -261,7 +261,7 @@ function reporting_make_reporting_data(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($content['style']['name_label'])) {
|
if (isset($content['style']['name_label'])) {
|
||||||
// Add macros name
|
// Add macros name.
|
||||||
$items_label = [];
|
$items_label = [];
|
||||||
$items_label['type'] = $content['type'];
|
$items_label['type'] = $content['type'];
|
||||||
$items_label['id_agent'] = $content['id_agent'];
|
$items_label['id_agent'] = $content['id_agent'];
|
||||||
@ -272,11 +272,10 @@ function reporting_make_reporting_data(
|
|||||||
$metaconsole_on = is_metaconsole();
|
$metaconsole_on = is_metaconsole();
|
||||||
$server_name = $content['server_name'];
|
$server_name = $content['server_name'];
|
||||||
|
|
||||||
// Metaconsole connection
|
// Metaconsole connection.
|
||||||
if ($metaconsole_on && $server_name != '') {
|
if ($metaconsole_on && $server_name != '') {
|
||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
if (!metaconsole_load_external_db($connection)) {
|
if (!metaconsole_load_external_db($connection)) {
|
||||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -889,7 +888,6 @@ function reporting_SLA(
|
|||||||
if ($metaconsole_on && $server_name != '') {
|
if ($metaconsole_on && $server_name != '') {
|
||||||
$connection = metaconsole_get_connection($server_name);
|
$connection = metaconsole_get_connection($server_name);
|
||||||
if (!metaconsole_load_external_db($connection)) {
|
if (!metaconsole_load_external_db($connection)) {
|
||||||
// ui_print_error_message ("Error connecting to ".$server_name);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -898,7 +896,7 @@ function reporting_SLA(
|
|||||||
|| modules_is_not_init($sla['id_agent_module'])
|
|| modules_is_not_init($sla['id_agent_module'])
|
||||||
) {
|
) {
|
||||||
if ($metaconsole_on) {
|
if ($metaconsole_on) {
|
||||||
// Restore db connection
|
// Restore db connection.
|
||||||
metaconsole_restore_db();
|
metaconsole_restore_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ function html_do_report_info($report)
|
|||||||
|
|
||||||
$date_today = date($config['date_format']);
|
$date_today = date($config['date_format']);
|
||||||
|
|
||||||
$html = '<div style="border: 1px dashed #999; padding: 10px 15px; background: #f5f5f5;margin-top:20px;margin-bottom:20px;">'.'<table>
|
$html = '<div style="border: 1px dashed #999; padding: 10px 15px; background: #f5f5f5;margin-top:20px;margin-bottom:20px;"><table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
|
<td><b>'.__('Generated').': </b></td><td>'.$date_today.'</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -397,9 +397,20 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function reporting_html_SLA($table, $item, $mini)
|
function reporting_html_SLA($table, $item, $mini, $pdf=0)
|
||||||
{
|
{
|
||||||
$style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']);
|
if ($table === false) {
|
||||||
|
$table = new stdClass();
|
||||||
|
$table->width = '99%';
|
||||||
|
$table->class = 'table_beauty';
|
||||||
|
}
|
||||||
|
|
||||||
|
$style = db_get_value(
|
||||||
|
'style',
|
||||||
|
'treport_content',
|
||||||
|
'id_rc',
|
||||||
|
$item['id_rc']
|
||||||
|
);
|
||||||
$style = json_decode(io_safe_output($style), true);
|
$style = json_decode(io_safe_output($style), true);
|
||||||
$same_agent_in_resume = '';
|
$same_agent_in_resume = '';
|
||||||
|
|
||||||
@ -423,7 +434,9 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
$table->data['sla']['cell'] = $item['failed'];
|
$table->data['sla']['cell'] = $item['failed'];
|
||||||
} else {
|
} else {
|
||||||
if (!empty($item['planned_downtimes'])) {
|
if (!empty($item['planned_downtimes'])) {
|
||||||
$downtimes_table = reporting_html_planned_downtimes_table($item['planned_downtimes']);
|
$downtimes_table = reporting_html_planned_downtimes_table(
|
||||||
|
$item['planned_downtimes']
|
||||||
|
);
|
||||||
|
|
||||||
if (!empty($downtimes_table)) {
|
if (!empty($downtimes_table)) {
|
||||||
$table->colspan['planned_downtime']['cell'] = 3;
|
$table->colspan['planned_downtime']['cell'] = 3;
|
||||||
@ -459,7 +472,7 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
$table1->headstyle[4] = 'text-align: right';
|
$table1->headstyle[4] = 'text-align: right';
|
||||||
$table1->headstyle[5] = 'text-align: right';
|
$table1->headstyle[5] = 'text-align: right';
|
||||||
|
|
||||||
// second_table for time globals
|
// Second_table for time globals.
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
$table2->width = '99%';
|
$table2->width = '99%';
|
||||||
|
|
||||||
@ -490,7 +503,7 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
$table2->headstyle[5] = 'text-align: right';
|
$table2->headstyle[5] = 'text-align: right';
|
||||||
$table2->headstyle[6] = 'text-align: right';
|
$table2->headstyle[6] = 'text-align: right';
|
||||||
|
|
||||||
// third_table for time globals
|
// Third_table for time globals.
|
||||||
$table3 = new stdClass();
|
$table3 = new stdClass();
|
||||||
$table3->width = '99%';
|
$table3->width = '99%';
|
||||||
|
|
||||||
@ -520,15 +533,23 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
|
|
||||||
foreach ($item['data'] as $sla) {
|
foreach ($item['data'] as $sla) {
|
||||||
if (isset($sla)) {
|
if (isset($sla)) {
|
||||||
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
|
$the_first_men_time = get_agent_first_time(
|
||||||
|
io_safe_output($sla['agent'])
|
||||||
|
);
|
||||||
|
|
||||||
// first_table
|
// First_table.
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = $sla['agent'];
|
$row[] = $sla['agent'];
|
||||||
$row[] = $sla['module'];
|
$row[] = $sla['module'];
|
||||||
|
|
||||||
if (is_numeric($sla['dinamic_text'])) {
|
if (is_numeric($sla['dinamic_text'])) {
|
||||||
$row[] = sla_truncate($sla['max'], $config['graph_precision']).' / '.sla_truncate($sla['min'], $config['graph_precision']);
|
$row[] = sla_truncate(
|
||||||
|
$sla['max'],
|
||||||
|
$config['graph_precision']
|
||||||
|
).' / '.sla_truncate(
|
||||||
|
$sla['min'],
|
||||||
|
$config['graph_precision']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$row[] = $sla['dinamic_text'];
|
$row[] = $sla['dinamic_text'];
|
||||||
}
|
}
|
||||||
@ -550,47 +571,64 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
|
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">'.__('Fail').'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// second table for time globals
|
// Second table for time globals.
|
||||||
$row2 = [];
|
$row2 = [];
|
||||||
$row2[] = $sla['agent'].' -- ['.$sla['module'].']';
|
$row2[] = $sla['agent'].' -- ['.$sla['module'].']';
|
||||||
|
|
||||||
if ($sla['time_total'] != 0) {
|
if ($sla['time_total'] != 0) {
|
||||||
$row2[] = human_time_description_raw($sla['time_total']);
|
$row2[] = human_time_description_raw(
|
||||||
|
$sla['time_total']
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla['time_error'] != 0) {
|
if ($sla['time_error'] != 0) {
|
||||||
$row2[] = '<span style="color: '.COL_CRITICAL.';">'.human_time_description_raw($sla['time_error'], true).'</span>';
|
$row2[] = '<span style="color: '.COL_CRITICAL.';">'.human_time_description_raw(
|
||||||
|
$sla['time_error'],
|
||||||
|
true
|
||||||
|
).'</span>';
|
||||||
} else {
|
} else {
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla['time_ok'] != 0) {
|
if ($sla['time_ok'] != 0) {
|
||||||
$row2[] = '<span style="color: '.COL_NORMAL.';">'.human_time_description_raw($sla['time_ok'], true).'</span>';
|
$row2[] = '<span style="color: '.COL_NORMAL.';">'.human_time_description_raw(
|
||||||
|
$sla['time_ok'],
|
||||||
|
true
|
||||||
|
).'</span>';
|
||||||
} else {
|
} else {
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla['time_unknown'] != 0) {
|
if ($sla['time_unknown'] != 0) {
|
||||||
$row2[] = '<span style="color: '.COL_UNKNOWN.';">'.human_time_description_raw($sla['time_unknown'], true).'</span>';
|
$row2[] = '<span style="color: '.COL_UNKNOWN.';">'.human_time_description_raw(
|
||||||
|
$sla['time_unknown'],
|
||||||
|
true
|
||||||
|
).'</span>';
|
||||||
} else {
|
} else {
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla['time_not_init'] != 0) {
|
if ($sla['time_not_init'] != 0) {
|
||||||
$row2[] = '<span style="color: '.COL_NOTINIT.';">'.human_time_description_raw($sla['time_not_init'], true).'</span>';
|
$row2[] = '<span style="color: '.COL_NOTINIT.';">'.human_time_description_raw(
|
||||||
|
$sla['time_not_init'],
|
||||||
|
true
|
||||||
|
).'</span>';
|
||||||
} else {
|
} else {
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sla['time_downtime'] != 0) {
|
if ($sla['time_downtime'] != 0) {
|
||||||
$row2[] = '<span style="color: '.COL_DOWNTIME.';">'.human_time_description_raw($sla['time_downtime'], true).'</span>';
|
$row2[] = '<span style="color: '.COL_DOWNTIME.';">'.human_time_description_raw(
|
||||||
|
$sla['time_downtime'],
|
||||||
|
true
|
||||||
|
).'</span>';
|
||||||
} else {
|
} else {
|
||||||
$row2[] = '--';
|
$row2[] = '--';
|
||||||
}
|
}
|
||||||
|
|
||||||
// third table for checks globals
|
// Third table for checks globals.
|
||||||
$row3 = [];
|
$row3 = [];
|
||||||
$row3[] = $sla['agent'].' -- ['.$sla['module'].']';
|
$row3[] = $sla['agent'].' -- ['.$sla['module'].']';
|
||||||
$row3[] = $sla['checks_total'];
|
$row3[] = $sla['checks_total'];
|
||||||
@ -605,11 +643,20 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan['sla']['cell'] = 2;
|
$table->colspan['sla']['cell'] = 2;
|
||||||
$table->data['sla']['cell'] = html_print_table($table1, true);
|
$table->data['sla']['cell'] = html_print_table(
|
||||||
|
$table1,
|
||||||
|
true
|
||||||
|
);
|
||||||
$table->colspan['time_global']['cell'] = 2;
|
$table->colspan['time_global']['cell'] = 2;
|
||||||
$table->data['time_global']['cell'] = html_print_table($table2, true);
|
$table->data['time_global']['cell'] = html_print_table(
|
||||||
|
$table2,
|
||||||
|
true
|
||||||
|
);
|
||||||
$table->colspan['checks_global']['cell'] = 2;
|
$table->colspan['checks_global']['cell'] = 2;
|
||||||
$table->data['checks_global']['cell'] = html_print_table($table3, true);
|
$table->data['checks_global']['cell'] = html_print_table(
|
||||||
|
$table3,
|
||||||
|
true
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$table->colspan['error']['cell'] = 3;
|
$table->colspan['error']['cell'] = 3;
|
||||||
$table->data['error']['cell'] = __('There are no Agent/Modules defined');
|
$table->data['error']['cell'] = __('There are no Agent/Modules defined');
|
||||||
@ -631,9 +678,12 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table->colspan['charts']['cell'] = 2;
|
$table->colspan['charts']['cell'] = 2;
|
||||||
$table->data['charts']['cell'] = html_print_table($table1, true);
|
$table->data['charts']['cell'] = html_print_table(
|
||||||
|
$table1,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
// table_legend_graphs;
|
// Table_legend_graphs.
|
||||||
$table1 = new stdClass();
|
$table1 = new stdClass();
|
||||||
$table1->width = '99%';
|
$table1->width = '99%';
|
||||||
$table1->data = [];
|
$table1->data = [];
|
||||||
@ -669,9 +719,16 @@ function reporting_html_SLA($table, $item, $mini)
|
|||||||
$table1->data[0][11] = '<span>'.__('Ignore time').'</span>';
|
$table1->data[0][11] = '<span>'.__('Ignore time').'</span>';
|
||||||
|
|
||||||
$table->colspan['legend']['cell'] = 2;
|
$table->colspan['legend']['cell'] = 2;
|
||||||
$table->data['legend']['cell'] = html_print_table($table1, true);
|
$table->data['legend']['cell'] = html_print_table(
|
||||||
|
$table1,
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($pdf !== 0) {
|
||||||
|
return html_print_table($table, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -794,7 +851,7 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($item['data'] as $k => $event) {
|
foreach ($item['data'] as $k => $event) {
|
||||||
// First pass along the class of this row
|
// First pass along the class of this row.
|
||||||
if ($item['show_summary_group']) {
|
if ($item['show_summary_group']) {
|
||||||
$table1->cellclass[$k][1] = $table1->cellclass[$k][2] = $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = $table1->cellclass[$k][6] = $table1->cellclass[$k][7] = get_priority_class($event['criticity']);
|
$table1->cellclass[$k][1] = $table1->cellclass[$k][2] = $table1->cellclass[$k][4] = $table1->cellclass[$k][5] = $table1->cellclass[$k][6] = $table1->cellclass[$k][7] = get_priority_class($event['criticity']);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,24 +1,30 @@
|
|||||||
/*
|
/**
|
||||||
Author: The Pandora FMS team
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
Name: Default theme
|
* point to.
|
||||||
Description: The default Pandora FMS theme layout
|
*
|
||||||
|
* @category Extensions
|
||||||
// Pandora FMS - http://pandorafms.com
|
* @package Pandora FMS
|
||||||
// ==========================================================
|
* @subpackage Community
|
||||||
// Copyright (c) 2004-2011 Artica Soluciones Tecnológicas S.L
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
// This program is free software; you can redistribute it and/or
|
*
|
||||||
// modify it under the terms of the GNU General Public License
|
* ______ ___ _______ _______ ________
|
||||||
// as published by the Free Software Foundation; version 2
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
// This program is distributed in the hope that it will be useful,
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* ============================================================================
|
||||||
// GNU General Public License for more details.
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
// You should have received a copy of the GNU General Public License
|
* Please see http://pandorafms.org for full contribution list
|
||||||
// along with this program; if not, write to the Free Software
|
* This program is free software; you can redistribute it and/or
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
* modify it under the terms of the GNU General Public License
|
||||||
*/
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
/* Tree view styles */
|
/* Tree view styles */
|
||||||
@import url(tree.css);
|
@import url(tree.css);
|
||||||
|
71
pandora_console/include/styles/pandoraPDF.css
Normal file
71
pandora_console/include/styles/pandoraPDF.css
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* Extension to manage a list of gateways and the node address where they should
|
||||||
|
* point to.
|
||||||
|
*
|
||||||
|
* @category Extensions
|
||||||
|
* @package Pandora FMS
|
||||||
|
* @subpackage Community
|
||||||
|
* @version 1.0.0
|
||||||
|
* @license See below
|
||||||
|
*
|
||||||
|
* ______ ___ _______ _______ ________
|
||||||
|
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||||
|
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||||
|
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||||
|
*
|
||||||
|
* ============================================================================
|
||||||
|
* Copyright (c) 2005-2019 Artica Soluciones Tecnologicas
|
||||||
|
* Please see http://pandorafms.org for full contribution list
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation for version 2.
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
* ============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
.content_table {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 20pt !important;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content_table tr th,
|
||||||
|
.content_table tr td {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
thead.header_tr tr {
|
||||||
|
background: #e6e6e6;
|
||||||
|
}
|
||||||
|
thead.header_tr tr th {
|
||||||
|
font-weight: normal;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
thead.header_tr tr th.th_first {
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table_beauty {
|
||||||
|
font-size: 20pt !important;
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table_beauty tr td {
|
||||||
|
font-size: 20pt !important;
|
||||||
|
padding: 5px;
|
||||||
|
border: 0.1pt solid #acacac;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table_beauty tr td table {
|
||||||
|
font-size: 20pt !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table_beauty tr td table tr td {
|
||||||
|
font-size: 20pt !important;
|
||||||
|
}
|
@ -1363,4 +1363,3 @@ require 'include/php_to_js_values.php';
|
|||||||
if (__PAN_XHPROF__ === 1) {
|
if (__PAN_XHPROF__ === 1) {
|
||||||
pandora_xhprof_display_result('node_index');
|
pandora_xhprof_display_result('node_index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user