forked from darrencocco/moodle-tool_messagebroker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
60 lines (47 loc) · 1.98 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
<?php
/**
* Settings for tool_messagebroker.
*
* @package tool_messagebroker
* @copyright 2023 Monash University
* @author Cameron Ball <[email protected]>
*/
declare(strict_types=1);
use tool_messagebroker\receiver\processing_style;
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$settingspage = new admin_settingpage('tool_messagebroker', get_string('pluginname', 'tool_messagebroker'));
$ADMIN->add('tools', $settingspage);
if ($ADMIN->fulltree) {
$datastoreplugins = array_keys(core_plugin_manager::instance()->get_installed_plugins('mbdatastore'));
$datastoreselections = array_map(
fn(string $pluginname): string => get_string('pluginname', 'mbdatastore_' . $pluginname),
array_combine($datastoreplugins, $datastoreplugins)
);
$settingspage->add(new admin_setting_configselect(
'tool_messagebroker/datastore',
get_string('datastore', 'tool_messagebroker'),
get_string('datastore_help', 'tool_messagebroker'),
'standarddb',
$datastoreselections
));
$receivemodeselections = array_map(
fn(string $style): string => get_string('processingstyle:' . strtolower($style), 'tool_messagebroker'),
array_flip((new \ReflectionClass(processing_style::class))->getConstants())
);
$settingspage->add( new admin_setting_configselect(
'tool_messagebroker/receivemode',
get_string('receivemode', 'tool_messagebroker'),
get_string('receivemode_help', 'tool_messagebroker'),
processing_style::RECEIVER_PREFERENCE,
$receivemodeselections
));
$settingspage->add(new admin_setting_configtext(
'tool_messagebroker/messagespertask',
get_string('messagespertask', 'tool_messagebroker'),
get_string('messagespertask_help', 'tool_messagebroker'),
1,
PARAM_INT
));
}
}