From 160b85767219b30615cc78782a78f110a04773ea Mon Sep 17 00:00:00 2001 From: jsatoh Date: Fri, 3 May 2013 08:19:07 +0000 Subject: [PATCH] 2013-05-03 Junichi Satoh * include/functions_graph.php: Fixed warnings git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8095 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 4 ++ pandora_console/include/functions_graph.php | 62 ++++++++++++--------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2bd19bfdc5..c4717eb0cf 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,7 @@ +2013-05-03 Junichi Satoh + + * include/functions_graph.php: Fixed warnings. + 2013-05-01 Miguel de Dios * godmode/agentes/agent_manager.php: improved the source code style. diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 5252e3e66e..94f45cbaf2 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2615,6 +2615,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $event_value = 0; $alert_value = 0; $unknown_value = 0; + $is_unknown = false; $event_ids = array(); $alert_ids = array(); @@ -2856,6 +2857,12 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, global $long_index; global $series_type; global $chart_extra_data; + + if (empty($unit_name)) { + $unit = modules_get_unit($agent_module_id); + } + else + $unit = $unit_name; $series_suffix_str = ''; if ($compare !== false) { @@ -3415,6 +3422,7 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu } $legend = array(); + $cont = 0; for ($i = 0; $i < $interval; $i++) { $bottom = $datelimit + ($periodtime * $i); if (! $graphic_type) { @@ -3432,33 +3440,35 @@ function graphic_module_events ($id_module, $width, $height, $period = 0, $homeu 'utimestamp > '.$bottom, 'utimestamp < '.$top), 'event_type, utimestamp'); - - $status = 'normal'; - foreach($events as $event) { - if (empty($event['utimestamp'])) { - continue; - } + + if (!empty($events)) { + $status = 'normal'; + foreach($events as $event) { + if (empty($event['utimestamp'])) { + continue; + } - switch($event['event_type']) { - case 'going_down_normal': - case 'going_up_normal': - // The default status is normal. Do nothing - break; - case 'going_unknown': - if($status == 'normal') { - $status = 'unknown'; - } - break; - case 'going_up_warning': - case 'going_down_warning': - if($status == 'normal' || $status == 'unknown') { - $status = 'warning'; - } - break; - case 'going_up_critical': - case 'going_down_critical': - $status = 'critical'; - break; + switch($event['event_type']) { + case 'going_down_normal': + case 'going_up_normal': + // The default status is normal. Do nothing + break; + case 'going_unknown': + if($status == 'normal') { + $status = 'unknown'; + } + break; + case 'going_up_warning': + case 'going_down_warning': + if($status == 'normal' || $status == 'unknown') { + $status = 'warning'; + } + break; + case 'going_up_critical': + case 'going_down_critical': + $status = 'critical'; + break; + } } }