Merge branch '339-No_cortar_elementos_en_PDF' into 'develop'

339 no cortar elementos en pdf

See merge request artica/pandorafms!2163

Former-commit-id: 756360a1b91e5edf2c1af80e601085f7b41b505c
This commit is contained in:
Daniel Rodriguez 2019-02-19 15:39:03 +01:00
commit 04c4162419
9 changed files with 1307 additions and 488 deletions

View File

@ -1116,8 +1116,13 @@ switch ($action) {
$name_it = (string) get_parameter('name'); $name_it = (string) get_parameter('name');
$values['name'] = reporting_label_macro($items_label, $name_it); $values['name'] = reporting_label_macro($items_label, $name_it);
// Added support for projection graphs, prediction date and SLA reports /*
// 'top_n_value','top_n' and 'text' fields will be reused for these types of report Added support for projection graphs,
prediction date and SLA reports
'top_n_value','top_n' and 'text'
fields will be reused for these types of report
*/
switch ($values['type']) { switch ($values['type']) {
case 'projection_graph': case 'projection_graph':
$values['period'] = get_parameter('period1'); $values['period'] = get_parameter('period1');
@ -1127,7 +1132,8 @@ switch ($action) {
break; break;
case 'event_report_log': case 'event_report_log':
$agents_to_report = get_parameter('id_agents2');
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', ''); $source = get_parameter('source', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$log_number = get_parameter('log_number', ''); $log_number = get_parameter('log_number', '');
@ -1525,7 +1531,7 @@ switch ($action) {
break; break;
case 'event_report_log': case 'event_report_log':
$agents_to_report = get_parameter('id_agents2'); $agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', ''); $source = get_parameter('source', '');
$search = get_parameter('search', ''); $search = get_parameter('search', '');
$log_number = get_parameter('log_number', ''); $log_number = get_parameter('log_number', '');

View File

@ -88,16 +88,13 @@ if (file_exists('languages/'.$user_language.'.mo')) {
$params['menu'] = false; $params['menu'] = false;
if ((!isset($params['width']) || ($params['width'] <= 0))) { if ((!isset($params['width']) || ($params['width'] <= 0))) {
$params['width'] = 1048; $params['width'] = 650;
} }
$params_combined = json_decode($_REQUEST['data_combined'], true); $params_combined = json_decode($_REQUEST['data_combined'], true);
$module_list = json_decode($_REQUEST['data_module_list'], true); $module_list = json_decode($_REQUEST['data_module_list'], true);
$type_graph_pdf = $_REQUEST['type_graph_pdf']; $type_graph_pdf = $_REQUEST['type_graph_pdf'];
$aux_font_size = $config['font_size'];
$config['font_size'] = ($config['font_size'] + 3);
echo '<div>'; echo '<div>';
switch ($type_graph_pdf) { switch ($type_graph_pdf) {
case 'combined': case 'combined':
@ -216,7 +213,6 @@ if (file_exists('languages/'.$user_language.'.mo')) {
echo '</div>'; echo '</div>';
$config['font_size'] = $aux_font_size;
?> ?>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -245,7 +245,9 @@ function grafico_modulo_sparse_data(
} }
} }
if ($array_data === false || (!$params['graph_combined'] && !isset($array_data['sum1']['data'][0][1]))) { if ($array_data === false || (!$params['graph_combined']
&& !isset($array_data['sum1']['data'][0][1]) && !$params['baseline'])
) {
return false; return false;
} }
@ -4918,21 +4920,19 @@ function get_baseline_data($agent_module_id, $date_array, $data_module_graph, $p
$period = $date_array['period']; $period = $date_array['period'];
$date = $date_array['final_date']; $date = $date_array['final_date'];
$array_data = []; $array_data = [];
for ($i = 0; $i < 4; $i++) { for ($i = 0; $i < 4; $i++) {
$date_array = []; $date_array = [];
$date_array['period'] = $period; $date_array['period'] = $period;
$date_array['final_date'] = ($date - $period * $i); $date_array['final_date'] = ($date - ($period * $i));
$date_array['start_date'] = ($date - $period * ($i + 1)); $date_array['start_date'] = ($date - ($period * ($i + 1)));
$array_data[] = grafico_modulo_sparse_data(
$data = grafico_modulo_sparse_data(
$agent_module_id, $agent_module_id,
$date_array, $date_array,
$data_module_graph, $data_module_graph,
$params, $params,
$i $i
); );
$array_data[] = $data;
} }
$result = []; $result = [];

View File

@ -1822,35 +1822,35 @@ function html_get_predefined_table($model='transparent', $columns=4)
* Print a nicely formatted table. Code taken from moodle. * Print a nicely formatted table. Code taken from moodle.
* *
* @param object Object with several properties: * @param object Object with several properties:
* $table->head - An array of heading names. * $table->head - An array of heading names.
* $table->head_colspan - An array of colspans of each head column. * $table->head_colspan - An array of colspans of each head column.
* $table->headstyle - An array of styles of each head column. * $table->headstyle - An array of styles of each head column.
* $table->align - An array of column alignments * $table->align - An array of column alignments
* $table->valign - An array of column alignments * $table->valign - An array of column alignments
* $table->size - An array of column sizes * $table->size - An array of column sizes
* $table->wrap - An array of "nowrap"s or nothing * $table->wrap - An array of "nowrap"s or nothing
* $table->style - An array of personalized style for each column. * $table->style - An array of personalized style for each column.
* $table->rowid - An array of personalized ids of each row. * $table->rowid - An array of personalized ids of each row.
* $table->rowstyle - An array of personalized style of each row. * $table->rowstyle - An array of personalized style of each row.
* $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored). * $table->rowclass - An array of personalized classes of each row (odd-evens classes will be ignored).
* $table->colspan - An array of colspans of each column. * $table->colspan - An array of colspans of each column.
* $table->rowspan - An array of rowspans of each column. * $table->rowspan - An array of rowspans of each column.
* $table->data[] - An array of arrays containing the data. * $table->data[] - An array of arrays containing the data.
* $table->width - A percentage of the page * $table->width - A percentage of the page
* $table->border - Border of the table. * $table->border - Border of the table.
* $table->tablealign - Align the whole table (float left or right) * $table->tablealign - Align the whole table (float left or right)
* $table->cellpadding - Padding on each cell * $table->cellpadding - Padding on each cell
* $table->cellspacing - Spacing between cells * $table->cellspacing - Spacing between cells
* $table->cellstyle - Style of a cell * $table->cellstyle - Style of a cell
* $table->cellclass - Class of a cell * $table->cellclass - Class of a cell
* $table->class - CSS table class * $table->class - CSS table class
* $table->id - Table ID (useful in JavaScript) * $table->id - Table ID (useful in JavaScript)
* $table->headclass[] - An array of classes for each heading * $table->headclass[] - An array of classes for each heading
* $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table * $table->title - Title of the table is a single string that will be on top of the table in the head spanning the whole table
* $table->titlestyle - Title style * $table->titlestyle - Title style
* $table->titleclass - Title class * $table->titleclass - Title class
* $table->styleTable - Table style * $table->styleTable - Table style
* $table->caption - Table title * $table->caption - Table title
* @param bool Whether to return an output string or echo now * @param bool Whether to return an output string or echo now
* *
* @return string HTML code if return parameter is true. * @return string HTML code if return parameter is true.

View File

@ -142,7 +142,6 @@ function reporting_make_reporting_data(
enterprise_include_once('include/functions_metaconsole.php'); enterprise_include_once('include/functions_metaconsole.php');
$return = []; $return = [];
if (!empty($report)) { if (!empty($report)) {
$contents = $report['contents']; $contents = $report['contents'];
} else { } else {
@ -261,7 +260,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 +271,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 +887,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 +895,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();
} }
@ -6794,7 +6791,6 @@ function reporting_general($report, $content)
if (!is_numeric($data_res[$index])) { if (!is_numeric($data_res[$index])) {
$return['data'][$ag_name][$mod_name] = $data_res[$index]; $return['data'][$ag_name][$mod_name] = $data_res[$index];
} else { } else {
hd($data_res[$index], true);
$return['data'][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit; $return['data'][$ag_name][$mod_name] = format_for_graph($data_res[$index], 2).' '.$unit;
} }
} }
@ -11336,3 +11332,27 @@ function reporting_translate_sla_status_for_graph($status)
]; ];
return $sts[$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;
}

File diff suppressed because it is too large Load Diff

View File

@ -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-2019 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);
@ -2053,82 +2059,58 @@ div#logo_text3 {
/* TABLAS */ /* TABLAS */
/* Cells divs to set individual styles with the table objects */ /* Cells divs to set individual styles with the table objects */
div.cellBold { td.cellBold {
width: 100%;
height: 100%;
font-weight: bold; font-weight: bold;
} }
div.cellRight { td.cellRight {
width: 100%;
height: 100%;
text-align: right; text-align: right;
} }
div.cellCenter { td.cellCenter {
width: 100%;
height: 100%;
text-align: center; text-align: center;
} }
div.cellWhite { td.cellWhite {
width: 100%;
height: 100%;
background: #fff; background: #fff;
color: #111; color: #111;
} }
div.cellNormal { td.cellNormal {
width: 100%;
height: 100%;
background: #6eb432; background: #6eb432;
color: #fff; color: #fff;
} }
div.cellCritical { td.cellCritical {
width: 100%;
height: 100%;
background: #f85858; background: #f85858;
color: #fff; color: #fff;
} }
div.cellWarning { td.cellWarning {
width: 100%;
height: 100%;
background: #ffea59; background: #ffea59;
color: #111; color: #111;
} }
div.cellUnknown { td.cellUnknown {
width: 100%;
height: 100%;
background: #aaaaaa; background: #aaaaaa;
color: #ffffff; color: #ffffff;
} }
div.cellNotInit { td.cellNotInit {
width: 100%;
height: 100%;
background: #3ba0ff; background: #3ba0ff;
color: #ffffff; color: #ffffff;
} }
div.cellAlert { td.cellAlert {
width: 100%;
height: 100%;
background: #ff8800; background: #ff8800;
color: #111; color: #111;
} }
div.cellBorder1 { td.cellBorder1 {
width: 100%;
height: 100%;
border: 1px solid #666; border: 1px solid #666;
} }
div.cellBig { td.cellBig {
width: 100%;
height: 100%;
font-size: 18px; font-size: 18px;
} }
@ -4561,4 +4543,4 @@ input:checked + .slider:before {
.no-close .ui-dialog-titlebar-close { .no-close .ui-dialog-titlebar-close {
display: none; display: none;
} }
/* jQuery dialog */ /* --- END - JQUERY-UI --- */

View File

@ -0,0 +1,78 @@
/**
* 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.
* ============================================================================
*/
table.header_table {
width: 100%;
}
table.header_table thead tr th,
table.header_table tbody 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;
}
thead.header_tr tr th.th_description {
background-color: #f5f5f5;
color: #1c1c1c;
text-align: justify;
}
table.table_beauty {
border-collapse: collapse;
width: 100%;
}
table.table_beauty tbody tr td {
padding: 5px;
border: 0.1pt solid #acacac;
}
table.databox {
margin-bottom: 20px;
}
th.title_table_pdf {
background-color: #acacac;
padding: 15px;
}
table.table_agent_module tr td {
padding: 5px;
}

View File

@ -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');
} }