生徒同士の相互評価

Re: 生徒同士の相互評価

- Mitsuhiro Yoshida の投稿
返信数: 0
画像 Developers 画像 Particularly helpful Moodlers 画像 Translators

下記プログラム修正でデータベースモジュールのコメントを匿名 (「*****」) にすることは可能です。

Moodleバージョン:
3.7.2+ (Build: 20190913)

修正対象プログラム:
mod/comment/lib.php

修正箇所:
584行目

[ 修正前 ]
        foreach ($rs as $u) {
            $c = new stdClass();
            $c->id          = $u->cid;
            $c->content     = $u->ccontent;
            $c->format      = $u->cformat;
            $c->timecreated = $u->ctimecreated;
            $c->strftimeformat = get_string('strftimerecentfull', 'langconfig');
            $url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));
            $c->profileurl = $url->out(false); // URL should not be escaped just yet.
            $c->fullname = fullname($u);
            $c->time = userdate($c->timecreated, $c->strftimeformat);
            $c->content = format_text($c->content, $c->format, $formatoptions);
            $c->avatar = $OUTPUT->user_picture($u, array('size'=>18));
            $c->userid = $u->id;

[ 修正後 ]
        foreach ($rs as $u) {
            $c = new stdClass();
            $c->id          = $u->cid;
            $c->content     = $u->ccontent;
            $c->format      = $u->cformat;
            $c->timecreated = $u->ctimecreated;
            $c->strftimeformat = get_string('strftimerecentfull', 'langconfig');
            $url = new moodle_url('/user/view.php', array('id'=>$u->id, 'course'=>$this->courseid));
            $c->profileurl = $url->out(false); // URL should not be escaped just yet.
            // $c->fullname = fullname($u);
            if (has_capability('block/activity_modules:addinstance', $this->context->get_course_context(false)) || $u->id == $USER->id) {
                $c->fullname = fullname($u);
            } else {
                $c->fullname = '*****';
            }
            $c->time = userdate($c->timecreated, $c->strftimeformat);
            $c->content = format_text($c->content, $c->format, $formatoptions);
            $c->avatar = $OUTPUT->user_picture($u, array('size'=>18));
            $c->userid = $u->id;

備考:
自分のコメントには氏名が表示されます。自分以外のコメントの投稿者名は「*****」に置換されます。また、コース内に活動モジュール (例 小テスト等) を追加できる権限 (block/activity_modules:addinstance) のあるユーザ (例 教師) にはコメント投稿者すべての氏名が表示されます。
添付 mod_data.png