-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit_form.php
88 lines (76 loc) · 3.07 KB
/
edit_form.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
<?php
// This file is part of the TRAX xAPI Agent plugin for Moodle.
//
// This plugin 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.
//
// This plugin 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/>.
/**
* TRAX xAPI Agent plugin.
*
* @package block_trax_xapi
* @copyright 2024 Sébastien Fraysse <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/lib/grade/constants.php');
use block_trax_xapi\config;
class block_trax_xapi_edit_form extends block_edit_form {
/**
* The definition of the fields to use.
*
* @param MoodleQuickForm $mform
*/
protected function specific_definition($mform) {
// Course settings.
$mform->addElement('header', 'configheader', get_string('block_settings', 'block_trax_xapi'));
// Course LRS.
$mform->addElement('select', 'config_lrs',
get_string('lrs', 'block_trax_xapi'),
config::lrs_options()
);
$mform->setDefault('config_lrs', config::LRS_NO);
// Events mode.
$mform->addElement('select', 'config_events_mode',
get_string('events_mode', 'block_trax_xapi'),
config::events_mode_options()
);
$mform->setDefault('config_events_mode', config::EVENTS_MODE_NO);
// From date (logs)
$mform->addElement('text', 'config_logs_from',
get_string('logs_from', 'block_trax_xapi')
);
$mform->setDefault('config_logs_from', date('d/m/Y', time()));
$mform->setType('config_logs_from', PARAM_TEXT);
$mform->hideIf('config_logs_from', 'config_events_mode', 'neq', config::EVENTS_MODE_LOGS);
// SCORM data.
$mform->addElement('select', 'config_scorm_enabled',
get_string('collect_scorm_data', 'block_trax_xapi'),
config::scorm_enabled_options()
);
$mform->setDefault('config_scorm_enabled', config::SCORM_DISABLED);
// From date (logs)
$mform->addElement('text', 'config_scorm_from',
get_string('scorm_from', 'block_trax_xapi')
);
$mform->setDefault('config_scorm_from', date('d/m/Y', time()));
$mform->setType('config_scorm_from', PARAM_TEXT);
$mform->hideIf('config_scorm_from', 'config_scorm_enabled', 'eq', config::SCORM_DISABLED);
}
/**
* Display the configuration form when block is being added to the page
*
* @return bool
*/
public static function display_form_when_adding(): bool {
return true;
}
}