forked from lsuits/lsu-block_quickmail
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsettings.php
125 lines (109 loc) · 3.65 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
<?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/>.
/**
* Plugin settings page.
* @package block_quickmail
* @copyright 2008-2017 Louisiana State University
* @copyright 2008-2017 Adam Zapletal, Chad Mazilly, Philip Cali, Robert Russo
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
require_once($CFG->dirroot . '/blocks/quickmail/lib.php');
$select = [-1 => get_string('never'), 0 => get_string('no'), 1 => get_string('yes')];
$allow = quickmail::_s('allowstudents');
$allowdesc = quickmail::_s('allowstudentsdesc');
$settings->add(
new admin_setting_configselect(
'block_quickmail_allowstudents',
$allow,
$allowdesc,
0,
$select
)
);
$roles = $DB->get_records('role', null, 'sortorder ASC');
$defaultsns = ['editingteacher', 'teacher', 'student'];
$defaults = array_filter($roles, function ($role) use ($defaultsns) {
return in_array($role->shortname, $defaultsns);
});
$onlynames = function ($role) {
return $role->name ? trim(format_string($role->name)) : $role->shortname;
};
$selectroles = quickmail::_s('select_roles');
$settings->add(
new admin_setting_configmultiselect(
'block_quickmail_roleselection',
$selectroles,
$selectroles,
array_keys($defaults),
array_map($onlynames, $roles)
)
);
$settings->add(
new admin_setting_configselect(
'block_quickmail_receipt',
quickmail::_s('receipt'),
quickmail::_s('receipt_help'),
0,
$select
)
);
$options = [
0 => get_string('none'),
'idnumber' => get_string('idnumber'),
'shortname' => get_string('shortname'),
];
$settings->add(
new admin_setting_configselect(
'block_quickmail_prepend_class',
quickmail::_s('prepend_class'),
quickmail::_s('prepend_class_desc'),
0,
$options
)
);
$groupoptions = [
'strictferpa' => get_string('strictferpa', 'block_quickmail'),
'courseferpa' => get_string('courseferpa', 'block_quickmail'),
'noferpa' => get_string('noferpa', 'block_quickmail'),
];
$settings->add(
new admin_setting_configselect(
'block_quickmail_ferpa',
quickmail::_s('ferpa'),
quickmail::_s('ferpa_desc'),
'strictferpa',
$groupoptions
)
);
$settings->add(
new admin_setting_configcheckbox(
'block_quickmail_downloads',
quickmail::_s('downloads'),
quickmail::_s('downloads_desc'),
1
)
);
$settings->add(
new admin_setting_configcheckbox(
'block_quickmail_addionalemail',
quickmail::_s('addionalemail'),
quickmail::_s('addionalemail_desc'),
0
)
);
}