forked from emeneo/moodle-enrol_apply
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
188 lines (163 loc) · 7.67 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
// This file is part of Moodle - http://moodle.org/
//
// 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/>.
/**
* @package enrol_apply
* @copyright emeneo.com (http://emeneo.com/)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author emeneo.com (http://emeneo.com/)
* @author Johannes Burk <[email protected]>
*/
defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
//custon fiel in enrol
global $DB;
$fields = $DB->get_records("user_info_field",array('datatype'=>'text'));
//Campos de curso
$fieldarray = array(0=> get_string('none'));
foreach ($fields as $field) {
$fieldarray[$field->id] = $field->name;
}
$settings->add(new admin_setting_configselect('enrol_apply/profileoption', get_string('profileoption', 'enrol_apply'),'',0,$fieldarray));
//end mod
$settings->add(new admin_setting_heading('enrol_apply_enrolname', '', get_string('pluginname_desc', 'enrol_apply')));
// Confirm mail settings...
$settings->add(new admin_setting_heading(
'enrol_apply_confirmmail',
get_string('confirmmail_heading', 'enrol_apply'),
get_string('confirmmail_desc', 'enrol_apply')));
$settings->add(new admin_setting_configtext(
'enrol_apply/confirmmailsubject',
get_string('confirmmailsubject', 'enrol_apply'),
get_string('confirmmailsubject_desc', 'enrol_apply'),
null,
PARAM_TEXT,
60));
$settings->add(new admin_setting_confightmleditor(
'enrol_apply/confirmmailcontent',
get_string('confirmmailcontent', 'enrol_apply'),
get_string('confirmmailcontent_desc', 'enrol_apply'),
null,
PARAM_RAW));
// Wait mail settings.
$settings->add(new admin_setting_heading(
'enrol_apply_waitmail',
get_string('waitmail_heading', 'enrol_apply'),
get_string('waitmail_desc', 'enrol_apply')));
$settings->add(new admin_setting_configtext(
'enrol_apply/waitmailsubject',
get_string('waitmailsubject', 'enrol_apply'),
get_string('waitmailsubject_desc', 'enrol_apply'),
null,
PARAM_TEXT,
60));
$settings->add(new admin_setting_confightmleditor(
'enrol_apply/waitmailcontent',
get_string('waitmailcontent', 'enrol_apply'),
get_string('waitmailcontent_desc', 'enrol_apply'),
null,
PARAM_RAW));
// Cancel mail settings...
$settings->add(new admin_setting_heading(
'enrol_apply_cancelmail',
get_string('cancelmail_heading', 'enrol_apply'),
get_string('cancelmail_desc', 'enrol_apply')));
$settings->add(new admin_setting_configtext(
'enrol_apply/cancelmailsubject',
get_string('cancelmailsubject', 'enrol_apply'),
get_string('cancelmailsubject_desc', 'enrol_apply'),
null,
PARAM_TEXT,
60));
$settings->add(new admin_setting_confightmleditor(
'enrol_apply/cancelmailcontent',
get_string('cancelmailcontent', 'enrol_apply'),
get_string('cancelmailcontent_desc', 'enrol_apply'),
null,
PARAM_RAW));
// Notification settings...
$settings->add(new admin_setting_heading(
'enrol_apply_notify',
get_string('notify_heading', 'enrol_apply'),
get_string('notify_desc', 'enrol_apply')));
$settings->add(new admin_setting_users_with_capability(
'enrol_apply/notifyglobal',
get_string('notifyglobal', 'enrol_apply'),
get_string('notifyglobal_desc', 'enrol_apply'),
array(),
'enrol/apply:manageapplications'));
// Expiry settings.
$settings->add(new admin_setting_heading(
'enrol_apply_expiry',
get_string('expiry_heading', 'enrol_apply'),
get_string('expiry_desc', 'enrol_apply')));
$options = array(
ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'),
ENROL_EXT_REMOVED_SUSPEND => get_string('extremovedsuspend', 'enrol'),
ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'),
ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'),
);
$settings->add(new admin_setting_configselect('enrol_apply/expiredaction',
get_string('expiredaction', 'enrol_apply'),
get_string('expiredaction_help', 'enrol_apply'),
ENROL_EXT_REMOVED_KEEP,
$options));
// Enrol instance defaults...
$settings->add(new admin_setting_heading('enrol_manual_defaults',
get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin')));
$settings->add(new admin_setting_configcheckbox('enrol_apply/defaultenrol',
get_string('defaultenrol', 'enrol'), get_string('defaultenrol_desc', 'enrol'), 0));
$options = array(ENROL_INSTANCE_ENABLED => get_string('yes'),
ENROL_INSTANCE_DISABLED => get_string('no'));
$settings->add(new admin_setting_configselect('enrol_apply/status',
get_string('status', 'enrol_apply'), get_string('status_desc', 'enrol_apply'), ENROL_INSTANCE_ENABLED, $options));
$options = array(1 => get_string('yes'), 0 => get_string('no'));
$settings->add(new admin_setting_configselect('enrol_apply/newenrols',
get_string('status', 'enrol_apply'), get_string('status_desc', 'enrol_apply'), 1, $options));
$options = array(1 => get_string('yes'),
0 => get_string('no'));
$settings->add(new admin_setting_configselect('enrol_apply/show_standard_user_profile',
get_string('show_standard_user_profile', 'enrol_apply'), '', 1, $options));
$options = array(1 => get_string('yes'),
0 => get_string('no'));
$settings->add(new admin_setting_configselect('enrol_apply/show_extra_user_profile',
get_string('show_extra_user_profile', 'enrol_apply'), '', 1, $options));
if (!during_initial_install()) {
$options = get_default_enrol_roles(context_system::instance());
$student = get_archetype_roles('student');
$student = reset($student);
$settings->add(new admin_setting_configselect('enrol_apply/roleid',
get_string('defaultrole', 'role'), '', $student->id, $options));
}
$settings->add(new admin_setting_configcheckbox(
'enrol_apply/notifycoursebased',
get_string('notifycoursebased', 'enrol_apply'),
get_string('notifycoursebased_desc', 'enrol_apply'),
0));
$settings->add(new admin_setting_configduration('enrol_apply/enrolperiod',
get_string('defaultperiod', 'enrol_apply'), get_string('defaultperiod_desc', 'enrol_apply'), 0));
// Start modification
$options = array();
for ($i = 0; $i < 24; $i++) {
$options[$i] = $i;
}
$settings->add(new admin_setting_configselect('enrol_apply/expirynotifyhour', get_string('expirynotifyhour', 'core_enrol'), '', 6, $options));
// End modification
}
if ($hassiteconfig) { // Needs this condition or there is error on login page.
$ADMIN->add('courses', new admin_externalpage('enrol_apply',
get_string('applymanage', 'enrol_apply'),
new moodle_url('/enrol/apply/manage.php')));
}