From b4bbbf15a3622b5ad63900359a996b9a91c69309 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 14 Jun 2021 21:21:57 +0100 Subject: [PATCH] MDL-71927 reports: show time to the second in logs report And in the question history in quiz reviews. Without this, it can be difficult to investigate some problems. --- lang/en/langconfig.php | 2 ++ lib/classes/string_manager_standard.php | 2 ++ question/engine/renderer.php | 2 +- report/log/classes/table_log.php | 4 ++-- report/loglive/classes/table_log.php | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lang/en/langconfig.php b/lang/en/langconfig.php index 8d7be165132..4d88b365b75 100644 --- a/lang/en/langconfig.php +++ b/lang/en/langconfig.php @@ -43,7 +43,9 @@ $string['strftimedatefullshort'] = '%d/%m/%y'; $string['strftimedateshort'] = '%d %B'; $string['strftimedateshortmonthabbr'] = '%d %b'; $string['strftimedatetime'] = '%d %B %Y, %I:%M %p'; +$string['strftimedatetimeaccurate'] = '%d %B %Y, %I:%M:%S %p'; $string['strftimedatetimeshort'] = '%d/%m/%y, %H:%M'; +$string['strftimedatetimeshortaccurate'] = '%d/%m/%y, %H:%M:%S'; $string['strftimedaydate'] = '%A, %d %B %Y'; $string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p'; $string['strftimedayshort'] = '%A, %d %B'; diff --git a/lib/classes/string_manager_standard.php b/lib/classes/string_manager_standard.php index 140ba650925..e6b79d807a9 100644 --- a/lib/classes/string_manager_standard.php +++ b/lib/classes/string_manager_standard.php @@ -302,7 +302,9 @@ class core_string_manager_standard implements core_string_manager { 'strftimedatefullshort' => 1, 'strftimedateshort' => 1, 'strftimedatetime' => 1, + 'strftimedatetimeaccurate' => 1, 'strftimedatetimeshort' => 1, + 'strftimedatetimeshortaccurate' => 1, 'strftimedaydate' => 1, 'strftimedaydatetime' => 1, 'strftimedayshort' => 1, diff --git a/question/engine/renderer.php b/question/engine/renderer.php index 0a3c83655ac..44009073c86 100644 --- a/question/engine/renderer.php +++ b/question/engine/renderer.php @@ -472,7 +472,7 @@ class core_question_renderer extends plugin_renderer_base { $restrictedqa = new question_attempt_with_restricted_history($qa, $i, null); $row = [$stepno, - userdate($step->get_timecreated(), get_string('strftimedatetimeshort')), + userdate($step->get_timecreated(), get_string('strftimedatetimeshortaccurate', 'core_langconfig')), s($qa->summarise_action($step)) . $this->action_author($step, $options), $restrictedqa->get_state_string($options->correctness)]; diff --git a/report/log/classes/table_log.php b/report/log/classes/table_log.php index ec67c4de7ee..6b8b45214f0 100644 --- a/report/log/classes/table_log.php +++ b/report/log/classes/table_log.php @@ -145,9 +145,9 @@ class report_log_table_log extends table_sql { public function col_time($event) { if (empty($this->download)) { - $dateformat = get_string('strftimedatetime', 'core_langconfig'); + $dateformat = get_string('strftimedatetimeaccurate', 'core_langconfig'); } else { - $dateformat = get_string('strftimedatetimeshort', 'core_langconfig'); + $dateformat = get_string('strftimedatetimeshortaccurate', 'core_langconfig'); } return userdate($event->timecreated, $dateformat); } diff --git a/report/loglive/classes/table_log.php b/report/loglive/classes/table_log.php index 6dfa2372e35..92807d725c5 100644 --- a/report/loglive/classes/table_log.php +++ b/report/loglive/classes/table_log.php @@ -116,7 +116,7 @@ class report_loglive_table_log extends table_sql { * @return string HTML for the time column */ public function col_time($event) { - $recenttimestr = get_string('strftimedatetime', 'core_langconfig'); + $recenttimestr = get_string('strftimedatetimeaccurate', 'core_langconfig'); return userdate($event->timecreated, $recenttimestr); }