frontpage の登録済みコースについて

frontpage の登録済みコースについて

- naoki imahashi の投稿
返信数: 8

お世話になっております。今橋と申します。

ログイン時の登録済みコースについて質問をさせて下さい。

ログイン時のフロントページアイテムに登録済みコースを設定をしたところ、
マイコースが登録されているユーザにはマイコースが表示されますが、
マイコースが登録されていないユーザには、コース一覧が表示されます。

マイコースが登録されていないユーザに対して、コース一覧を表示しないようにしたいのですが、
どの箇所を修正すればよいかご存知であればご教授下さい。

使用している moodle は下記の通りです。

  • 入手場所: moodle.org
  • バージョン: 3.1.2 (Build: 20160912)
  • PHP: 5.6.25
  • Apache: httpd-2.4.6-40
  • OS: CentOS Linux release 7.2.1511 (Core)
以上、よろしくお願いします。

naoki imahashi への返信

Re: frontpage の登録済みコースについて

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

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

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

修正箇所:
1136行前

[ 修正前 ]
        $this->rootnodes['currentcourse']->mainnavonly = true;
        if ($enrolledinanycourse) {
            $this->rootnodes['mycourses']->isexpandable = true;
            if ($CFG->navshowallcourses) {
                // When we show all courses we need to show both the my courses and the regular courses branch.
                $this->rootnodes['courses']->isexpandable = true;
            }
        } else {
            $this->rootnodes['courses']->isexpandable = true;
        }

[ 修正後 ]
        $this->rootnodes['currentcourse']->mainnavonly = true;
        if ($enrolledinanycourse) {
            $this->rootnodes['mycourses']->isexpandable = true;
            if ($CFG->navshowallcourses) {
                // When we show all courses we need to show both the my courses and the regular courses branch.
                $this->rootnodes['courses']->isexpandable = true;
            }
        } else {
//            $this->rootnodes['courses']->isexpandable = true;
            $this->rootnodes['courses']->isexpandable = false;
        }

naoki imahashi への返信

Re: frontpage の登録済みコースについて

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

前述の修正に加えて、下記のように修正されてはいかがでしょうか。

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

修正箇所:
1103行前

[ 修正前 ]
            // The home element should be the site because the root node is my moodle
            $this->rootnodes['home'] = $this->add(get_string('sitehome'), new moodle_url('/'), self::TYPE_SETTING, null, 'home');


[ 修正後 ]
            // The home element should be the site because the root node is my moodle
            $this->rootnodes['home'] = $this->add(get_string('sitehome'), new moodle_url('/my/'), self::TYPE_SETTING, null, 'home');

naoki imahashi への返信

Re: frontpage の登録済みコースについて

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

前述の2つの修正を適用した後、「管理 > サイト管理 > フロントページ設定」ページで下記のように設定した場合、本投稿の添付画像のように一般ユーザにはコース一覧が表示されないようになります。

  • フロントページ (frontpage ) = コース一覧
  • ログイン時のフロントページアイテム (frontpageloggedin) = 登録済みコース

もしかして、お使いのMoodleを独自にカスタマイズされていませんでしょうか?

添付 moodle navigation.png
naoki imahashi への返信

Re: frontpage の登録済みコースについて

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

Moodleの非標準テーマ「Klass」をインストールしてみましたが、ご提示頂きました画面と同じものを再現することができませんでした

どのように設定変更すれば、同じ画面を表示することができますでしょうか?

添付 theme Klass.png
Mitsuhiro Yoshida への返信

Re: frontpage の登録済みコースについて

- naoki imahashi の投稿

Yoshida 様

お世話になります。今橋です。

新しく他のサーバに moodle をインストールしたところ、ログイン時に hogehoge/my に移動する事が確認出来ました。
お伝えしなくても問題ないかと思っておりましたが、事象が確認された moodle は 当初 2.6 を使用しており、段階的に 3.1.2 に VersionUP をしました。
その影響の可能性が強いものと思われ、調査を続けましたが、原因は特定出来ません。

しかしながら、上記の画像ですと、ナビゲーションのサイトホームに移動すると、マイコースに登録されていないユーザは、登録済みコースがコース一覧に変わってしまいますが、本問題は運用側でカバーする方針となりました。

お付き合い頂き、大変恐縮ではありますが、本件は解決済みとして頂いて問題ございません。

以上、よろしくお願いいたします。