forked from lsuits/lsu-block_quickmail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
36 lines (27 loc) · 1.03 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
<?php
// Written at Louisiana State University
defined('MOODLE_INTERNAL') || die;
if($ADMIN->fulltree) {
require_once $CFG->dirroot . '/blocks/quickmail/lib.php';
$select = array(0 => get_string('no'), 1 => get_string('yes'));
$allow = quickmail::_s('allowstudents');
$settings->add(
new admin_setting_configselect('block_quickmail_allowstudents',
$allow, $allow, 0, $select
)
);
$roles = $DB->get_records('role', null, 'sortorder ASC');
$default_sns = array('editingteacher', 'teacher', 'student');
$defaults = array_filter($roles, function ($role) use ($default_sns) {
return in_array($role->shortname, $default_sns);
});
$only_names = function ($role) { return $role->name; };
$select_roles = quickmail::_s('select_roles');
$settings->add(
new admin_setting_configmultiselect('block_quickmail_roleselection',
$select_roles, $select_roles,
array_keys($defaults),
array_map($only_names, $roles)
)
);
}