forked from tonyjbutler/moodle-mod_leganto
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.php
More file actions
187 lines (174 loc) · 5.62 KB
/
settings.php
File metadata and controls
187 lines (174 loc) · 5.62 KB
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
<?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/>.
/**
* Leganto module admin settings and defaults.
*
* @package mod_leganto
* @copyright 2017 Lancaster University {@link http://www.lancaster.ac.uk/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Tony Butler <a.butler4@lancaster.ac.uk>
*/
use mod_leganto\admin_setting\codecolumn;
use mod_leganto\admin_setting\codesource;
use mod_leganto\admin_setting\codetable;
use mod_leganto\admin_setting\courseattribute;
use mod_leganto\admin_setting\coursecolumn;
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// General settings.
$settings->add(new admin_setting_heading('leganto/generalsettings', get_string('generalsettings', 'leganto'), ''));
$settings->add(
new admin_setting_configcheckbox(
'leganto/requiremodintro',
get_string('requiremodintro', 'leganto'),
get_string('requiremodintro_desc', 'leganto'),
0
)
);
// Display settings.
$optionsdd = [];
$optionsdd[0] = get_string('displaypage', 'leganto');
$optionsdd[1] = get_string('displayinlinecollapsed', 'leganto');
$optionsdd[2] = get_string('displayinlineexpanded', 'leganto');
$settings->add(
new admin_setting_configselect(
'leganto/defaultdisplay',
get_string('defaultdisplay', 'leganto'),
get_string('defaultdisplay_desc', 'leganto'),
0,
$optionsdd
)
);
// Authors in module config form.
$settings->add(
new admin_setting_configcheckbox(
'leganto/authorsinconfig',
get_string('authorsinconfig', 'leganto'),
get_string('authorsinconfig_desc', 'leganto'),
0
)
);
// New UI transitioning.
$settings->add(
new admin_setting_configcheckbox(
'leganto/usenewui',
get_string('usenewui', 'leganto'),
get_string('usenewui_desc', 'leganto'),
0
)
);
// API settings.
$settings->add(new admin_setting_heading('leganto/apisettings', get_string('apisettings', 'leganto'), ''));
$settings->add(
new admin_setting_configtext(
'leganto/apiurl',
get_string('apiurl', 'leganto'),
get_string('apiurl_desc', 'leganto'),
get_string('apiurl_default', 'leganto'),
PARAM_URL
)
);
$settings->add(
new admin_setting_configtext(
'leganto/apikey',
get_string('apikey', 'leganto'),
get_string('apikey_desc', 'leganto'),
'',
PARAM_TEXT
)
);
// Code settings.
$settings->add(new admin_setting_heading('leganto/codesettings', get_string('codesettings', 'leganto'), ''));
// Code source.
$optionscs = [];
$optionscs['idnumber'] = get_string('idnumbercourse');
$optionscs['shortname'] = get_string('shortnamecourse');
$optionscs['codetable'] = get_string('codetable', 'leganto');
$settings->add(
new codesource(
'leganto/codesource',
get_string('codesource', 'leganto'),
get_string('codesource_desc', 'leganto'),
'idnumber',
$optionscs
)
);
// Code regexes.
$settings->add(
new admin_setting_configtext(
'leganto/coderegex',
get_string('coderegex', 'leganto'),
get_string('coderegex_desc', 'leganto'),
'',
PARAM_TEXT
)
);
$settings->add(
new admin_setting_configtext(
'leganto/yearregex',
get_string('yearregex', 'leganto'),
get_string('yearregex_desc', 'leganto'),
'',
PARAM_TEXT
)
);
// Code table details.
$settings->add(
new codetable(
'leganto/codetable',
get_string('codetable', 'leganto'),
get_string('codetable_desc', 'leganto'),
$CFG->prefix,
PARAM_TEXT
)
);
$settings->add(
new codecolumn(
'leganto/codecolumn',
get_string('codecolumn', 'leganto'),
get_string('codecolumn_desc', 'leganto'),
'',
PARAM_TEXT
)
);
$settings->add(
new coursecolumn(
'leganto/coursecolumn',
get_string('coursecolumn', 'leganto'),
get_string('coursecolumn_desc', 'leganto'),
'',
PARAM_TEXT
)
);
$settings->add(
new courseattribute(
'leganto/courseattribute',
get_string('courseattribute', 'leganto'),
get_string('courseattribute_desc', 'leganto'),
'',
PARAM_TEXT
)
);
// Meta child codes.
$settings->add(
new admin_setting_configcheckbox(
'leganto/includechildcodes',
get_string('includechildcodes', 'leganto'),
get_string('includechildcodes_desc', 'leganto'),
0
)
);
}