-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.php
executable file
·64 lines (54 loc) · 2.17 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
<?php
/**
* Settings for the 'block_chatbot' component.
*/
defined('MOODLE_INTERNAL') || die;
require_once(__DIR__ . '/lib.php');
if ($ADMIN->fulltree) {
/*
* Properties
*/
// Server Name
$name = 'block_chatbot/server_name';
$title = get_string('server_name', 'block_chatbot');
$description = get_string('server_name_desc', 'block_chatbot');
$default = "127.0.0.1";
$settings->add(new admin_setting_configtext($name, $title, $description, $default, PARAM_HOST));
// Event Server Name
$name = 'block_chatbot/event_server_name';
$title = get_string('event_server_name', 'block_chatbot');
$description = get_string('event_server_name_desc', 'block_chatbot');
$default = "chatbot";
$settings->add(new admin_setting_configtext($name, $title, $description, $default, PARAM_HOST));
// Server Port
$name = 'block_chatbot/server_port';
$title = get_string('server_port', 'block_chatbot');
$description = get_string('server_port_desc', 'block_chatbot');
$default = 44123;
$settings->add(new admin_setting_configtext($name, $title, $description, $default, PARAM_INT));
// Chat Container
$name = 'block_chatbot/container';
$title = get_string('chat_container', 'block_chatbot');
$description = get_string('chat_container_desc', 'block_chatbot');
$default = 'Body';
$choices = array('body' => 'Body', '#page' => 'Page');
$settings->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Course configuration: which courses should the plugin be active for.
$courses = get_courses("all", "c.sortorder ASC", "c.id,c.fullname");
$courselist = array();
// Get list of all courses and add those to the offered selection.
foreach ($courses as $course) {
$courselist[$course->id] = $course->fullname;
}
$courselist_config = new admin_setting_configmulticheckbox(
'block_chatbot/courseids',
get_string('courses', 'block_chatbot'),
get_string('courses_description', 'block_chatbot'),
null,
$courselist);
$courselist_config->set_updatedcallback(function() {
// The chatbot could have been inactive for a selected course: we need to sync the user module activity
sync_all_course_module_histories();
});
$settings->add($courselist_config);
}