Merge branch 'ent-11996-bugs-en-projection-graphs' into 'develop'
Ent 11996 bugs en projection graphs See merge request artica/pandorafms!6421
This commit is contained in:
commit
ef544fffbb
|
@ -1577,10 +1577,16 @@ function graphic_combined_module(
|
||||||
$server_name = metaconsole_get_server_by_id($modules[0]['server']);
|
$server_name = metaconsole_get_server_by_id($modules[0]['server']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($params_combined['custom_period']) !== false && $params_combined['custom_period'] !== false) {
|
||||||
|
$period = $params_combined['custom_period'];
|
||||||
|
} else {
|
||||||
|
$period = $params['period'];
|
||||||
|
}
|
||||||
|
|
||||||
if ($params_combined['projection']) {
|
if ($params_combined['projection']) {
|
||||||
$output_projection = forecast_projection_graph(
|
$output_projection = forecast_projection_graph(
|
||||||
$module_list[0],
|
$module_list[0],
|
||||||
$params['period'],
|
$period,
|
||||||
$params_combined['projection'],
|
$params_combined['projection'],
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -7266,6 +7266,8 @@ function html_print_select_date_range(
|
||||||
$date_init = date('Y/m/d', strtotime($date_end.' -1 days'));
|
$date_init = date('Y/m/d', strtotime($date_end.' -1 days'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_init = date('Y/m/d', strtotime($date_init));
|
||||||
|
|
||||||
if ($time_init === '') {
|
if ($time_init === '') {
|
||||||
$time_init = date('H:i:s');
|
$time_init = date('H:i:s');
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,7 +159,10 @@ function reporting_make_reporting_data(
|
||||||
$force_width_chart=null,
|
$force_width_chart=null,
|
||||||
$force_height_chart=null,
|
$force_height_chart=null,
|
||||||
$pdf=false,
|
$pdf=false,
|
||||||
$from_template=false
|
$from_template=false,
|
||||||
|
$filter_type='',
|
||||||
|
$custom_date_end='',
|
||||||
|
$custom_period=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -194,8 +197,7 @@ function reporting_make_reporting_data(
|
||||||
|
|
||||||
if (empty($contents)) {
|
if (empty($contents)) {
|
||||||
return reporting_check_structure_report($report);
|
return reporting_check_structure_report($report);
|
||||||
}
|
};
|
||||||
|
|
||||||
$metaconsole_on = is_metaconsole();
|
$metaconsole_on = is_metaconsole();
|
||||||
$index_content = 0;
|
$index_content = 0;
|
||||||
|
|
||||||
|
@ -562,7 +564,10 @@ function reporting_make_reporting_data(
|
||||||
$type,
|
$type,
|
||||||
$force_width_chart,
|
$force_width_chart,
|
||||||
$force_height_chart,
|
$force_height_chart,
|
||||||
$pdf
|
$pdf,
|
||||||
|
$filter_type,
|
||||||
|
$custom_date_end,
|
||||||
|
$custom_period
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -6804,7 +6809,10 @@ function reporting_projection_graph(
|
||||||
$type='dinamic',
|
$type='dinamic',
|
||||||
$force_width_chart=null,
|
$force_width_chart=null,
|
||||||
$force_height_chart=null,
|
$force_height_chart=null,
|
||||||
$pdf=false
|
$pdf=false,
|
||||||
|
$filter_type='',
|
||||||
|
$custom_date_end='',
|
||||||
|
$custom_period=false
|
||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
@ -6870,6 +6878,7 @@ function reporting_projection_graph(
|
||||||
$return['agent_name_db'] = $agent_name_db;
|
$return['agent_name_db'] = $agent_name_db;
|
||||||
$return['agent_name'] = $agent_name;
|
$return['agent_name'] = $agent_name;
|
||||||
$return['module_name'] = $module_name;
|
$return['module_name'] = $module_name;
|
||||||
|
$return['datetime'] = $report['datetime'];
|
||||||
|
|
||||||
set_time_limit(500);
|
set_time_limit(500);
|
||||||
|
|
||||||
|
@ -6890,8 +6899,24 @@ function reporting_projection_graph(
|
||||||
'return_img_base_64' => true,
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$top_n_value = $content['top_n_value'];
|
||||||
|
if ($filter_type === 'this_week') {
|
||||||
|
$current_date = date('Y/m/d H:i:s');
|
||||||
|
$monday = date('Y/m/d H:i:s', strtotime('last monday'));
|
||||||
|
$sunday = date('Y/m/d H:i:s', strtotime($monday.' +6 days'));
|
||||||
|
$top_n_value = (strtotime($sunday) - strtotime($current_date));
|
||||||
|
} else if ($filter_type === 'this_month') {
|
||||||
|
$current_date = date('Y/m/d H:i:s');
|
||||||
|
$last_of_month = date('Y/m/d', strtotime('last day of this month'));
|
||||||
|
$top_n_value = (strtotime($last_of_month) - strtotime($current_date));
|
||||||
|
} else if ($filter_type === 'chose_range') {
|
||||||
|
$current_date = date('Y/m/d H:i:s');
|
||||||
|
$top_n_value = (strtotime($custom_date_end) - strtotime($current_date));
|
||||||
|
}
|
||||||
|
|
||||||
$params_combined = [
|
$params_combined = [
|
||||||
'projection' => $content['top_n_value'],
|
'projection' => $top_n_value,
|
||||||
|
'custom_period' => $custom_period,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($pdf === true) {
|
if ($pdf === true) {
|
||||||
|
|
|
@ -120,10 +120,15 @@ function reporting_html_header(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function html_do_report_info($report)
|
function html_do_report_info($report, $custom_date_end=false, $custom_period=false)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
|
if ($custom_period !== false && $custom_date_end !== false) {
|
||||||
|
$report['datetime'] = strtotime($custom_date_end);
|
||||||
|
$report['period'] = $custom_period;
|
||||||
|
}
|
||||||
|
|
||||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||||
$background_color = '#222';
|
$background_color = '#222';
|
||||||
} else {
|
} else {
|
||||||
|
@ -171,10 +176,10 @@ function html_do_report_info($report)
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function reporting_html_print_report($report, $mini=false, $report_info=1)
|
function reporting_html_print_report($report, $mini=false, $report_info=1, $custom_date_end=false, $custom_period=false)
|
||||||
{
|
{
|
||||||
if ($report_info == 1) {
|
if ($report_info == 1) {
|
||||||
html_do_report_info($report);
|
html_do_report_info($report, $custom_date_end, $custom_period);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($report['contents'] as $key => $item) {
|
foreach ($report['contents'] as $key => $item) {
|
||||||
|
@ -227,6 +232,12 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
||||||
$label = '';
|
$label = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($custom_date_end !== false) {
|
||||||
|
$to = strtotime($custom_date_end);
|
||||||
|
} else {
|
||||||
|
$to = $item['date']['to'];
|
||||||
|
}
|
||||||
|
|
||||||
reporting_html_header(
|
reporting_html_header(
|
||||||
$table,
|
$table,
|
||||||
$mini,
|
$mini,
|
||||||
|
@ -235,7 +246,7 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
|
||||||
$item['date']['period'],
|
$item['date']['period'],
|
||||||
$item['date']['date'],
|
$item['date']['date'],
|
||||||
$item['date']['from'],
|
$item['date']['from'],
|
||||||
$item['date']['to'],
|
$to,
|
||||||
$label
|
$label
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -60,12 +60,29 @@ $datetime_end = strtotime($date_end.' '.$time_end);
|
||||||
$custom_date = get_parameter('custom_date', 0);
|
$custom_date = get_parameter('custom_date', 0);
|
||||||
$date = get_parameter('date', SECONDS_1DAY);
|
$date = get_parameter('date', SECONDS_1DAY);
|
||||||
$date_text = get_parameter('date_text', SECONDS_1DAY);
|
$date_text = get_parameter('date_text', SECONDS_1DAY);
|
||||||
if ($custom_date === '1') {
|
|
||||||
if ($datetime_init >= $datetime_end) {
|
|
||||||
$datetime_init = $date_init_less;
|
|
||||||
}
|
|
||||||
|
|
||||||
$period = ($datetime_end - $datetime_init);
|
$custom_date_end = '';
|
||||||
|
$filter_type = '';
|
||||||
|
$custom_period = false;
|
||||||
|
if ($custom_date === '1') {
|
||||||
|
if ($date === 'chose_range') {
|
||||||
|
$date_init = get_parameter('date_init', 0);
|
||||||
|
$date_init = explode(' ', $date_init);
|
||||||
|
$date_init = $date_init[0];
|
||||||
|
$date_init .= ' '.get_parameter('time_init', '00:00:00');
|
||||||
|
$custom_date_end = get_parameter('date_end', 0);
|
||||||
|
$custom_date_end .= ' '.get_parameter('time_end', '00:00:00');
|
||||||
|
$date_end = date('Y/m/d H:i:s');
|
||||||
|
$period = (strtotime($date_end) - strtotime($date_init));
|
||||||
|
$custom_period = (strtotime($custom_date_end) - strtotime($date_init));
|
||||||
|
$filter_type = 'chose_range';
|
||||||
|
} else {
|
||||||
|
if ($datetime_init >= $datetime_end) {
|
||||||
|
$datetime_init = $date_init_less;
|
||||||
|
}
|
||||||
|
|
||||||
|
$period = ($datetime_end - $datetime_init);
|
||||||
|
}
|
||||||
} else if ($custom_date === '2') {
|
} else if ($custom_date === '2') {
|
||||||
$date_units = get_parameter('date_units');
|
$date_units = get_parameter('date_units');
|
||||||
$date_end = date('Y/m/d H:i:s');
|
$date_end = date('Y/m/d H:i:s');
|
||||||
|
@ -73,16 +90,18 @@ if ($custom_date === '1') {
|
||||||
$period = (strtotime($date_end) - strtotime($date_start));
|
$period = (strtotime($date_end) - strtotime($date_start));
|
||||||
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) {
|
||||||
if ($date === 'this_week') {
|
if ($date === 'this_week') {
|
||||||
$monday = date('Y/m/d', strtotime('last monday'));
|
// Last monday.
|
||||||
|
$date_init = date('Y/m/d H:i:s', strtotime('last monday'));
|
||||||
$sunday = date('Y/m/d', strtotime($monday.' +6 days'));
|
// $date_end = date('Y/m/d H:i:s', strtotime($date_init.' +6 days'));
|
||||||
$period = (strtotime($sunday) - strtotime($monday));
|
$date_end = date('Y/m/d H:i:s');
|
||||||
$date_init = $monday;
|
$period = (strtotime($date_end) - strtotime($date_init));
|
||||||
$date_end = $sunday;
|
$filter_type = 'this_week';
|
||||||
} else if ($date === 'this_month') {
|
} else if ($date === 'this_month') {
|
||||||
$date_end = date('Y/m/d', strtotime('last day of this month'));
|
// $date_end = date('Y/m/d', strtotime('last day of this month'));
|
||||||
|
$date_end = date('Y/m/d H:i:s');
|
||||||
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
|
$first_of_month = date('Y/m/d', strtotime('first day of this month'));
|
||||||
$period = (strtotime($date_end) - strtotime($first_of_month));
|
$period = (strtotime($date_end) - strtotime($first_of_month));
|
||||||
|
$filter_type = 'this_month';
|
||||||
} else if ($date === 'past_month') {
|
} else if ($date === 'past_month') {
|
||||||
$date_end = date('Y/m/d', strtotime('last day of previous month'));
|
$date_end = date('Y/m/d', strtotime('last day of previous month'));
|
||||||
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
|
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
|
||||||
|
@ -265,10 +284,8 @@ ui_print_standard_header(
|
||||||
// ------------------------ INIT FORM -----------------------------------
|
// ------------------------ INIT FORM -----------------------------------
|
||||||
$table2 = new stdClass();
|
$table2 = new stdClass();
|
||||||
$table2->id = 'controls_table';
|
$table2->id = 'controls_table';
|
||||||
$table2->size[2] = '50%';
|
$table2->size[2] = '20%';
|
||||||
$table2->size[3] = '50%';
|
$table2->style[3] = 'position:absolute; left: auto';
|
||||||
$table2->style[0] = 'text-align:center';
|
|
||||||
$table2->style[1] = 'text-align:center';
|
|
||||||
$table2->styleTable = 'border:none';
|
$table2->styleTable = 'border:none';
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
|
@ -353,13 +370,20 @@ $report = reporting_make_reporting_data(
|
||||||
$date_end,
|
$date_end,
|
||||||
$time,
|
$time,
|
||||||
$period,
|
$period,
|
||||||
'dinamic'
|
'dinamic',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
$filter_type,
|
||||||
|
$custom_date_end,
|
||||||
|
$custom_period
|
||||||
);
|
);
|
||||||
for ($i = 0; $i < count($report['contents']); $i++) {
|
for ($i = 0; $i < count($report['contents']); $i++) {
|
||||||
$report['contents'][$i]['description'] = str_replace('
', '<br/>', $report['contents'][$i]['description']);
|
$report['contents'][$i]['description'] = str_replace('
', '<br/>', $report['contents'][$i]['description']);
|
||||||
}
|
}
|
||||||
|
|
||||||
reporting_html_print_report($report, false, $config['custom_report_info']);
|
reporting_html_print_report($report, false, $config['custom_report_info'], $custom_date_end, $custom_period);
|
||||||
|
|
||||||
|
|
||||||
echo '<div id="loading" class="center">';
|
echo '<div id="loading" class="center">';
|
||||||
|
|
Loading…
Reference in New Issue