2011-11-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* 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
This commit is contained in:
juanmanuelr 2011-11-08 09:56:43 +00:00
parent 488135bba3
commit b7acc90d78
5 changed files with 29 additions and 9 deletions

View File

@ -1,3 +1,11 @@
2011-11-08 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* 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 <juanmanuel.ramon@artica.es>
* operation/gis_maps/render_view.php: Fixed fullscreen mode.

View File

@ -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 () {
</script>
<?php
$datetime = strtotime ($date.' '.$time);
$report["datetime"] = $datetime;
if ($datetime === false || $datetime == -1) {
echo '<h3 class="error">'.__('Invalid date selected').'</h3>';

View File

@ -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('/^<img(.)*$/', $module_data)){
return;
}
// Data initialization
$sum_obs = 0;
@ -56,6 +60,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
$cont = 1;
$data = array();
$table->data = array();
// Creates data for calculation
foreach ($module_data as $utimestamp => $row) {
if ($utimestamp == '') { continue; }

View File

@ -109,8 +109,13 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
// Check available data
if (count ($data) < $min_necessary) {
if (!$graphic_type) {
if (!$projection){
return false;
}
else{
return fs_error_image ();
}
}
graphic_error ();
}

View File

@ -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,
'',