Added compact mode to show timestamp - #4233

This commit is contained in:
Tatiana Llorente 2019-08-29 10:07:50 +02:00
parent 1c4b639deb
commit 8fd1f3c99e
2 changed files with 16 additions and 5 deletions

View File

@ -1169,16 +1169,23 @@ $row++;
if ($config['prominent_time'] == 'comparation') {
$timestamp = false;
$comparation = true;
$compact = false;
} else if ($config['prominent_time'] == 'timestamp') {
$timestamp = true;
$comparation = false;
$compact = false;
} else if ($config['prominent_time'] == 'compact') {
$timestamp = false;
$comparation = false;
$compact = true;
}
$table_other->data[$row][0] = __('Timestamp or time comparation');
$table_other->data[$row][1] = __('Comparation in rollover').' ';
$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', '', $comparation, true);
$table_other->data[$row][1] .= '<br />'.__('Timestamp in rollover').' ';
$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'timestamp', '', $timestamp, true);
$table_other->data[$row][0] = __('Timestamp, time comparation, or Compact mode');
$table_other->data[$row][1] = '<div class="switch_radio_button">';
$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'comparation', __('Comparation in rollover'), $comparation, true);
$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'timestamp', __('Timestamp in rollover'), $timestamp, true);
$table_other->data[$row][1] .= html_print_radio_button('prominent_time', 'compact', __('Compact mode'), $compact, true);
$table_other->data[$row][1] .= '</div>';
$row++;

View File

@ -535,6 +535,10 @@ function ui_print_timestamp($unixtime, $return=false, $option=[])
date2strftime_format($config['date_format']),
$unixtime
);
} else if ($prominent == 'compact') {
$units = 'tiny';
$title = human_time_comparation($unixtime);
$data = human_time_comparation($unixtime, $units);
} else {
$title = date($config['date_format'], $unixtime);
$units = 'large';