Merge branch '2666-Graficas_en_informes' into 'develop'

fixed heigth charts for reports

See merge request artica/pandorafms!1745
This commit is contained in:
vgilc 2018-09-11 09:38:35 +02:00
commit 995bd42d70
5 changed files with 48 additions and 43 deletions

View File

@ -709,6 +709,10 @@ $table_chars->data[$row][1] = html_print_select($options_zoom_graphs, 'zoom_grap
$row++; $row++;
$table_chars->data[$row][0] = __('Graph image height'); $table_chars->data[$row][0] = __('Graph image height');
$table_chars->data[$row][0] .= ui_print_help_tip(
__('This is the height in pixels of the module graph or custom graph in the reports (both: HTML and PDF)'),
true
);
$table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true); $table_chars->data[$row][1] = html_print_input_text ('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
$row++; $row++;

View File

@ -3274,7 +3274,7 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$img_url = $config["homeurl"] . "attachment/" . $img_file; $img_url = $config["homeurl"] . "attachment/" . $img_file;
$width_img = 500; $width_img = 500;
$height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 350; $height_img = (isset($config['graph_image_height'])) ? $config['graph_image_height'] : 280;
$params['height'] = $height_img; $params['height'] = $height_img;

View File

@ -631,10 +631,10 @@ function config_update_config () {
if (!config_update_value ('type_mode_graph', (int) get_parameter('type_mode_graph', 0))) if (!config_update_value ('type_mode_graph', (int) get_parameter('type_mode_graph', 0)))
$error_update[] = __('Default soft graphs'); $error_update[] = __('Default soft graphs');
if (!config_update_value ('zoom_graph', (int) get_parameter('zoom_graph', 0))) if (!config_update_value ('zoom_graph', (int) get_parameter('zoom_graph', 1)))
$error_update[] = __('Default zoom graphs'); $error_update[] = __('Default zoom graphs');
if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 0))) if (!config_update_value ('graph_image_height', (int) get_parameter('graph_image_height', 280)))
$error_update[] = __('Default height of the chart image'); $error_update[] = __('Default height of the chart image');
if (!config_update_value ('classic_menu', (bool) get_parameter('classic_menu', false))) if (!config_update_value ('classic_menu', (bool) get_parameter('classic_menu', false)))
@ -667,10 +667,7 @@ function config_update_config () {
} }
} }
//-------------------------------------------------- //--------------------------------------------------
//-------------------------------------------------- //--------------------------------------------------
// CUSTOM INTERVAL VALUES // CUSTOM INTERVAL VALUES
//-------------------------------------------------- //--------------------------------------------------
@ -1859,11 +1856,15 @@ function config_process_config () {
if (!isset($config['render_proc'])) { if (!isset($config['render_proc'])) {
config_update_value ('render_proc', 0); config_update_value ('render_proc', 0);
} }
if (!isset($config['graph_image_height'])) { if (!isset($config['graph_image_height'])) {
config_update_value ('graph_image_height', 320); config_update_value ('graph_image_height', 280);
} }
if (!isset($config['zoom_graph'])) {
config_update_value ('zoom_graph', 1);
}
if (!isset($config["render_proc_ok"])) { if (!isset($config["render_proc_ok"])) {
config_update_value ('render_proc_ok', __('Ok') ); config_update_value ('render_proc_ok', __('Ok') );
} }

View File

@ -892,7 +892,9 @@ function grafico_modulo_sparse ($params) {
} }
if(!isset($params['zoom'])){ if(!isset($params['zoom'])){
$params['zoom'] = $config['zoom_graph']; $params['zoom'] = $config['zoom_graph']
? $config['zoom_graph']
: 1;
} }
if(!isset($params['type_mode_graph'])){ if(!isset($params['type_mode_graph'])){

View File

@ -628,7 +628,6 @@ function reporting_make_reporting_data($report = null, $id_report,
} }
$index_content++; $index_content++;
} }
return reporting_check_structure_report($report); return reporting_check_structure_report($report);
} }
@ -2807,18 +2806,17 @@ function agents_get_network_interfaces_array(
$row_interface['chart'] = null; $row_interface['chart'] = null;
$width = null; $width = null;
$height = null;
$params =array( $params =array(
'period' => $content['period'], 'period' => $content['period'],
'width' => $width, 'width' => $width,
'height' => $height,
'unit_name' => array_fill(0, count($interface['traffic']), __("bytes/s")), 'unit_name' => array_fill(0, count($interface['traffic']), __("bytes/s")),
'date' => $report["datetime"], 'date' => $report["datetime"],
'only_image'=> $pdf, 'only_image'=> $pdf,
'homeurl' => $config['homeurl'], 'homeurl' => $config['homeurl'],
'fullscale' => $fullscale, 'fullscale' => $fullscale,
'server_id' => $id_meta 'server_id' => $id_meta,
'height' => $config['graph_image_height']
); );
$params_combined = array( $params_combined = array(
@ -3540,7 +3538,8 @@ function reporting_simple_baseline_graph($report, $content,
'homeurl' => ui_get_full_url(false, false, false, false), 'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl, 'ttl' => $ttl,
'array_data_create' => $baseline_data, 'array_data_create' => $baseline_data,
'server_id' => $id_meta 'server_id' => $id_meta,
'height' => $config['graph_image_height']
); );
$return['chart'] = grafico_modulo_sparse ($params); $return['chart'] = grafico_modulo_sparse ($params);
@ -3645,13 +3644,13 @@ function reporting_projection_graph($report, $content,
$params =array( $params =array(
'period' => $content['period'], 'period' => $content['period'],
'width' => $width, 'width' => $width,
'height' => $height,
'date' => $report["datetime"], 'date' => $report["datetime"],
'unit' => '', 'unit' => '',
'only_image' => $pdf, 'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false) . '/', 'homeurl' => ui_get_full_url(false, false, false, false) . '/',
'ttl' => $ttl, 'ttl' => $ttl,
'server_id' => $id_meta 'server_id' => $id_meta,
'height' => $config['graph_image_height']
); );
$params_combined = array( $params_combined = array(
@ -3884,27 +3883,27 @@ function reporting_value($report, $content, $type,$pdf) {
$return['agent_name'] = $agent_name; $return['agent_name'] = $agent_name;
$return['module_name'] = $module_name; $return['module_name'] = $module_name;
if($pdf){ if($pdf){
$only_image = 1; $only_image = 1;
} }
$params =array( $params =array(
'agent_module_id' => $content['id_agent_module'], 'agent_module_id' => $content['id_agent_module'],
'period' => $content['period'], 'period' => $content['period'],
'width' => '600px', 'width' => '600px',
'pure' => false,///true 'pure' => false,///true
'date' => $report["datetime"], 'date' => $report["datetime"],
'only_image' => $only_image, 'only_image' => $only_image,
'homeurl' => ui_get_full_url(false, false, false, false), 'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => 1,///2 'ttl' => 1,///2
'type_graph' => $config['type_module_charts'], 'type_graph' => $config['type_module_charts'],
'time_interval' => $content['lapse'], 'time_interval' => $content['lapse'],
'server_id' => $id_meta 'server_id' => $id_meta,
'height' => $config['graph_image_height']
); );
switch ($type) {
switch ($type) {
case 'max': case 'max':
if($content['lapse_calc'] == 0){ if($content['lapse_calc'] == 0){
$value = reporting_get_agentmodule_data_max( $value = reporting_get_agentmodule_data_max(
@ -6344,24 +6343,23 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
$return['chart'] = ''; $return['chart'] = '';
$width =null; $width =null;
$height =null;
switch ($type) { switch ($type) {
case 'dinamic': case 'dinamic':
case 'static': case 'static':
$params =array( $params =array(
'period' => $content['period'], 'period' => $content['period'],
'width' => $width, 'width' => $width,
'height' => $height,
'date' => $report["datetime"], 'date' => $report["datetime"],
'only_image' => $pdf, 'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false), 'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl, 'ttl' => $ttl,
'percentil' => $graphs[0]["percentil"], 'percentil' => $graphs[0]["percentil"],
'fullscale' => $graphs[0]["fullscale"], 'fullscale' => $graphs[0]["fullscale"],
'server_id' => $id_meta 'server_id' => $id_meta,
'height' => $config['graph_image_height']
); );
$params_combined = array( $params_combined = array(
'stacked' => $graphs[0]["stacked"], 'stacked' => $graphs[0]["stacked"],
'summatory' => $graphs[0]["summatory_series"], 'summatory' => $graphs[0]["summatory_series"],
@ -6464,7 +6462,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
'show_unknown' => true, 'show_unknown' => true,
'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null, 'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
'fullscale' => $fullscale, 'fullscale' => $fullscale,
'server_id' => $id_meta 'server_id' => $id_meta,
'height' => $config['graph_image_height']
); );
$return['chart'] = grafico_modulo_sparse($params); $return['chart'] = grafico_modulo_sparse($params);
@ -6491,15 +6490,14 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
function reporting_get_date_text($report = null, $content = null) { function reporting_get_date_text($report = null, $content = null) {
global $config; global $config;
$return = array(); $return = array();
$return['date'] = null; $return['date'] = null;
$return['period'] = null; $return['period'] = null;
$return['from'] = null; $return['from'] = null;
$return['to'] = null; $return['to'] = null;
if (!empty($report) && !empty($content)) { if (!empty($report) && !empty($content)) {
if ($content['period'] == 0) { if ($content['period'] == 0) {
$es = json_decode($content['external_source'], true); $es = json_decode($content['external_source'], true);
if ($es['date'] == 0) { if ($es['date'] == 0) {
@ -6515,7 +6513,7 @@ function reporting_get_date_text($report = null, $content = null) {
$return['to'] = $report["datetime"]; $return['to'] = $report["datetime"];
} }
} }
return $return; return $return;
} }
@ -6531,7 +6529,7 @@ function reporting_check_structure_report($return) {
$return['datetime'] = ""; $return['datetime'] = "";
if (!isset($return['period'])) if (!isset($return['period']))
$return['period'] = ""; $return['period'] = "";
return $return; return $return;
} }
@ -6551,7 +6549,7 @@ function reporting_check_structure_content($report) {
$report["date"]['from'] = ""; $report["date"]['from'] = "";
$report["date"]['to'] = ""; $report["date"]['to'] = "";
} }
return $report; return $report;
} }