forked from Kylegoslin/moodle-block_signinsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
executable file
·163 lines (143 loc) · 4.68 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
<?php
// This file is part of Moodle - http://moodle.org/
//
// Signinsheet 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.
//
// Signinsheet 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 block_signinsheet
* @copyright 2018 Kyle Goslin, Daniel McSweeney
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
*
* settings.php
* This file is used to display the settings for the signinsheet block.
* From these settings the user can add an image to the top of the signinsheet.
* and add custom columns.
*/
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir.'/adminlib.php');
$uploaderlink = new moodle_url('/blocks/signinsheet/index.php');
$settings->add(new admin_setting_configcheckbox(
'block_signinsheet/customlogoenabled',
new lang_string('addcustomlogo', 'block_signinsheet'),
new lang_string('addcustomlogodesc', 'block_signinsheet') . '<br><a href="'. $uploaderlink.'">Click here to Upload</a>',
null,
PARAM_INT
));
$settings->add(new admin_setting_configcheckbox(
'block_signinsheet/hidefromstudents',
new lang_string('hidefromstudents', 'block_signinsheet'),
new lang_string('hidefromstudents_desc', 'block_signinsheet'),
null,
PARAM_INT
));
global $DB;
$result = $DB->get_records('user_info_field');
if ($result) {
$settings->add(new admin_setting_configcheckbox(
'block_signinsheet/includecustomfield',
new lang_string('customfield', 'block_signinsheet'),
new lang_string('customfielddesc', 'block_signinsheet'),
null,
PARAM_INT
));
$options = array();
foreach ($result as $item) {
$options[$item->id] = $item->name;
}
$settings->add(new admin_setting_configselect(
'block_signinsheet/customfieldselect',
new lang_string('customfieldselect', 'block_signinsheet'),
get_string('selectcustomfield', 'block_signinsheet'),
null,
$options
));
}
// Include a custom text field column
$settings->add(new admin_setting_configcheckbox(
'block_signinsheet/includecustomtextfield',
new lang_string('includecustomtextfield', 'block_signinsheet'),
new lang_string('includecustomtextfielddesc', 'block_signinsheet'),
null,
PARAM_INT
));
$settings->add(
new admin_setting_configtext(
'block_signinsheet/customtext',
get_string('customtext', 'block_signinsheet'),
get_string('customtextdesc', 'block_signinsheet'),
null,
PARAM_TEXT
)
);
// Include a default user field
$settings->add(new admin_setting_configcheckbox(
'block_signinsheet/includedefaultfield',
new lang_string('includedefaultfield', 'block_signinsheet'),
new lang_string('includedefaultfield', 'block_signinsheet'),
null,
PARAM_INT
));
// Get list of user fields
$options = array(
'username'=>'username',
'idnumber'=>'idnumber',
'firstname'=>'firstname',
'lastname'=>'lastname',
'email'=>'email',
'icq'=>'icq',
'skype'=>'skype',
'yahoo'=>'yahoo',
'aim'=>'aim',
'msn'=>'msn',
'phone1'=>'phone1',
'phone2'=>'phone2',
'institution'=>'institution',
'department'=>'department',
'address'=>'address',
'city'=>'city',
'country'=>'country',
'lang'=>'lang',
'calendartype'=>'calendartype',
'lastnamephonetic'=>'lastnamephonetic',
'firstnamephonetic'=>'firstnamephonetic',
'middlename'=>'middlename',
'alternatename'=>'alternatename',
);
$settings->add(
new admin_setting_configselect(
'block_signinsheet/defaultfieldselection',
get_string('selectedfield', 'block_signinsheet'),
get_string('selectdefaultfield', 'block_signinsheet'),
'all',
$options
)
);
$settings->add(
new admin_setting_configcheckbox(
'block_signinsheet/includeidfield',
new lang_string('idfield', 'block_signinsheet'),
new lang_string('idfielddesc', 'block_signinsheet'),
null,
PARAM_INT
)
);
$settings->add(
new admin_setting_configcheckbox(
'block_signinsheet/excludeinactive',
new lang_string('excludeinactive', 'block_signinsheet'),
new lang_string('excludeinactive_desc', 'block_signinsheet'),
0
)
);