From 3a2f39594e2a2b816fda4e2075e61d2bcf2bbae4 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Tue, 8 Nov 2011 09:56:43 +0000 Subject: [PATCH] 2011-11-08 Juan Manuel Ramon * include/functions_graph.php include/functions_forecast.php include/functions_reporting.php godmode/reporting/reporting_builder.preview.php: Fixed some warnings in this views. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5122 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++++++++ .../godmode/reporting/reporting_builder.preview.php | 9 +++------ pandora_console/include/functions_forecast.php | 5 +++++ pandora_console/include/functions_graph.php | 9 +++++++-- pandora_console/include/functions_reporting.php | 7 ++++++- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 01a0253b98..f17a9d00bc 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-11-08 Juan Manuel Ramon + + * include/functions_graph.php + include/functions_forecast.php + include/functions_reporting.php + godmode/reporting/reporting_builder.preview.php: Fixed some + warnings in this views. + 2011-11-07 Juan Manuel Ramon * operation/gis_maps/render_view.php: Fixed fullscreen mode. diff --git a/pandora_console/godmode/reporting/reporting_builder.preview.php b/pandora_console/godmode/reporting/reporting_builder.preview.php index 31d4e1271e..2365f55334 100644 --- a/pandora_console/godmode/reporting/reporting_builder.preview.php +++ b/pandora_console/godmode/reporting/reporting_builder.preview.php @@ -43,16 +43,15 @@ if ($report['private'] && ($report['id_user'] != $config['id_user'] && ! is_user $date = (string) get_parameter ('date', date ('Y-m-j')); $time = (string) get_parameter ('time', date ('h:iA')); +$datetime = strtotime ($date.' '.$time); +$report["datetime"] = $datetime; + // Calculations in order to modify init date of the report $date_init_less = strtotime(date ('Y-m-j')) - 86400; $date_init = get_parameter('date_init', date ('Y-m-j', $date_init_less)); $time_init = get_parameter('time_init', date ('h:iA')); $datetime_init = strtotime ($date_init.' '.$time_init); $enable_init_date = get_parameter('enable_init_date', 0); -$new_interval = $report['datetime'] - $datetime_init; -if ($new_interval != $content['period']) { - $content['period'] = $new_interval; -} // Standard header @@ -154,8 +153,6 @@ $(document).ready (function () { '.__('Invalid date selected').''; diff --git a/pandora_console/include/functions_forecast.php b/pandora_console/include/functions_forecast.php index a503d0f37c..3945fd7d8f 100644 --- a/pandora_console/include/functions_forecast.php +++ b/pandora_console/include/functions_forecast.php @@ -42,6 +42,10 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe if (empty($module_data)){ return array(); } + // Prevents bad behaviour over image error + else if (!is_array($module_data) and preg_match('/^data = array(); + // Creates data for calculation foreach ($module_data as $utimestamp => $row) { if ($utimestamp == '') { continue; } diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 5c3d6b17c0..aa2b41b174 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -109,7 +109,12 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, // Check available data if (count ($data) < $min_necessary) { if (!$graphic_type) { - return fs_error_image (); + if (!$projection){ + return false; + } + else{ + return fs_error_image (); + } } graphic_error (); } @@ -421,7 +426,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ } // Added support for projection graphs (normal_module + 1(prediction data)) - if ($projection !== false){ + if ($projection !== false){ $module_number = count ($module_list) + 1; }else{ $module_number = count ($module_list); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7b60d87efc..1b6f456b1b 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2117,6 +2117,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f $output_projection = forecast_projection_graph($content['id_agent_module'], $content['period'], $content['top_n_value']); + // If projection doesn't have data then don't draw graph + if ($output_projection == NULL){ + $output_projection = false; + } + $modules = array($content['id_agent_module']); $weights = array(); $data[0] = graphic_combined_module( @@ -2129,7 +2134,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f 0, 0, 0, - $graph["stacked"], + 0, $report["datetime"], false, '',