From 0e85fedb885ac34900515cb6158aa6620cbd8362 Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Thu, 22 Dec 2011 10:08:00 +0000 Subject: [PATCH] 2011-12-22 Sergio Martin * include/functions_graph.php: Fixed Date formats in graph axis to avoid loss data * include/functions_custom_graphs.php: Fixed number of hours of a week in the graphs combo git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5294 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 ++ .../include/functions_custom_graphs.php | 2 +- pandora_console/include/functions_graph.php | 130 ++++++++++-------- 3 files changed, 78 insertions(+), 62 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c657d264fa..cfb552ff26 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2011-12-22 Sergio Martin + + * include/functions_graph.php: Fixed Date formats in graph + axis to avoid loss data + + * include/functions_custom_graphs.php: Fixed number of hours of + a week in the graphs combo + 2011-12-21 Vanessa Gil * operation/netflow/nf_view.php godmode/netflow/nf_report_item.php diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index dbea4cdc69..66953dcb27 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -130,7 +130,7 @@ function custom_graphs_get_periods () { $periods[12] = '12 '.__('hours'); $periods[24] = __('1 day'); $periods[48] = __('2 days'); - $periods[360] = __('1 week'); + $periods[168] = __('1 week'); $periods[720] = __('1 month'); $periods[4320] = __('6 months'); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index a312d3c782..8eaaf1b6e2 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -380,26 +380,25 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ // Set the title and time format - - if ($period <= 3600) { + if ($period <= 21600) { $title_period = __('Last hour'); - $time_format = 'G:i:s'; + $time_format = 'H:i:s'; } - elseif ($period <= 86400) { + elseif ($period < 86400) { $title_period = __('Last day'); - $time_format = 'G:i'; + $time_format = 'H:i'; } - elseif ($period <= 604800) { + elseif ($period < 1296000) { $title_period = __('Last week'); - $time_format = 'M j'; + $time_format = 'M d H:i'; } - elseif ($period <= 2419200) { + elseif ($period < 2592000) { $title_period = __('Last month'); - $time_format = 'M j'; + $time_format = 'M d H\h'; } else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; + $time_format = 'M d H\h'; } // Set variables @@ -462,23 +461,28 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ } $long_index = array(); - - if ($period <= 3600) { + + // Set the title and time format + if ($period <= 21600) { $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } elseif ($period <= 86400) { + $time_format = 'H:i:s'; + } + elseif ($period < 86400) { $title_period = __('Last day'); - $time_format = 'G:i'; - } elseif ($period <= 604800) { + $time_format = 'H:i'; + } + elseif ($period < 1296000) { $title_period = __('Last week'); - $time_format = 'M j'; - } elseif ($period <= 2419200) { + $time_format = 'M d H:i'; + } + elseif ($period < 2592000) { $title_period = __('Last month'); - $time_format = 'M j'; - } else { + $time_format = 'M d H\h'; + } + else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; - } + $time_format = 'M d H\h'; + } $graph_values = array(); $module_name_list = array(); @@ -722,21 +726,26 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ } */ - if ($period <= 3600) { + // Set the title and time format + if ($period <= 21600) { $title_period = __('Last hour'); - $time_format = 'G:i:s'; - } elseif ($period <= 86400) { + $time_format = 'H:i:s'; + } + elseif ($period < 86400) { $title_period = __('Last day'); - $time_format = 'G:i'; - } elseif ($period <= 604800) { + $time_format = 'H:i'; + } + elseif ($period < 1296000) { $title_period = __('Last week'); - $time_format = 'M j'; - } elseif ($period <= 2419200) { + $time_format = 'M d H:i'; + } + elseif ($period < 2592000) { $title_period = __('Last month'); - $time_format = 'M j'; - } else { + $time_format = 'M d H\h'; + } + else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; + $time_format = 'M d H\h'; } $flash_charts = $config['flash_charts']; @@ -1797,27 +1806,26 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $k++; } - ///////////////////////////////////////////////////////////////// // Set the title and time format - if ($period <= 3600) { + if ($period <= 21600) { $title_period = __('Last hour'); - $time_format = 'G:i:s'; + $time_format = 'H:i:s'; } - elseif ($period <= 86400) { + elseif ($period < 86400) { $title_period = __('Last day'); - $time_format = 'G:i'; + $time_format = 'H:i'; } - elseif ($period <= 604800) { + elseif ($period < 1296000) { $title_period = __('Last week'); - $time_format = 'M j'; + $time_format = 'M d H:i'; } - elseif ($period <= 2419200) { + elseif ($period < 2592000) { $title_period = __('Last month'); - $time_format = 'M j'; + $time_format = 'M d H\h'; } else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; + $time_format = 'M d H\h'; } $timestamp_short = date($time_format, $timestamp); @@ -1896,27 +1904,27 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, } } } -/////////////////////////////////////////////////// + /////////////////////////////////////////////////// // Set the title and time format - if ($period <= 3600) { + if ($period <= 21600) { $title_period = __('Last hour'); - $time_format = 'G:i:s'; + $time_format = 'H:i:s'; } - elseif ($period <= 86400) { + elseif ($period < 86400) { $title_period = __('Last day'); - $time_format = 'G:i'; + $time_format = 'H:i'; } - elseif ($period <= 604800) { + elseif ($period < 1296000) { $title_period = __('Last week'); - $time_format = 'M j'; + $time_format = 'M d H:i'; } - elseif ($period <= 2419200) { + elseif ($period < 2592000) { $title_period = __('Last month'); - $time_format = 'M j'; + $time_format = 'M d H\h'; } else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; + $time_format = 'M d H\h'; } // Flash chart @@ -2411,25 +2419,25 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, ///////////////////////////////////////////////////////////////// // Set the title and time format - if ($period <= 3600) { + if ($period <= 21600) { $title_period = __('Last hour'); - $time_format = 'G:i:s'; + $time_format = 'H:i:s'; } - elseif ($period <= 86400) { + elseif ($period < 86400) { $title_period = __('Last day'); - $time_format = 'G:i'; + $time_format = 'H:i'; } - elseif ($period <= 604800) { + elseif ($period < 1296000) { $title_period = __('Last week'); - $time_format = 'M j'; + $time_format = 'M d H:i'; } - elseif ($period <= 2419200) { + elseif ($period < 2592000) { $title_period = __('Last month'); - $time_format = 'M j'; + $time_format = 'M d H\h'; } else { $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); - $time_format = 'M j'; + $time_format = 'M d H\h'; } $timestamp_short = date($time_format, $timestamp);