2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Moodleサイトのデフォルト設定

Last updated at Posted at 2017-06-14

local/defaults.phpを使ったサイトデフォルト設定

Moodleには指定のファイルを作成することによりデフォルト設定を変更することができる。

config.phpに設定を記載することとの違い

config.phpに$CFG->hoge = 'hage';と記載することで設定を指定することも可能となっているが、こちらの方法とは以下の点で違いがある。

  • $CFGを記載する方法と違って、WebUIで変更不可能な強制設定ではない
  • あくまでサイトデフォルト設定の上書きであって現在の設定値を変更するものではない

このため、この方法はMoodleの初回インストールでconfig.phpが作成された直後でDBの初期化・各種モジュールのインストールが開始される前に指定のファイルを作成しておく必要がある。
(インストール後に作成しても意味があまりないように思う)

記載方法

Yes/Noのようなブール値を取る場合

local/defaults.php
// ログインを強制
$defaults['moodle']['forcelogin'] = true;

// メッセージングを無効
$defaults['moodle']['messaging'] = false;

特定の値を選択 / Textで指定する場合

local/defaults.php
// コースのセクション数
$defaults['moodlecourse']['numsections'] = 16

// ユーザクオータ
$defaults['moodle']['userquota'] = 1048576000;

// 週の始まり
$defaults['moodle']['calendar_startwday'] = 0;  // Sunday

// duのパスを指定
$defaults['moodle']['pathtodu'] = '/usr/bin/du';

// サポート連絡先
$defaults['moodle']['supportname'] = 'Moodleサイト管理者';

複数のチェックボックスから選択 / 複数選択出来るリストの場合

local/defaults.php
// ユーザフィールドを隠す
$defaults['moodle']['hiddenuserfields'] = array('icqnumber', 'skypeid', 'yahooid', 'aimid','msnid');

// ユーザ一覧で表示する情報
$defaults['moodle']['showuseridentity'] = array('idnumber'=>1, 'email'=>1, 'department'=>1);

備考

MoodleのCoreの場合は$defaults配列の一次元目をmoodleに、モジュール等の場合はenrol_selfworkshopassignsubmission_fileなどのように記載するが命名規則が怪しい。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?