From a40c04aa49eb1c40cb52b9e192e51ac336189224 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 27 Apr 2023 09:08:24 +0200 Subject: [PATCH] #10660 Update the function to create the warp journal table for check the variable config prominent time and prints the timestamp according this --- .../include/ajax/update_manager.php | 70 ++++++++++++++++--- 1 file changed, 59 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/ajax/update_manager.php b/pandora_console/include/ajax/update_manager.php index 4e6eefdfd3..175a4a3522 100644 --- a/pandora_console/include/ajax/update_manager.php +++ b/pandora_console/include/ajax/update_manager.php @@ -129,19 +129,67 @@ if ($method === 'draw') { $count = db_get_value('count(*)', '('.$sql.') t'); if ($data) { - $data = array_reduce( - $data, - function ($carry, $item) { - // Transforms array of arrays $data into an array - // of objects, making a post-process of certain fields. - $tmp = (object) $item; + if ($config['prominent_time'] === 'timestamp') { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = human_time_comparation($tmp->utimestamp); + $tmp->utimestamp = ''.modules_format_timestamp($tmp->utimestamp).''; - $tmp->utimestamp = human_time_comparation($tmp->utimestamp); + $carry[] = $tmp; + return $carry; + } + ); + } else if ($config['prominent_time'] === 'comparation') { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = modules_format_timestamp($tmp->utimestamp); + $tmp->utimestamp = ''.human_time_comparation($tmp->utimestamp).''; - $carry[] = $tmp; - return $carry; - } - ); + $carry[] = $tmp; + return $carry; + } + ); + } else if ($config['prominent_time'] === 'compact') { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = modules_format_timestamp($tmp->utimestamp); + $tmp->utimestamp = ''.human_time_comparation($tmp->utimestamp, 'tiny').''; + + $carry[] = $tmp; + return $carry; + } + ); + } else { + $data = array_reduce( + $data, + function ($carry, $item) { + // Transforms array of arrays $data into an array + // of objects, making a post-process of certain fields. + $tmp = (object) $item; + date_default_timezone_set($user_timezone); + $title = modules_format_timestamp($tmp->utimestamp); + $tmp->utimestamp = ''.human_time_comparation($tmp->utimestamp).''; + + $carry[] = $tmp; + return $carry; + } + ); + } } // Datatables format: RecordsTotal && recordsfiltered.