2011-12-30 Vanessa Gil <vanessa.gil@artica.es>

* godmode/netflow/nf_report_item.php
	  godmode/netflow/nf_item_list.php
	  operation/netflow/nf_view: Changed the report date and interval.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5310 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2011-12-30 15:16:07 +00:00
parent a0ff9838d8
commit 9f20795bc2
5 changed files with 37 additions and 89 deletions

View File

@ -1,3 +1,8 @@
2011-12-30 Vanessa Gil <vanessa.gil@artica.es>
* godmode/netflow/nf_report_item.php
godmode/netflow/nf_item_list.php
operation/netflow/nf_view: Changed the report date and interval.
2011-12-30 Vanessa Gil <vanessa.gil@artica.es> 2011-12-30 Vanessa Gil <vanessa.gil@artica.es>
* godmode/netflow/nf_edit.php * godmode/netflow/nf_edit.php
godmode/netflow/nf_item_list.php: Cascade delete filters. godmode/netflow/nf_item_list.php: Cascade delete filters.

View File

@ -138,13 +138,11 @@ $total_reports_item = $total_reports_item[0]['total'];
$data[1] = $item['id_filter']; $data[1] = $item['id_filter'];
$data[2] = $item['period']; $data[2] = $item['max'];
$data[3] = $item['max']; $data[3] = $item['show_graph'];
$data[4] = $item['show_graph']; $data[4] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
$data[5] = "<a onclick='if(confirm(\"" . __('Are you sure?') . "\")) return true; else return false;'
href='index.php?sec=netf&sec2=godmode/netflow/nf_item_list&delete=1&id_rc=".$item['id_rc']."&id=".$id."&offset=0'>" . href='index.php?sec=netf&sec2=godmode/netflow/nf_item_list&delete=1&id_rc=".$item['id_rc']."&id=".$id."&offset=0'>" .
html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" . html_print_image('images/cross.png', true, array('title' => __('Delete'))) . "</a>" .
html_print_checkbox_extended ('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true); html_print_checkbox_extended ('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true);

View File

@ -49,37 +49,24 @@ ui_print_page_header (__('Netflow Report'), "images/networkmap/so_cisco_new.png"
if ($id_rc) { if ($id_rc) {
$item = netflow_reports_get_content ($id_rc); $item = netflow_reports_get_content ($id_rc);
$date = $item['date'];
$period = $item['period'];
$name_filter = $item['id_filter']; $name_filter = $item['id_filter'];
$max_val = $item['max']; $max_val = $item['max'];
$show_graph = $item['show_graph']; $show_graph = $item['show_graph'];
} else { } else {
$date = '';
$period ='';
$name_filter = ''; $name_filter = '';
$max_val = ''; $max_val = '';
$show_graph = ''; $show_graph = '';
} }
if ($update) { if ($update) {
$date = get_parameter_post ('date');
$time = get_parameter_post ('time');
$period = get_parameter ('period');
$name_filter = get_parameter('id_filter'); $name_filter = get_parameter('id_filter');
$max_val = get_parameter('max','2'); $max_val = get_parameter('max','2');
$show_graph = get_parameter('show_graph',''); $show_graph = get_parameter('show_graph','');
$date = str_replace('-','/',$date);
$timedate = $date .".".$time;
$date_time = strtotime ($date." ".$time);
$result = db_process_sql_update ('tnetflow_report_content', $result = db_process_sql_update ('tnetflow_report_content',
array ( array (
'id_report' => $id, 'id_report' => $id,
'id_filter' => $name_filter, 'id_filter' => $name_filter,
'date' => $date_time,
'period' => $period,
'max' => $max_val, 'max' => $max_val,
'show_graph' => $show_graph 'show_graph' => $show_graph
), ),
@ -91,22 +78,13 @@ if ($update) {
} }
if ($create){ if ($create){
$date = get_parameter_post ('date');
$time = get_parameter_post ('time');
$period = get_parameter ('period');
$name_filter = get_parameter('id_filter'); $name_filter = get_parameter('id_filter');
$max_val = get_parameter('max','2'); $max_val = get_parameter('max','2');
$show_graph = get_parameter('show_graph',''); $show_graph = get_parameter('show_graph','');
$date = str_replace('-','/',$date);
$timedate = $date .".".$time;
$date_time = strtotime ($date." ".$time);
$values = array ( $values = array (
'id_report' => $id, 'id_report' => $id,
'id_filter' => $name_filter, 'id_filter' => $name_filter,
'date' => $date_time,
'period' => $period,
'max' => $max_val, 'max' => $max_val,
'show_graph' => $show_graph 'show_graph' => $show_graph
); );
@ -118,7 +96,7 @@ if ($create){
echo '<h3 class="suc">'.__ ('Item created successfully').'</h3>'; echo '<h3 class="suc">'.__ ('Item created successfully').'</h3>';
} }
$table->width = '80%'; $table->width = '70%';
$table->border = 0; $table->border = 0;
$table->cellspacing = 3; $table->cellspacing = 3;
$table->cellpadding = 5; $table->cellpadding = 5;
@ -127,42 +105,14 @@ $table->style[0] = 'vertical-align: top;';
$table->data = array (); $table->data = array ();
$table->data[0][0] = '<b>'.__('Date').'</b>';
$table->data[0][1] = html_print_input_text ('date', date ("Y/m/d", get_system_time () - 86400), false, 10, 10, true);
$table->data[0][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-date'),this);"));
$table->data[0][1] .= html_print_input_text ('time', date ("H:i:s", get_system_time () - 86400), false, 10, 5, true);
$table->data[1][0] = '<b>'.__('Interval').'</b>';
$values_period = array ('600' => __('10 mins'),
'900' => __('15 mins'),
'1800' => __('30 mins'),
'3600' => __('1 hour'),
'7200' => __('2 hours'),
'18000' => __('5 hours'),
'43200' => __('12 hours'),
'86400' => __('1 day'),
'172800' => __('2 days'),
'432000' => __('5 days'),
'1296000' => __('15 days'),
'604800' => __('Last week'),
'2592000' => __('Last month'),
'5184000' => __('2 months'),
'7776000' => __('3 months'),
'15552000' => __('6 months'),
'31104000' => __('Last year'),
'62208000' => __('2 years')
);
$table->data[1][1] = html_print_select ($values_period, 'period', $period, '', '', 0, true, false, false);
$filters = netflow_get_filters (); $filters = netflow_get_filters ();
if ($filters === false) { if ($filters === false) {
$filters = array (); $filters = array ();
} }
$table->data[2][0] = '<b>'.__('Filters').'</b>'; $table->data[0][0] = '<b>'.__('Filters').'</b>';
$table->data[2][1] = html_print_select($filters, 'id_filter', $name_filter, '', '', 0, true); $table->data[0][1] = html_print_select($filters, 'id_filter', $name_filter, '', '', 0, true);
$table->data[3][0] = '<b>'.__('Max values aggregated').'</b>'; $table->data[1][0] = '<b>'.__('Max values aggregated').'</b>';
$max_values = array ('2' => '2', $max_values = array ('2' => '2',
'5' => '5', '5' => '5',
'10' => '10', '10' => '10',
@ -171,9 +121,9 @@ $table->data[3][0] = '<b>'.__('Max values aggregated').'</b>';
'25' => '25', '25' => '25',
'50' => '50' '50' => '50'
); );
$table->data[3][1] = html_print_select ($max_values, 'max', $max_val, '', '', 0, true); $table->data[1][1] = html_print_select ($max_values, 'max', $max_val, '', '', 0, true);
$table->data[4][0] = '<b>'.__('Elements').'</b>'; $table->data[2][0] = '<b>'.__('Elements').'</b>';
$show_graph_options = Array(); $show_graph_options = Array();
$show_graph_options[0] = __('Area graph'); $show_graph_options[0] = __('Area graph');
@ -181,7 +131,7 @@ $show_graph_options[1] = __('Pie graph');
$show_graph_options[2] = __('Table values'); $show_graph_options[2] = __('Table values');
$show_graph_options[3] = __('Total period'); $show_graph_options[3] = __('Total period');
$table->data[4][1] = html_print_select ($show_graph_options, 'show_graph', $show_graph,'','',0,true); $table->data[2][1] = html_print_select ($show_graph_options, 'show_graph', $show_graph,'','',0,true);
echo '<form method="post" action="index.php?sec=netf&sec2=godmode/netflow/nf_report_item&id='.$id.'">'; echo '<form method="post" action="index.php?sec=netf&sec2=godmode/netflow/nf_report_item&id='.$id.'">';
html_print_table ($table); html_print_table ($table);

View File

@ -21,7 +21,7 @@ if (function_exists ('mb_internal_encoding')) {
// Set to 1 to do not check for installer or config file (for development!). // Set to 1 to do not check for installer or config file (for development!).
// Activate gives more error information, not useful for production sites // Activate gives more error information, not useful for production sites
$develop_bypass = 1; $develop_bypass = 0;
if ($develop_bypass != 1) { if ($develop_bypass != 1) {
// If no config file, automatically try to install // If no config file, automatically try to install

View File

@ -153,8 +153,9 @@ function exec_command_aggregate ($start_date, $end_date, $command, $show){
$id = get_parameter('id'); $id = get_parameter('id');
$period = get_parameter('period'); $period = get_parameter('period', '86400');
$date_= get_parameter('date', date ("Y/m/d", get_system_time ()));
$time_= get_parameter('time', date ("H:i:s", get_system_time ()));
$report_name = db_get_value('id_name', 'tnetflow_report', 'id_report', $id); $report_name = db_get_value('id_name', 'tnetflow_report', 'id_report', $id);
$time_format = 'Y/m/d.H:i:s'; $time_format = 'Y/m/d.H:i:s';
@ -183,9 +184,9 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_v
$table->data[0][0] = '<b>'.__('Date').'</b>'; $table->data[0][0] = '<b>'.__('Date').'</b>';
$table->data[0][1] = html_print_input_text ('date', date ("Y/m/d", get_system_time () - 86400), false, 10, 10, true); $table->data[0][1] = html_print_input_text ('date', $date_, false, 10, 10, true);
$table->data[0][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-date'),this);")); $table->data[0][1] .= html_print_image ("images/calendar_view_day.png", true, array ("alt" => "calendar", "onclick" => "scwShow(scwID('text-date'),this);"));
$table->data[0][1] .= html_print_input_text ('time', date ("H:i:s", get_system_time () - 86400), false, 10, 5, true); $table->data[0][1] .= html_print_input_text ('time', $time_, false, 10, 5, true);
$table->data[1][0] = '<b>'.__('Interval').'</b>'; $table->data[1][0] = '<b>'.__('Interval').'</b>';
$values_period = array ('600' => __('10 mins'), $values_period = array ('600' => __('10 mins'),
@ -208,7 +209,6 @@ echo '<form method="post" action="index.php?sec=netf&sec2=operation/netflow/nf_v
'62208000' => __('2 years') '62208000' => __('2 years')
); );
$table->data[1][1] = html_print_select ($values_period, 'period', $period, '', '', 0, true, false, false); $table->data[1][1] = html_print_select ($values_period, 'period', $period, '', '', 0, true, false, false);
html_print_table ($table); html_print_table ($table);
echo '<div class="action-buttons" style="width:60%;">'; echo '<div class="action-buttons" style="width:60%;">';
@ -231,22 +231,20 @@ if ($id!=''){
$content_report = db_get_row_sql($sql); $content_report = db_get_row_sql($sql);
$name_filter = $content_report['id_filter']; $name_filter = $content_report['id_filter'];
$interval = $content_report['period'];
$date = $content_report['date'];
$max_val= $content_report['max']; $max_val= $content_report['max'];
$element = $content_report['show_graph']; $element = $content_report['show_graph'];
$date_time = date($time_format, $date+84600);
if($update_date){ if($update_date){
$date = get_parameter_post ('date'); $date = get_parameter_post ('date');
$time = get_parameter_post ('time'); $time = get_parameter_post ('time');
$period = get_parameter('period','0'); $interval = get_parameter('period','86400');
$date = strtotime ($date." ".$time); } else {
$date = date ("Y/m/d", get_system_time ());
if(($period!='None')&&($period!='0')) $time = date ("H:i:s", get_system_time ());
$interval = $period; $interval ='86400';
} }
$date = strtotime ($date." ".$time);
$date_time = date($time_format, $date);
$limit = $date - $interval; $limit = $date - $interval;
$date_limit = date ($time_format, $limit); $date_limit = date ($time_format, $limit);
@ -468,11 +466,8 @@ if ($show_bpp)
} }
$j++; $j++;
} }
} }
if($aggregate!='none'){ if($aggregate!='none'){
switch ($element){ switch ($element){
case '0': case '0':
echo grafico_netflow_aggregate_area($result, $interval, 880, 540, '', '','','',$date); echo grafico_netflow_aggregate_area($result, $interval, 880, 540, '', '','','',$date);