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:
parent
0a27fa3b04
commit
3a2f39594e
|
@ -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.
|
||||
|
|
|
@ -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>';
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
'',
|
||||
|
|
Loading…
Reference in New Issue