2011-12-22 Sergio Martin <sergio.martin@artica.es>

* 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
This commit is contained in:
zarzuelo 2011-12-22 10:08:00 +00:00
parent bef7daca71
commit 0e85fedb88
3 changed files with 78 additions and 62 deletions

View File

@ -1,3 +1,11 @@
2011-12-22 Sergio Martin <sergio.martin@artica.es>
* 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 <vanessa.gil@artica.es> 2011-12-21 Vanessa Gil <vanessa.gil@artica.es>
* operation/netflow/nf_view.php * operation/netflow/nf_view.php
godmode/netflow/nf_report_item.php godmode/netflow/nf_report_item.php

View File

@ -130,7 +130,7 @@ function custom_graphs_get_periods () {
$periods[12] = '12 '.__('hours'); $periods[12] = '12 '.__('hours');
$periods[24] = __('1 day'); $periods[24] = __('1 day');
$periods[48] = __('2 days'); $periods[48] = __('2 days');
$periods[360] = __('1 week'); $periods[168] = __('1 week');
$periods[720] = __('1 month'); $periods[720] = __('1 month');
$periods[4320] = __('6 months'); $periods[4320] = __('6 months');

View File

@ -380,26 +380,25 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
// Set the title and time format // Set the title and time format
if ($period <= 21600) {
if ($period <= 3600) {
$title_period = __('Last hour'); $title_period = __('Last hour');
$time_format = 'G:i:s'; $time_format = 'H:i:s';
} }
elseif ($period <= 86400) { elseif ($period < 86400) {
$title_period = __('Last day'); $title_period = __('Last day');
$time_format = 'G:i'; $time_format = 'H:i';
} }
elseif ($period <= 604800) { elseif ($period < 1296000) {
$title_period = __('Last week'); $title_period = __('Last week');
$time_format = 'M j'; $time_format = 'M d H:i';
} }
elseif ($period <= 2419200) { elseif ($period < 2592000) {
$title_period = __('Last month'); $title_period = __('Last month');
$time_format = 'M j'; $time_format = 'M d H\h';
} }
else { else {
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
$time_format = 'M j'; $time_format = 'M d H\h';
} }
// Set variables // Set variables
@ -462,23 +461,28 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
} }
$long_index = array(); $long_index = array();
if ($period <= 3600) { // Set the title and time format
if ($period <= 21600) {
$title_period = __('Last hour'); $title_period = __('Last hour');
$time_format = 'G:i:s'; $time_format = 'H:i:s';
} elseif ($period <= 86400) { }
elseif ($period < 86400) {
$title_period = __('Last day'); $title_period = __('Last day');
$time_format = 'G:i'; $time_format = 'H:i';
} elseif ($period <= 604800) { }
elseif ($period < 1296000) {
$title_period = __('Last week'); $title_period = __('Last week');
$time_format = 'M j'; $time_format = 'M d H:i';
} elseif ($period <= 2419200) { }
elseif ($period < 2592000) {
$title_period = __('Last month'); $title_period = __('Last month');
$time_format = 'M j'; $time_format = 'M d H\h';
} else { }
else {
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
$time_format = 'M j'; $time_format = 'M d H\h';
} }
$graph_values = array(); $graph_values = array();
$module_name_list = 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'); $title_period = __('Last hour');
$time_format = 'G:i:s'; $time_format = 'H:i:s';
} elseif ($period <= 86400) { }
elseif ($period < 86400) {
$title_period = __('Last day'); $title_period = __('Last day');
$time_format = 'G:i'; $time_format = 'H:i';
} elseif ($period <= 604800) { }
elseif ($period < 1296000) {
$title_period = __('Last week'); $title_period = __('Last week');
$time_format = 'M j'; $time_format = 'M d H:i';
} elseif ($period <= 2419200) { }
elseif ($period < 2592000) {
$title_period = __('Last month'); $title_period = __('Last month');
$time_format = 'M j'; $time_format = 'M d H\h';
} else { }
else {
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $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']; $flash_charts = $config['flash_charts'];
@ -1797,27 +1806,26 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events,
$k++; $k++;
} }
/////////////////////////////////////////////////////////////////
// Set the title and time format // Set the title and time format
if ($period <= 3600) { if ($period <= 21600) {
$title_period = __('Last hour'); $title_period = __('Last hour');
$time_format = 'G:i:s'; $time_format = 'H:i:s';
} }
elseif ($period <= 86400) { elseif ($period < 86400) {
$title_period = __('Last day'); $title_period = __('Last day');
$time_format = 'G:i'; $time_format = 'H:i';
} }
elseif ($period <= 604800) { elseif ($period < 1296000) {
$title_period = __('Last week'); $title_period = __('Last week');
$time_format = 'M j'; $time_format = 'M d H:i';
} }
elseif ($period <= 2419200) { elseif ($period < 2592000) {
$title_period = __('Last month'); $title_period = __('Last month');
$time_format = 'M j'; $time_format = 'M d H\h';
} }
else { else {
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $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); $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 // Set the title and time format
if ($period <= 3600) { if ($period <= 21600) {
$title_period = __('Last hour'); $title_period = __('Last hour');
$time_format = 'G:i:s'; $time_format = 'H:i:s';
} }
elseif ($period <= 86400) { elseif ($period < 86400) {
$title_period = __('Last day'); $title_period = __('Last day');
$time_format = 'G:i'; $time_format = 'H:i';
} }
elseif ($period <= 604800) { elseif ($period < 1296000) {
$title_period = __('Last week'); $title_period = __('Last week');
$time_format = 'M j'; $time_format = 'M d H:i';
} }
elseif ($period <= 2419200) { elseif ($period < 2592000) {
$title_period = __('Last month'); $title_period = __('Last month');
$time_format = 'M j'; $time_format = 'M d H\h';
} }
else { else {
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2));
$time_format = 'M j'; $time_format = 'M d H\h';
} }
// Flash chart // Flash chart
@ -2411,25 +2419,25 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Set the title and time format // Set the title and time format
if ($period <= 3600) { if ($period <= 21600) {
$title_period = __('Last hour'); $title_period = __('Last hour');
$time_format = 'G:i:s'; $time_format = 'H:i:s';
} }
elseif ($period <= 86400) { elseif ($period < 86400) {
$title_period = __('Last day'); $title_period = __('Last day');
$time_format = 'G:i'; $time_format = 'H:i';
} }
elseif ($period <= 604800) { elseif ($period < 1296000) {
$title_period = __('Last week'); $title_period = __('Last week');
$time_format = 'M j'; $time_format = 'M d H:i';
} }
elseif ($period <= 2419200) { elseif ($period < 2592000) {
$title_period = __('Last month'); $title_period = __('Last month');
$time_format = 'M j'; $time_format = 'M d H\h';
} }
else { else {
$title_period = __('Last %s days', format_numeric (($period / (3600 * 24)), 2)); $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); $timestamp_short = date($time_format, $timestamp);