[Netflow view] Added start date
Former-commit-id: 98134de0f1e8c40458b36b0a14ad0b8c87bff0f2
This commit is contained in:
parent
6299d23528
commit
33fd100d91
|
@ -90,25 +90,33 @@ $filter['router_ip'] = get_parameter('router_ip');
|
|||
// Read chart configuration.
|
||||
$chart_type = get_parameter('chart_type', 'netflow_area');
|
||||
$max_aggregates = (int) get_parameter('max_aggregates', 10);
|
||||
$period = (int) get_parameter('period', SECONDS_1DAY);
|
||||
$update_date = (int) get_parameter('update_date', 0);
|
||||
$date = get_parameter_post('date', date(DATE_FORMAT, get_system_time()));
|
||||
$time = get_parameter_post('time', date(TIME_FORMAT, get_system_time()));
|
||||
$connection_name = get_parameter('connection_name', '');
|
||||
$interval_length = get_parameter('interval_length', NETFLOW_RES_MEDD);
|
||||
$address_resolution = (int) get_parameter('address_resolution', $config['netflow_get_ip_hostname']);
|
||||
$filter_selected = (int) get_parameter('filter_selected', 0);
|
||||
|
||||
// Read time values.
|
||||
$date = get_parameter_post('date', date(DATE_FORMAT, get_system_time()));
|
||||
$time = get_parameter_post('time', date(TIME_FORMAT, get_system_time()));
|
||||
$end_date = strtotime($date.' '.$time);
|
||||
$is_period = (bool) get_parameter('is_period', false);
|
||||
$period = (int) get_parameter('period', SECONDS_1DAY);
|
||||
$time_lower = get_parameter('time_lower', date(TIME_FORMAT, ($end_date - $period)));
|
||||
$date_lower = get_parameter('date_lower', date(DATE_FORMAT, ($end_date - $period)));
|
||||
$start_date = ($is_period) ? ($end_date - $period) : strtotime($date_lower.' '.$time_lower);
|
||||
if (!$is_period) {
|
||||
$period = ($end_date - $start_date);
|
||||
} else {
|
||||
$time_lower = date(TIME_FORMAT, $start_date);
|
||||
$date_lower = date(DATE_FORMAT, $start_date);
|
||||
}
|
||||
|
||||
// Read buttons.
|
||||
$draw = get_parameter('draw_button', '');
|
||||
$save = get_parameter('save_button', '');
|
||||
$update = get_parameter('update_button', '');
|
||||
|
||||
|
||||
// Calculate start and end dates.
|
||||
$end_date = strtotime($date.' '.$time);
|
||||
$start_date = ($end_date - $period);
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
// Header.
|
||||
ui_print_page_header(
|
||||
|
@ -248,15 +256,40 @@ if (is_metaconsole()) {
|
|||
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td><b>'.__('Date').'</b></td>';
|
||||
echo '<td><b>'.__('End date').'</b></td>';
|
||||
echo '<td>'.html_print_input_text('date', $date, false, 13, 10, true).html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
['alt' => 'calendar']
|
||||
).ui_print_help_tip(__('Date format is YY/MM/DD'), true).html_print_input_text('time', $time, false, 10, 8, true).ui_print_help_tip(__('Watch format is hours (24h):minutes:seconds'), true).'</td>';
|
||||
|
||||
echo '<td><b>'.__('Interval').'</b></td>';
|
||||
echo '<td>'.html_print_select(netflow_get_valid_intervals(), 'period', $period, '', '', 0, true, false, false).'</td>';
|
||||
$class_not_period = ($is_period) ? 'nf_hidden' : 'nf_display';
|
||||
$class_period = ($is_period) ? 'nf_display' : 'nf_hidden';
|
||||
echo '<td>';
|
||||
echo '<b class="'.$class_period.'">'.__('Interval').'</b>';
|
||||
echo '<b class="'.$class_not_period.'">'.__('Start date').'</b>';
|
||||
echo html_print_checkbox(
|
||||
'is_period',
|
||||
1,
|
||||
($is_period === true) ? 1 : 0,
|
||||
true,
|
||||
false,
|
||||
'nf_view_click_period(event)'
|
||||
);
|
||||
echo ui_print_help_tip(__('Select this checkbox to write interval instead a date.'), true);
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
echo html_print_extended_select_for_time('period', $period, '', '', 0, false, true, false, true, $class_period);
|
||||
echo html_print_input_text('date_lower', $date_lower, false, 13, 10, true, false, false, '', $class_not_period);
|
||||
echo html_print_image(
|
||||
'images/calendar_view_day.png',
|
||||
true,
|
||||
[
|
||||
'alt' => 'calendar',
|
||||
'class' => $class_not_period,
|
||||
]
|
||||
).html_print_input_text('time_lower', $time_lower, false, 10, 8, true, false, false, '', $class_not_period);
|
||||
echo '</td>';
|
||||
|
||||
echo '<td><b>'.__('Resolution').ui_print_help_tip(__('The interval will be divided in chunks the length of the resolution.'), true).'</b></td>';
|
||||
echo '<td>'.html_print_select(
|
||||
|
@ -341,7 +374,7 @@ if (is_metaconsole()) {
|
|||
echo '</tr>';
|
||||
|
||||
echo '<tr id="filter_toggle">';
|
||||
echo '<td>';
|
||||
echo '<td colspan="5">';
|
||||
html_print_image(
|
||||
'images/darrowdown.png',
|
||||
false,
|
||||
|
@ -714,7 +747,7 @@ if (is_metaconsole()) {
|
|||
});
|
||||
});
|
||||
|
||||
$("#text-time").timepicker({
|
||||
$("#text-time, #text-time_lower").timepicker({
|
||||
showSecond: true,
|
||||
timeFormat: '<?php echo TIME_FORMAT_JS; ?>',
|
||||
timeOnlyTitle: '<?php echo __('Choose time'); ?>',
|
||||
|
@ -725,12 +758,17 @@ if (is_metaconsole()) {
|
|||
currentText: '<?php echo __('Now'); ?>',
|
||||
closeText: '<?php echo __('Close'); ?>'});
|
||||
|
||||
$("#text-date").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
$("#text-date, #text-date_lower").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
$.datepicker.regional["<?php echo get_user_language(); ?>"];
|
||||
|
||||
function nf_view_click_period(event) {
|
||||
$(".nf_display").toggle();
|
||||
$(".nf_hidden").toggle();
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.nf_filter {
|
||||
.nf_filter, .nf_hidden {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue