forked from avetica/moodle-enrol_coursepayment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
108 lines (87 loc) · 3.61 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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/>.
/**
* Coursepayment enrolments plugin settings and presets.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
* @package enrol_coursepayment
* @copyright 2015 MFreak.nl
* @author Luuk Verhoeven
**/
defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
$install = $PAGE->url->get_path() === '/admin/upgradesettings.php' ? true : false;
$message = optional_param('message', false, PARAM_TEXT);
$config = get_config('enrol_coursepayment');
// Add mollie settings to the plugin https://www.mollie.com.
$yesno = [
0 => get_string('no'),
1 => get_string('yes'),
];
// Add some more logic.
$tabs = new \enrol_coursepayment\adminsetting\tabs('enrol_coursepayment/tabs', $settings->name, 'invoicedetails');
$tabs->addtab('invoicedetails', get_string('settings:tab_invoicedetails', 'enrol_coursepayment'));
$tabs->addtab('mail', get_string('settings:tab_mail', 'enrol_coursepayment'));
$tabs->addtab('gateway', get_string('settings:tab_gateway', 'enrol_coursepayment'));
$tabs->addtab('enrolment', get_string('settings:tab_enrolment', 'enrol_coursepayment'));
if (!empty($config->multi_account)) {
$tabs->addtab('multiaccount', get_string('settings:tab_multiaccount', 'enrol_coursepayment'));
}
$tabs->addtab('advanced', get_string('settings:tab_advanced', 'enrol_coursepayment'));
$settings->add($tabs);
$tab = $tabs->get_setting();
// Check if there is a message.
if (!empty($message)) {
$settings->add(new admin_setting_heading('enrol_coursepayment_message', '',
html_writer::div(get_string('message:' . $message, 'enrol_coursepayment'), 'alert alert-success')));
}
// Display the correct tab.
if (empty($install) && (empty($tab) || $tab === 'invoicedetails')) {
// Invoice settings.
include('settings/invoicedetails.php');
} else if ($tab === 'enrolment') {
// Enrolment settings.
include('settings/enrolment.php');
} else if ($tab === 'mail') {
// E-mail settings.
include('settings/mail.php');
} else if ($tab === 'multiaccount') {
// E-mail settings.
include('settings/multiaccount.php');
} else if ($tab === 'gateway') {
// Gateway settings.
include('settings/gateway.php');
} else if ($tab === 'advanced') {
// Advanced settings.
include('settings/advanced.php');
}
// Install make sure all values get set while installing.
if (!empty($install)) {
// Invoice settings.
include('settings/invoicedetails.php');
// Enrolment settings.
include('settings/enrolment.php');
// E-mail settings.
include('settings/mail.php');
// E-mail settings.
include('settings/multiaccount.php');
// Gateway settings.
include('settings/gateway.php');
// Advanced settings.
include('settings/advanced.php');
}
}