Merge branch '339-No_cortar_elementos_en_PDF' into 'develop'

339 no cortar elementos en pdf

See merge request 

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

@ -1116,8 +1116,13 @@ switch ($action) {
$name_it = (string) get_parameter('name');
$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']) {
case 'projection_graph':
$values['period'] = get_parameter('period1');
@ -1127,7 +1132,8 @@ switch ($action) {
break;
case 'event_report_log':
$agents_to_report = get_parameter('id_agents2');
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
$log_number = get_parameter('log_number', '');
@ -1525,7 +1531,7 @@ switch ($action) {
break;
case 'event_report_log':
$agents_to_report = get_parameter('id_agents2');
$agents_to_report = get_parameter('id_agents3');
$source = get_parameter('source', '');
$search = get_parameter('search', '');
$log_number = get_parameter('log_number', '');

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

@ -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;
}
@ -4918,21 +4920,19 @@ function get_baseline_data($agent_module_id, $date_array, $data_module_graph, $p
$period = $date_array['period'];
$date = $date_array['final_date'];
$array_data = [];
for ($i = 0; $i < 4; $i++) {
$date_array = [];
$date_array['period'] = $period;
$date_array['final_date'] = ($date - $period * $i);
$date_array['start_date'] = ($date - $period * ($i + 1));
$data = grafico_modulo_sparse_data(
$date_array['final_date'] = ($date - ($period * $i));
$date_array['start_date'] = ($date - ($period * ($i + 1)));
$array_data[] = grafico_modulo_sparse_data(
$agent_module_id,
$date_array,
$data_module_graph,
$params,
$i
);
$array_data[] = $data;
}
$result = [];

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

@ -142,7 +142,6 @@ function reporting_make_reporting_data(
enterprise_include_once('include/functions_metaconsole.php');
$return = [];
if (!empty($report)) {
$contents = $report['contents'];
} else {
@ -261,7 +260,7 @@ function reporting_make_reporting_data(
}
if (isset($content['style']['name_label'])) {
// Add macros name
// Add macros name.
$items_label = [];
$items_label['type'] = $content['type'];
$items_label['id_agent'] = $content['id_agent'];
@ -272,11 +271,10 @@ function reporting_make_reporting_data(
$metaconsole_on = is_metaconsole();
$server_name = $content['server_name'];
// Metaconsole connection
// Metaconsole connection.
if ($metaconsole_on && $server_name != '') {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
// ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
@ -889,7 +887,6 @@ function reporting_SLA(
if ($metaconsole_on && $server_name != '') {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
// ui_print_error_message ("Error connecting to ".$server_name);
continue;
}
}
@ -898,7 +895,7 @@ function reporting_SLA(
|| modules_is_not_init($sla['id_agent_module'])
) {
if ($metaconsole_on) {
// Restore db connection
// Restore db connection.
metaconsole_restore_db();
}
@ -6794,7 +6791,6 @@ function reporting_general($report, $content)
if (!is_numeric($data_res[$index])) {
$return['data'][$ag_name][$mod_name] = $data_res[$index];
} else {
hd($data_res[$index], true);
$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];
}
/**
* 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

@ -1,24 +1,30 @@
/*
Author: The Pandora FMS team
Name: Default theme
Description: The default Pandora FMS theme layout
// Pandora FMS - http://pandorafms.com
// ==========================================================
// Copyright (c) 2004-2019 Artica Soluciones Tecnológicas S.L
// 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* 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.
* ============================================================================
*/
/* Tree view styles */
/*@import url(tree.css);
@ -2053,82 +2059,58 @@ div#logo_text3 {
/* TABLAS */
/* Cells divs to set individual styles with the table objects */
div.cellBold {
width: 100%;
height: 100%;
td.cellBold {
font-weight: bold;
}
div.cellRight {
width: 100%;
height: 100%;
td.cellRight {
text-align: right;
}
div.cellCenter {
width: 100%;
height: 100%;
td.cellCenter {
text-align: center;
}
div.cellWhite {
width: 100%;
height: 100%;
td.cellWhite {
background: #fff;
color: #111;
}
div.cellNormal {
width: 100%;
height: 100%;
td.cellNormal {
background: #6eb432;
color: #fff;
}
div.cellCritical {
width: 100%;
height: 100%;
td.cellCritical {
background: #f85858;
color: #fff;
}
div.cellWarning {
width: 100%;
height: 100%;
td.cellWarning {
background: #ffea59;
color: #111;
}
div.cellUnknown {
width: 100%;
height: 100%;
td.cellUnknown {
background: #aaaaaa;
color: #ffffff;
}
div.cellNotInit {
width: 100%;
height: 100%;
td.cellNotInit {
background: #3ba0ff;
color: #ffffff;
}
div.cellAlert {
width: 100%;
height: 100%;
td.cellAlert {
background: #ff8800;
color: #111;
}
div.cellBorder1 {
width: 100%;
height: 100%;
td.cellBorder1 {
border: 1px solid #666;
}
div.cellBig {
width: 100%;
height: 100%;
td.cellBig {
font-size: 18px;
}
@ -4561,4 +4543,4 @@ input:checked + .slider:before {
.no-close .ui-dialog-titlebar-close {
display: none;
}
/* jQuery dialog */
/* --- END - JQUERY-UI --- */

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

@ -1363,4 +1363,3 @@ require 'include/php_to_js_values.php';
if (__PAN_XHPROF__ === 1) {
pandora_xhprof_display_result('node_index');
}