").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=!t.length?this.document[0].body:t},_destroy:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),V("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==V.uiBackCompat&&V.widget("ui.tooltip",V.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});V.ui.tooltip});
\ No newline at end of file
diff --git a/pandora_console/include/styles/js/jquery-ui_custom.css b/pandora_console/include/styles/js/jquery-ui_custom.css
index d9adde2a0f..213adeffac 100644
--- a/pandora_console/include/styles/js/jquery-ui_custom.css
+++ b/pandora_console/include/styles/js/jquery-ui_custom.css
@@ -95,11 +95,34 @@
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
- margin-top: 3px;
border-bottom: 0;
background: transparent;
font-weight: normal;
color: #555555;
+ border-radius: 50%;
+ text-align: center;
+ border: 2px solid #ccc;
+}
+.ui-datepicker td,
+a.ui-state-default,
+.ui-datepicker td a {
+ width: 30px !important;
+ height: 30px !important;
+}
+a.ui-state-default:hover {
+ background-color: #82b92e;
+}
+a.ui-state-default > span {
+ text-align: center;
+ margin-top: 2px;
+}
+a.ui-state-default > span:hover {
+ font-weight: bold !important;
+}
+.ui-datepicker-current-day > a {
+ background-color: #82b92e !important;
+ font-weight: bold !important;
+ border: 2px solid #000 !important;
}
.ui-corner-all,
.ui-corner-top,
@@ -128,13 +151,44 @@
#ui-datepicker-div {
border-color: #b1b1b1;
background: #ffffff;
+ border-radius: 15px;
+ overflow: hidden;
+ position: absolute;
+ width: 400px !important;
+ border: 2px solid var(--primary-color);
+}
+.ui-datepicker .ui-datepicker-header {
+ position: relative;
+ padding: 0.2em 0;
+ border-radius: 15px 15px 0px 0px;
+}
+.ui-datepicker-title,
+.ui-datepicker-month,
+.ui-datepicker-year {
+ height: 30px;
+}
+.ui-datepicker-month,
+.ui-datepicker-year {
+ width: 80px !important;
+}
+.ui-datepicker-month {
+ margin-left: -10px !important;
+ margin-right: 25px !important;
}
.ui-widget-header {
- background: #b1b1b1;
+ background: white;
color: #ffffff;
}
.ui-datepicker-calendar th {
- background-color: #3f3f3f;
+ background-color: #fff;
+ padding-left: 15px;
+ text-align: initial;
+}
+.ui-datepicker-calendar th span {
+ color: #000;
+}
+.ui-widget-header {
+ height: 20px !important;
}
.ui-dialog .ui-widget-header {
margin: 3px 3px 0px 3px;
@@ -150,7 +204,10 @@
margin: 0px 15px 0px 15px;
}
.ui-timepicker-div .ui-datepicker-title {
- color: white;
+ color: black;
+}
+.ui-timepicker-div dl {
+ margin-top: 0px !important;
}
.ui-datepicker-buttonpane button {
border-color: #b1b1b1;
@@ -175,7 +232,6 @@
border: 0px;
}
-.ui-state-hover .ui-icon,
.ui-state-focus .ui-icon,
.ui-button:hover .ui-icon,
.ui-button:focus .ui-icon {
@@ -208,35 +264,6 @@ a.ui-button:active,
border: none;
}
-.ui-state-hover:before,
-.ui-widget-content .ui-state-hover:before,
-.ui-widget-header .ui-state-hover:before {
- content: "";
- position: absolute;
- left: 25%;
- bottom: -10%;
- height: 1px;
- width: 50%;
- border-bottom: 4px solid #82b92e;
-}
-
-.ui-priority-secondary:hover {
- content: "";
- position: absolute;
- bottom: -5px;
- width: 100%;
- border-bottom: 5px solid #82b92e;
-}
-
-.ui-priority-primary:hover {
- content: "";
- position: absolute;
- right: 5px;
- bottom: -5px;
- width: 100%;
- border-bottom: 5px solid #82b92e;
-}
-
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
@@ -289,3 +316,21 @@ input[type="submit"].ui-button-dialog {
height: 30px;
width: 90px;
}
+
+.ui-priority-primary,
+.ui-priority-secondary {
+ background-color: #fff !important;
+ color: var(--primary-color) !important;
+ border: 2px solid var(--primary-color) !important;
+ box-shadow: none !important;
+}
+
+.ui-timepicker-div > dl dt,
+.ui-timepicker-div > dl dd {
+ font-weight: bold !important;
+}
+
+.ui-timepicker-div > dl dt,
+.ui_tpicker_time {
+ margin-left: 10px !important;
+}
diff --git a/pandora_console/operation/inventory/inventory.php b/pandora_console/operation/inventory/inventory.php
index 63b302062c..54aa18f341 100755
--- a/pandora_console/operation/inventory/inventory.php
+++ b/pandora_console/operation/inventory/inventory.php
@@ -32,6 +32,54 @@ use PandoraFMS\Enterprise\Metaconsole\Node;
require_once $config['homedir'].'/include/functions_users.php';
require_once $config['homedir'].'/include/functions_inventory.php';
+// Get different date to search the report.
+$utimestamp = (int) get_parameter('date_end', 0);
+$datetime_end = strtotime($utimestamp.' '.$time_end);
+
+// Calculate new inteval for all reports.
+$custom_date = get_parameter('custom_date', 0);
+$date = get_parameter('date', SECONDS_1DAY);
+$date_text = get_parameter('date_text', SECONDS_1DAY);
+$date_init_less = (strtotime(date('Y-m-j')) - SECONDS_1DAY);
+$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
+$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
+if ($custom_date === '1') {
+ if ($datetime_init >= $datetime_end) {
+ $datetime_init = $date_init_less;
+ }
+
+ $period = ($datetime_end - $datetime_init);
+} else if ($custom_date === '2') {
+ $utimestamp = date('Y/m/d H:i:s');
+ $date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - $date_text));
+ $period = (strtotime($utimestamp) - strtotime($date_start));
+} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
+ if ($date === 'this_week') {
+ $monday = date('Y/m/d', strtotime('last monday'));
+
+ $sunday = date('Y/m/d', strtotime($monday.' +6 days'));
+ $period = (strtotime($sunday) - strtotime($monday));
+ $date_init = $monday;
+ $utimestamp = $sunday;
+ } else if ($date === 'this_month') {
+ $utimestamp = date('Y/m/d', strtotime('last day of this month'));
+ $first_of_month = date('Y/m/d', strtotime('first day of this month'));
+ $period = (strtotime($utimestamp) - strtotime($first_of_month));
+ } else if ($date === 'past_month') {
+ $utimestamp = date('Y/m/d', strtotime('last day of previous month'));
+ $first_of_month = date('Y/m/d', strtotime('first day of previous month'));
+ $period = (strtotime($utimestamp) - strtotime($first_of_month));
+ } else if ($date === 'past_week') {
+ $utimestamp = date('Y-m-d', strtotime('sunday', strtotime('last week')));
+ $first_of_week = date('Y-m-d', strtotime('monday', strtotime('last week')));
+ $period = (strtotime($utimestamp) - strtotime($first_of_week));
+ }
+} else {
+ $utimestamp = date('Y/m/d H:i:s');
+ $date_start = date('Y/m/d H:i:s', (strtotime($utimestamp) - $date));
+ $period = (strtotime($utimestamp) - strtotime($date_start));
+}
+
if (is_ajax() === true) {
$get_csv_url = (bool) get_parameter('get_csv_url');
$get_data_basic_info = (bool) get_parameter('get_data_basic_info');
@@ -43,7 +91,6 @@ if (is_ajax() === true) {
// 0 is All groups
$inventory_search_string = (string) get_parameter('search_string');
$export = (string) get_parameter('export');
- $utimestamp = (int) get_parameter('utimestamp', 0);
$inventory_agent = (string) get_parameter('agent', '');
$order_by_agent = (boolean) get_parameter('order_by_agent', 0);
@@ -98,6 +145,7 @@ if (is_ajax() === true) {
$agents_ids,
$inventory_module,
$utimestamp,
+ $period,
$inventory_search_string,
$export,
false,
@@ -122,12 +170,14 @@ if (is_ajax() === true) {
$id_group = (int) get_parameter('id_group', 0);
$params = [
- 'search' => $filter['value'],
- 'start' => $start,
- 'length' => $length,
- 'order' => $order,
- 'id_agent' => $id_agent,
- 'id_group' => $id_group,
+ 'search' => $filter['value'],
+ 'start' => $start,
+ 'length' => $length,
+ 'order' => $order,
+ 'id_agent' => $id_agent,
+ 'id_group' => $id_group,
+ 'utimestamp' => strtotime($utimestamp),
+ 'period' => $period,
];
$data = get_data_basic_info_sql($params);
@@ -677,26 +727,17 @@ $table->data[1][1] = html_print_label_input_block(
// Date filter. In Metaconsole has not reason for show.
if (is_metaconsole() === false) {
- $dates = inventory_get_dates(
- $inventory_module,
- $inventory_id_agent,
- $inventory_id_group
- );
- $table->data[1][2] = html_print_label_input_block(
- __('Date'),
- html_print_select(
- $dates,
+ $table->data[1][2] .= html_print_label_input_block(
+ __('Date').':
',
+ html_print_select_date_range(
'utimestamp',
- $utimestamp,
- '',
- __('Last'),
- 0,
true,
- false,
- false,
- '',
- false,
- 'width:100%;'
+ get_parameter('utimestamp', SECONDS_1DAY),
+ $date_init,
+ $time_init,
+ date('Y/m/d'),
+ date('H:i:s'),
+ $date_text
)
);
}
@@ -1301,6 +1342,9 @@ if ($inventory_module !== 'basic') {
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('ajaxqueue');
ui_require_jquery_file('bgiframe');
+/*
+ ui_include_time_picker();
+ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');*/
?>
diff --git a/pandora_console/operation/network/network_report.php b/pandora_console/operation/network/network_report.php
index 15716e653c..dfc5de2634 100644
--- a/pandora_console/operation/network/network_report.php
+++ b/pandora_console/operation/network/network_report.php
@@ -42,19 +42,46 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
// Include JS timepicker.
ui_include_time_picker();
-// Query params and other initializations.
-$time_greater = get_parameter('time_greater', date(TIME_FORMAT));
-$date_greater = get_parameter('date_greater', date(DATE_FORMAT));
-$utimestamp_greater = strtotime($date_greater.' '.$time_greater);
-$is_period = (bool) get_parameter('is_period', false);
-$period = (int) get_parameter('period', SECONDS_1HOUR);
-$time_lower = get_parameter('time_lower', date(TIME_FORMAT, ($utimestamp_greater - $period)));
-$date_lower = get_parameter('date_lower', date(DATE_FORMAT, ($utimestamp_greater - $period)));
-$utimestamp_lower = ($is_period) ? ($utimestamp_greater - $period) : strtotime($date_lower.' '.$time_lower);
-if (!$is_period) {
- $period = ($utimestamp_greater - $utimestamp_lower);
+
+// Calculate range dates.
+$custom_date = get_parameter('custom_date', '0');
+$date = get_parameter('date', SECONDS_1DAY);
+if ($custom_date === '1') {
+ $date_init = get_parameter('date_init');
+ $time_init = get_parameter('time_init');
+ $date_end = get_parameter('date_end');
+ $time_end = get_parameter('time_end');
+ $date_from = strtotime($date_init.' '.$time_init);
+ $date_to = strtotime($date_end.' '.$time_end);
+} else if ($custom_date === '2') {
+ $date_text = get_parameter('date_text');
+ $date_units = get_parameter('date_units');
+ $period = ($date_text * $date_units);
+ $date_to = strtotime(date('Y-m-d H:i:s'));
+ $date_from = (strtotime($date_to) - $period);
+} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
+ if ($date === 'this_week') {
+ $date_from = strtotime('last monday');
+ $date_to = strtotime($date_from.' +6 days');
+ } else if ($date === 'this_month') {
+ $date_from = strtotime('first day of this month');
+ $date_to = strtotime('last day of this month');
+ } else if ($date === 'past_month') {
+ $date_from = strtotime('first day of previous month');
+ $date_to = strtotime('last day of previous month');
+ } else if ($date === 'past_week') {
+ $date_from = strtotime('monday', strtotime('last week'));
+ $date_to = strtotime('sunday', strtotime('last week'));
+ }
+} else {
+ $date_to = strtotime(date('Y-m-d H:i:s'));
+ $date_from = ($date_to - $date);
}
+// Query params and other initializations.
+$utimestamp_greater = $date_to;
+$utimestamp_lower = $date_from;
+
$top = (int) get_parameter('top', 10);
$main_value = ((bool) get_parameter('remove_filter', 0)) ? '' : get_parameter('main_value', '');
if (is_numeric($main_value) && !in_array($action, ['udp', 'tcp'])) {
@@ -66,9 +93,6 @@ if (!in_array($order_by, ['bytes', 'pkts', 'flows'])) {
$order_by = 'bytes';
}
-$style_end = ($is_period) ? 'display: none;' : '';
-$style_period = ($is_period) ? '' : 'display: none;';
-
// Build the table.
$table = new stdClass();
$table->class = 'filter-table-adv';
@@ -112,83 +136,7 @@ $table->data[0][] = html_print_label_input_block(
$table->data[1][] = html_print_label_input_block(
__('Start date'),
- html_print_div(
- [
- 'id' => 'end_date_container',
- 'content' => html_print_input_text(
- 'date_lower',
- $date_lower,
- '',
- 10,
- 10,
- true
- ).html_print_input_text(
- 'time_lower',
- $time_lower,
- '',
- 7,
- 8,
- true
- ),
- ],
- true
- ).html_print_div(
- [
- 'id' => 'period_container',
- 'style' => 'display: none;',
- 'content' => html_print_label_input_block(
- '',
- html_print_extended_select_for_time(
- 'period',
- $period,
- '',
- '',
- 0,
- false,
- true
- ),
- ),
- ],
- true
- )
-);
-
-$table->data[1][] = html_print_label_input_block(
- __('End date'),
- html_print_div(
- [
- 'id' => '',
- 'class' => '',
- 'content' => html_print_input_text(
- 'date_greater',
- $date_greater,
- '',
- 10,
- 10,
- true
- ).html_print_input_text(
- 'time_greater',
- $time_greater,
- '',
- 7,
- 8,
- true
- ),
- ],
- true
- )
-);
-
-$table->data[2][] = html_print_label_input_block(
- __('Defined period'),
- html_print_checkbox_switch(
- 'is_period',
- 1,
- ($is_period === true) ? 1 : 0,
- true,
- false,
- 'network_report_click_period(event)'
- )
+ html_print_select_date_range('date', true)
);
echo '