1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* coursecompleted access plugin settings and presets.
|
|
|
19 |
*
|
|
|
20 |
* @package enrol_coursecompleted
|
|
|
21 |
* @copyright 2017 eWallah (www.eWallah.net)
|
|
|
22 |
* @author Renaat Debleu <info@eWallah.net>
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
defined('MOODLE_INTERNAL') || die();
|
|
|
27 |
|
|
|
28 |
if ($ADMIN->fulltree) {
|
|
|
29 |
// General settings.
|
|
|
30 |
$settings->add(new admin_setting_heading(
|
|
|
31 |
'enrol_coursecompleted_settings',
|
|
|
32 |
'',
|
|
|
33 |
get_string('pluginname_desc', 'enrol_coursecompleted')
|
|
|
34 |
));
|
|
|
35 |
// Enrol instance defaults.
|
|
|
36 |
$settings->add(new admin_setting_heading(
|
|
|
37 |
'enrol_coursecompleted_defaults',
|
|
|
38 |
get_string('enrolinstancedefaults', 'admin'),
|
|
|
39 |
get_string('enrolinstancedefaults_desc', 'admin')
|
|
|
40 |
));
|
|
|
41 |
$settings->add(new admin_setting_configcheckbox(
|
|
|
42 |
'enrol_coursecompleted/defaultenrol',
|
|
|
43 |
get_string('defaultenrol', 'enrol'),
|
|
|
44 |
get_string('defaultenrol_desc', 'enrol'),
|
|
|
45 |
|
|
|
46 |
));
|
|
|
47 |
|
|
|
48 |
if (!during_initial_install()) {
|
|
|
49 |
$options = [
|
|
|
50 |
ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'),
|
|
|
51 |
ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'),
|
|
|
52 |
ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'),
|
|
|
53 |
];
|
|
|
54 |
$settings->add(new admin_setting_configselect(
|
|
|
55 |
'enrol_coursecompleted/expiredaction',
|
|
|
56 |
get_string('expiredaction', 'enrol_fee'),
|
|
|
57 |
get_string('expiredaction_help', 'enrol_fee'),
|
|
|
58 |
ENROL_EXT_REMOVED_SUSPENDNOROLES,
|
|
|
59 |
$options
|
|
|
60 |
));
|
|
|
61 |
|
|
|
62 |
$options = get_default_enrol_roles(context_system::instance());
|
|
|
63 |
$student = get_archetype_roles('student');
|
|
|
64 |
$student = reset($student);
|
|
|
65 |
$settings->add(new admin_setting_configselect(
|
|
|
66 |
'enrol_coursecompleted/roleid',
|
|
|
67 |
get_string('defaultrole', 'enrol_coursecompleted'),
|
|
|
68 |
get_string('defaultrole_desc', 'enrol_coursecompleted'),
|
|
|
69 |
$student->id,
|
|
|
70 |
$options
|
|
|
71 |
));
|
|
|
72 |
}
|
|
|
73 |
$settings->add(new admin_setting_configduration(
|
|
|
74 |
'enrol_coursecompleted/enrolperiod',
|
|
|
75 |
get_string('enrolperiod', 'enrol_fee'),
|
|
|
76 |
get_string('enrolperiod_desc', 'enrol_fee'),
|
|
|
77 |
|
|
|
78 |
));
|
|
|
79 |
$settings->add(new admin_setting_configcheckbox(
|
|
|
80 |
'enrol_coursecompleted/welcome',
|
|
|
81 |
get_string('welcome', 'enrol_coursecompleted'),
|
|
|
82 |
get_string('welcome_help', 'enrol_coursecompleted'),
|
|
|
83 |
1
|
|
|
84 |
));
|
|
|
85 |
|
|
|
86 |
$settings->add(new admin_setting_configcheckbox(
|
|
|
87 |
'enrol_coursecompleted/svglearnpath',
|
|
|
88 |
get_string('svglearnpath', 'enrol_coursecompleted'),
|
|
|
89 |
get_string('svglearnpath_help', 'enrol_coursecompleted'),
|
|
|
90 |
1
|
|
|
91 |
));
|
|
|
92 |
$settings->add(new admin_setting_configcheckbox(
|
|
|
93 |
'enrol_coursecompleted/keepgroup',
|
|
|
94 |
get_string('keepgroup', 'enrol_coursecompleted'),
|
|
|
95 |
get_string('keepgroup_help', 'enrol_coursecompleted'),
|
|
|
96 |
1
|
|
|
97 |
));
|
|
|
98 |
}
|