課題リソースの通知メールに表示されるコース名について

課題リソースの通知メールに表示されるコース名について

- M N の投稿
返信数: 2

 標題について、お伺いいたします。

「課題」ツールで、学生が課題を提出すると、下図ような通知メールが届きます。


 1行目の「 ts001>課題>実習1日目 」の表記には
 「長いコース名」(本来のコース名)ではなく、「コースの省略名」が表示されるようです。
 これでは、何のコースに課題を提出したのかわかりにくいので
 長いコース名を表示するようにしたいのですが、方法をご存じの方が
 いらっしゃいましたら、ご教示いただけると助かります。

 なお、課題提出時の通知メールはデフォルトで「コース設定を編集する」際に
 「コース省略名」欄に設定したコース名が表示されるようなので、
 コース省略名欄に本来のコース名を設定すればよいのですが、
 当方では、コースの一括登録の関係で「コース省略名」欄は本来のコース名ではなく、
 コースのコード番号(例:ts001)等で登録しております。
 できれば、運用を変更せず、通知メールのコース表示に長いコース名(本来のコース名)を
 表示するのが希望です。


 動作環境】 moodle ver.3.1.3 /mysql (5.5.42) /php:5.5.21

 どうぞ、よろしくお願い致します。

M N への返信

Re: 課題リソースの通知メールに表示されるコース名について

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

> できれば、運用を変更せず、通知メールのコース表示に長いコース名(本来のコース名)を表示するのが希望です。

よろしければ下記プログラム修正をお試しください。

修正対象プログラム:
mod/assign/locallib.php

修正箇所:
5411行目

[ 修正前 ]
    protected static function format_notification_message_text($messagetype,
                                                             $info,
                                                             $course,
                                                             $context,
                                                             $modulename,
                                                             $assignmentname) {
        $formatparams = array('context' => $context->get_course_context());
        $posttext  = format_string($course->shortname, true, $formatparams) .

[ 修正後 ]
    protected static function format_notification_message_text($messagetype,
                                                             $info,
                                                             $course,
                                                             $context,
                                                             $modulename,
                                                             $assignmentname) {
        $formatparams = array('context' => $context->get_course_context());
//        $posttext  = format_string($course->shortname, true, $formatparams) .
        $posttext  = format_string($course->fullname, true, $formatparams) .

-----------------------------------

修正箇所:
5444行目

[ 修正前 ]
    protected static function format_notification_message_html($messagetype,
                                                             $info,
                                                             $course,
                                                             $context,
                                                             $modulename,
                                                             $coursemodule,
                                                             $assignmentname) {
        global $CFG;
        $formatparams = array('context' => $context->get_course_context());
        $posthtml  = '<p><font face="sans-serif">' .
                     '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' .
                     format_string($course->shortname, true, $formatparams) .

[ 修正後 ]
    protected static function format_notification_message_html($messagetype,
                                                             $info,
                                                             $course,
                                                             $context,
                                                             $modulename,
                                                             $coursemodule,
                                                             $assignmentname) {
        global $CFG;
        $formatparams = array('context' => $context->get_course_context());
        $posthtml  = '<p><font face="sans-serif">' .
                     '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' .
//                     format_string($course->shortname, true, $formatparams) .
                     format_string($course->fullname, true, $formatparams) .

評点平均: お役立ち度: ★★★★★★★ (1)
Mitsuhiro Yoshida への返信

Re: 課題リソースの通知メールに表示されるコース名について

- M N の投稿
Yoshidaさま

いつも大変お世話になっております。

修正プログラムについて、ご教示いただきありがとうございます。
早速確認し、ご報告いたします。まずは、お礼申し上げます。