小テスト解答履歴での日時表示フォーマット

小テスト解答履歴での日時表示フォーマット

- M Numata の投稿
返信数: 2

いつもお世話になります。
Moodle 3.5.3+(Build 20181123)を利用しています。(Win2012R2、Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9)

小テストの教師向けの「解答履歴」表示部分で、各ステップに記録された日時を「秒」まで表示させたいのですが、可能でしょうか。
(日時の情報自体は、データベースのmdl_question_attempt_steps にunixtimeで保存されている模様・・?)
(背景)小テストの運用でページ遷移時のトラブルについて問い合わせが増えているため、まずは状況を細かく見られるようにしたくこの対策を試みています。よろしくお願いします。

現:yy年MM月dd日 H:mm (黄色ハイライトの箇所)
希望:yy年MM月dd日 H:mm:ss   (またはyyyy/MM/dd H:mm:ss) 

M Numata への返信

Re: 小テスト解答履歴での日時表示フォーマット

- Mitsuhiro Yoshida の投稿
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

> 小テストの教師向けの「解答履歴」表示部分で、各ステップに記録された日時を「秒」まで表示させたいのですが、可能でしょうか。

可能です。

以下のプログラム修正ではいかがでしょうか。

修正対象プログラム:
question/engine/renderer.php

修正箇所:
476行目

[ 修正前 ]
            $user = new stdClass();
            $user->id = $step->get_user_id();
            $row = array(
                $stepno,
                userdate($step->get_timecreated(), get_string('strftimedatetimeshort')),
                s($qa->summarise_action($step)),
                $restrictedqa->get_state_string($options->correctness),
            );

[ 修正後 ]
            $user = new stdClass();
            $user->id = $step->get_user_id();
            $row = array(
                $stepno,
//                userdate($step->get_timecreated(), get_string('strftimedatetimeshort')),
                userdate($step->get_timecreated(), get_string('strftimedatetimeshort').':%S'),
                s($qa->summarise_action($step)),
                $restrictedqa->get_state_string($options->correctness),
            );
添付 Response history.png
Mitsuhiro Yoshida への返信

Re: 小テスト解答履歴での日時表示フォーマット

- M Numata の投稿
Yoshida様
早速のご教示ありがとうございます!
上記通りで、希望する表示ができました。いつも的確な情報をいただき本当に助けられております。