Ent 5095 visualizacion formato de fechas

This commit is contained in:
Tatiana Llorente 2019-12-17 12:15:51 +01:00 committed by Daniel Rodriguez
parent 0b0c38f9c0
commit eca876212c
3 changed files with 50 additions and 12 deletions

View File

@ -1051,6 +1051,19 @@ $row++;
$table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true); $table_report->data[$row][1] = html_print_input_text('graph_image_height', $config['graph_image_height'], '', 20, 20, true);
$row++; $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'); $dirItems = scandir($config['homedir'].'/images/custom_logo');
foreach ($dirItems as $entryDir) { foreach ($dirItems as $entryDir) {

View File

@ -1289,6 +1289,10 @@ function config_update_config()
$error_update[] = __('Font size for items reports'); $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'))) { if (!config_update_value('custom_report_front', get_parameter('custom_report_front'))) {
$error_update[] = __('Custom report front'); $error_update[] = __('Custom report front');
} }
@ -2813,6 +2817,10 @@ function config_process_config()
config_update_value('font_size_item_report', 2); 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'])) { if (!isset($config['custom_report_front_font'])) {
config_update_value('custom_report_front_font', 'FreeSans.ttf'); config_update_value('custom_report_front_font', 'FreeSans.ttf');
} }

View File

@ -444,6 +444,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
global $config; global $config;
$interval_description = $config['interval_description'];
if ($mini) { if ($mini) {
$font_size = '1.5'; $font_size = '1.5';
} else { } else {
@ -606,7 +608,9 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($sla['time_total'] != 0) { if ($sla['time_total'] != 0) {
$row2[] = human_time_description_raw( $row2[] = human_time_description_raw(
$sla['time_total'] $sla['time_total'],
false,
$interval_description
); );
} else { } else {
$row2[] = '--'; $row2[] = '--';
@ -615,7 +619,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($sla['time_error'] != 0) { if ($sla['time_error'] != 0) {
$row2[] = '<span style="color: '.COL_CRITICAL.';">'.human_time_description_raw( $row2[] = '<span style="color: '.COL_CRITICAL.';">'.human_time_description_raw(
$sla['time_error'], $sla['time_error'],
true true,
$interval_description
).'</span>'; ).'</span>';
} else { } else {
$row2[] = '--'; $row2[] = '--';
@ -624,7 +629,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($sla['time_ok'] != 0) { if ($sla['time_ok'] != 0) {
$row2[] = '<span style="color: '.COL_NORMAL.';">'.human_time_description_raw( $row2[] = '<span style="color: '.COL_NORMAL.';">'.human_time_description_raw(
$sla['time_ok'], $sla['time_ok'],
true true,
$interval_description
).'</span>'; ).'</span>';
} else { } else {
$row2[] = '--'; $row2[] = '--';
@ -633,7 +639,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($sla['time_unknown'] != 0) { if ($sla['time_unknown'] != 0) {
$row2[] = '<span style="color: '.COL_UNKNOWN.';">'.human_time_description_raw( $row2[] = '<span style="color: '.COL_UNKNOWN.';">'.human_time_description_raw(
$sla['time_unknown'], $sla['time_unknown'],
true true,
$interval_description
).'</span>'; ).'</span>';
} else { } else {
$row2[] = '--'; $row2[] = '--';
@ -642,7 +649,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($sla['time_not_init'] != 0) { if ($sla['time_not_init'] != 0) {
$row2[] = '<span style="color: '.COL_NOTINIT.';">'.human_time_description_raw( $row2[] = '<span style="color: '.COL_NOTINIT.';">'.human_time_description_raw(
$sla['time_not_init'], $sla['time_not_init'],
true true,
$interval_description
).'</span>'; ).'</span>';
} else { } else {
$row2[] = '--'; $row2[] = '--';
@ -651,7 +659,8 @@ function reporting_html_SLA($table, $item, $mini, $pdf=0)
if ($sla['time_downtime'] != 0) { if ($sla['time_downtime'] != 0) {
$row2[] = '<span style="color: '.COL_DOWNTIME.';">'.human_time_description_raw( $row2[] = '<span style="color: '.COL_DOWNTIME.';">'.human_time_description_raw(
$sla['time_downtime'], $sla['time_downtime'],
true true,
$interval_description
).'</span>'; ).'</span>';
} else { } else {
$row2[] = '--'; $row2[] = '--';
@ -3009,6 +3018,8 @@ function reporting_html_availability($table, $item, $pdf=0)
global $config; global $config;
$interval_description = $config['interval_description'];
if (!empty($item['data'])) { if (!empty($item['data'])) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '99%'; $table1->width = '99%';
@ -3144,7 +3155,8 @@ function reporting_html_availability($table, $item, $pdf=0)
if ($row['time_total'] != 0 && $item['fields']['total_time']) { if ($row['time_total'] != 0 && $item['fields']['total_time']) {
$table_row[] = human_time_description_raw( $table_row[] = human_time_description_raw(
$row['time_total'], $row['time_total'],
true true,
$interval_description
); );
} else if ($row['time_total'] == 0 && $item['fields']['total_time']) { } else if ($row['time_total'] == 0 && $item['fields']['total_time']) {
$table_row[] = '--'; $table_row[] = '--';
@ -3155,7 +3167,8 @@ function reporting_html_availability($table, $item, $pdf=0)
if ($row['time_error'] != 0 && $item['fields']['time_failed']) { if ($row['time_error'] != 0 && $item['fields']['time_failed']) {
$table_row[] = human_time_description_raw( $table_row[] = human_time_description_raw(
$row['time_error'], $row['time_error'],
true true,
$interval_description
); );
} else if ($row['time_error'] == 0 && $item['fields']['time_failed']) { } else if ($row['time_error'] == 0 && $item['fields']['time_failed']) {
$table_row[] = '--'; $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']) { if ($row['time_ok'] != 0 && $item['fields']['time_in_ok_status']) {
$table_row[] = human_time_description_raw( $table_row[] = human_time_description_raw(
$row['time_ok'], $row['time_ok'],
true true,
$interval_description
); );
} else if ($row['time_ok'] == 0 && $item['fields']['time_in_ok_status']) { } else if ($row['time_ok'] == 0 && $item['fields']['time_in_ok_status']) {
$table_row[] = '--'; $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']) { if ($row['time_unknown'] != 0 && $item['fields']['time_in_unknown_status']) {
$table_row[] = human_time_description_raw( $table_row[] = human_time_description_raw(
$row['time_unknown'], $row['time_unknown'],
true true,
$interval_description
); );
} else if ($row['time_unknown'] == 0 && $item['fields']['time_in_unknown_status']) { } else if ($row['time_unknown'] == 0 && $item['fields']['time_in_unknown_status']) {
$table_row[] = '--'; $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']) { if ($row['time_not_init'] != 0 && $item['fields']['time_of_not_initialized_module']) {
$table_row[] = human_time_description_raw( $table_row[] = human_time_description_raw(
$row['time_not_init'], $row['time_not_init'],
true true,
$interval_description
); );
} else if ($row['time_not_init'] == 0 && $item['fields']['time_of_not_initialized_module']) { } else if ($row['time_not_init'] == 0 && $item['fields']['time_of_not_initialized_module']) {
$table_row[] = '--'; $table_row[] = '--';
@ -3199,7 +3215,8 @@ function reporting_html_availability($table, $item, $pdf=0)
if ($row['time_downtime'] != 0 && $item['fields']['time_of_downtime']) { if ($row['time_downtime'] != 0 && $item['fields']['time_of_downtime']) {
$table_row[] = human_time_description_raw( $table_row[] = human_time_description_raw(
$row['time_downtime'], $row['time_downtime'],
true true,
$interval_description
); );
} else if ($row['time_downtime'] == 0 && $item['fields']['time_of_downtime']) { } else if ($row['time_downtime'] == 0 && $item['fields']['time_of_downtime']) {
$table_row[] = '--'; $table_row[] = '--';