From eca876212c335f6b8fc534a845f72da0211afb07 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 17 Dec 2019 12:15:51 +0100 Subject: [PATCH] Ent 5095 visualizacion formato de fechas --- .../godmode/setup/setup_visuals.php | 13 ++++++ pandora_console/include/functions_config.php | 8 ++++ .../include/functions_reporting_html.php | 41 +++++++++++++------ 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 9fce3076d8..9c3c857b0a 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1051,6 +1051,19 @@ $row++; $table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true); $row++; + $interval_description = [ + 'large' => 'Long', + 'tiny' => 'Short', + ]; + $table_report->data[$row][0] = __('Interval description'); + $table_report->data[$row][0] .= ui_print_help_tip( + __('A long interval description is for example 10 hours, 20 minutes 33 seconds”, a short one is 10h 20m 33s'), + true + ); + $table_report->data[$row][1] = html_print_select($interval_description, 'interval_description', $config['interval_description'], '', '', '', true, false, false); + + $row++; + // ---------------------------------------------------------------------- $dirItems = scandir($config['homedir'].'/images/custom_logo'); foreach ($dirItems as $entryDir) { diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 0e4dd9940d..92491fb02b 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1289,6 +1289,10 @@ function config_update_config() $error_update[] = __('Font size for items reports'); } + if (!config_update_value('interval_description', (string) get_parameter('interval_description', 'large'))) { + $error_update[] = __('Interval description'); + } + if (!config_update_value('custom_report_front', get_parameter('custom_report_front'))) { $error_update[] = __('Custom report front'); } @@ -2813,6 +2817,10 @@ function config_process_config() config_update_value('font_size_item_report', 2); } + if (!isset($config['interval_description'])) { + config_update_value('interval_description', 'large'); + } + if (!isset($config['custom_report_front_font'])) { config_update_value('custom_report_front_font', 'FreeSans.ttf'); } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 933c0e8134..6b29b70797 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -444,6 +444,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) global $config; + $interval_description = $config['interval_description']; + if ($mini) { $font_size = '1.5'; } else { @@ -606,7 +608,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if ($sla['time_total'] != 0) { $row2[] = human_time_description_raw( - $sla['time_total'] + $sla['time_total'], + false, + $interval_description ); } else { $row2[] = '--'; @@ -615,7 +619,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if ($sla['time_error'] != 0) { $row2[] = ''.human_time_description_raw( $sla['time_error'], - true + true, + $interval_description ).''; } else { $row2[] = '--'; @@ -624,7 +629,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if ($sla['time_ok'] != 0) { $row2[] = ''.human_time_description_raw( $sla['time_ok'], - true + true, + $interval_description ).''; } else { $row2[] = '--'; @@ -633,7 +639,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if ($sla['time_unknown'] != 0) { $row2[] = ''.human_time_description_raw( $sla['time_unknown'], - true + true, + $interval_description ).''; } else { $row2[] = '--'; @@ -642,7 +649,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if ($sla['time_not_init'] != 0) { $row2[] = ''.human_time_description_raw( $sla['time_not_init'], - true + true, + $interval_description ).''; } else { $row2[] = '--'; @@ -651,7 +659,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0) if ($sla['time_downtime'] != 0) { $row2[] = ''.human_time_description_raw( $sla['time_downtime'], - true + true, + $interval_description ).''; } else { $row2[] = '--'; @@ -3009,6 +3018,8 @@ function reporting_html_availability($table, $item, $pdf=0) global $config; + $interval_description = $config['interval_description']; + if (!empty($item['data'])) { $table1 = new stdClass(); $table1->width = '99%'; @@ -3144,7 +3155,8 @@ function reporting_html_availability($table, $item, $pdf=0) if ($row['time_total'] != 0 && $item['fields']['total_time']) { $table_row[] = human_time_description_raw( $row['time_total'], - true + true, + $interval_description ); } else if ($row['time_total'] == 0 && $item['fields']['total_time']) { $table_row[] = '--'; @@ -3155,7 +3167,8 @@ function reporting_html_availability($table, $item, $pdf=0) if ($row['time_error'] != 0 && $item['fields']['time_failed']) { $table_row[] = human_time_description_raw( $row['time_error'], - true + true, + $interval_description ); } else if ($row['time_error'] == 0 && $item['fields']['time_failed']) { $table_row[] = '--'; @@ -3166,7 +3179,8 @@ function reporting_html_availability($table, $item, $pdf=0) if ($row['time_ok'] != 0 && $item['fields']['time_in_ok_status']) { $table_row[] = human_time_description_raw( $row['time_ok'], - true + true, + $interval_description ); } else if ($row['time_ok'] == 0 && $item['fields']['time_in_ok_status']) { $table_row[] = '--'; @@ -3177,7 +3191,8 @@ function reporting_html_availability($table, $item, $pdf=0) if ($row['time_unknown'] != 0 && $item['fields']['time_in_unknown_status']) { $table_row[] = human_time_description_raw( $row['time_unknown'], - true + true, + $interval_description ); } else if ($row['time_unknown'] == 0 && $item['fields']['time_in_unknown_status']) { $table_row[] = '--'; @@ -3188,7 +3203,8 @@ function reporting_html_availability($table, $item, $pdf=0) if ($row['time_not_init'] != 0 && $item['fields']['time_of_not_initialized_module']) { $table_row[] = human_time_description_raw( $row['time_not_init'], - true + true, + $interval_description ); } else if ($row['time_not_init'] == 0 && $item['fields']['time_of_not_initialized_module']) { $table_row[] = '--'; @@ -3199,7 +3215,8 @@ function reporting_html_availability($table, $item, $pdf=0) if ($row['time_downtime'] != 0 && $item['fields']['time_of_downtime']) { $table_row[] = human_time_description_raw( $row['time_downtime'], - true + true, + $interval_description ); } else if ($row['time_downtime'] == 0 && $item['fields']['time_of_downtime']) { $table_row[] = '--';