forked from bmbrands/moodle-local_welcome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
executable file
·116 lines (98 loc) · 5.15 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
// This file is part of the Local welcome plugin
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This plugin sends users a welcome message after logging in
* and notify a moderator a new user has been added
* it has a settings page that allow you to configure the messages
* send.
*
* @package local
* @subpackage welcome
* @copyright 2017 Bas Brands, basbrands.nl, [email protected]
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
$moderator = get_admin();
$site = get_site();
$settings = new admin_settingpage('local_welcome', get_string('pluginname', 'local_welcome'));
$ADMIN->add('localplugins', $settings);
$availablefields = new moodle_url('/local/welcome/index.php');
$name = 'local_welcome/message_user_enabled';
$title = get_string('message_user_enabled', 'local_welcome');
$description = get_string('message_user_enabled_desc', 'local_welcome', $availablefields->out());
$setting = new admin_setting_configcheckbox($name, $title, $description, 1);
$settings->add($setting);
$name = 'local_welcome/auth_plugins';
$title = get_string('auth_plugins', 'local_welcome');
$description = get_string('auth_plugins_desc', 'local_welcome');
$auths = get_enabled_auth_plugins();
$authlist = array();
foreach ($auths as $auth) {
$authlist[$auth] = $auth;
}
$setting = new admin_setting_configmulticheckbox($name, $title, $description, 1, $authlist);
$settings->add($setting);
$name = 'local_welcome/message_user_subject';
$default = get_string('default_user_email_subject', 'local_welcome', $site->fullname);
$title = get_string('message_user_subject', 'local_welcome');
$description = get_string('message_user_subject_desc', 'local_welcome');
$setting = new admin_setting_configtext($name, $title, $description, $default);
$settings->add($setting);
$default = get_string('default_user_email', 'local_welcome', $site->fullname);
$name = 'local_welcome/message_user';
$title = get_string('message_user', 'local_welcome');
$description = get_string('message_user_desc', 'local_welcome');
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
$settings->add($setting);
$name = 'local_welcome/message_moderator_enabled';
$title = get_string('message_moderator_enabled', 'local_welcome');
$description = get_string('message_moderator_enabled_desc', 'local_welcome');
$setting = new admin_setting_configcheckbox($name, $title, $description, 1);
$settings->add($setting);
$default = get_string('default_moderator_email_subject', 'local_welcome', $site->fullname);
$name = 'local_welcome/message_moderator_subject';
$title = get_string('message_moderator_subject', 'local_welcome');
$description = get_string('message_moderator_subject_desc', 'local_welcome');
$setting = new admin_setting_configtext($name, $title, $description, $default);
$settings->add($setting);
$default = get_string('default_moderator_email', 'local_welcome', $site->fullname);
$name = 'local_welcome/message_moderator';
$title = get_string('message_moderator', 'local_welcome');
$description = get_string('message_moderator_desc', 'local_welcome');
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
$settings->add($setting);
$name = 'local_welcome/moderator_email';
$title = get_string('moderator_email', 'local_welcome');
$description = get_string('moderator_email_desc', 'local_welcome');
$setting = new admin_setting_configtext($name, $title, $description, $moderator->email);
$settings->add($setting);
$name = 'local_welcome/sender_email';
$title = get_string('sender_email', 'local_welcome');
$description = get_string('sender_email_desc', 'local_welcome');
$setting = new admin_setting_configtext($name, $title, $description, $moderator->email);
$settings->add($setting);
$name = 'local_welcome/sender_firstname';
$title = get_string('sender_firstname', 'local_welcome');
$description = get_string('sender_firstname_desc', 'local_welcome');
$setting = new admin_setting_configtext($name, $title, $description, $moderator->firstname);
$settings->add($setting);
$name = 'local_welcome/sender_lastname';
$title = get_string('sender_lastname', 'local_welcome');
$description = get_string('sender_lastname_desc', 'local_welcome');
$setting = new admin_setting_configtext($name, $title, $description, $moderator->lastname);
$settings->add($setting);
}