MDL-73013 filelib: Address coding style violations
[moodle.git] / enrol / paypal / settings.php
blobd9a3a7fea3332a4cc249139053b73b76f6944dbf
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.
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/>.
17 /**
18 * Paypal enrolments plugin settings and presets.
20 * @package enrol_paypal
21 * @copyright 2010 Eugene Venter
22 * @author Eugene Venter - based on code by Petr Skoda and others
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 defined('MOODLE_INTERNAL') || die();
28 if ($ADMIN->fulltree) {
30 //--- settings ------------------------------------------------------------------------------------------
31 $settings->add(new admin_setting_heading('enrol_paypal_settings', '', get_string('pluginname_desc', 'enrol_paypal')));
33 $settings->add(new admin_setting_configtext('enrol_paypal/paypalbusiness', get_string('businessemail', 'enrol_paypal'), get_string('businessemail_desc', 'enrol_paypal'), '', PARAM_EMAIL));
35 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailstudents', get_string('mailstudents', 'enrol_paypal'), '', 0));
37 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailteachers', get_string('mailteachers', 'enrol_paypal'), '', 0));
39 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailadmins', get_string('mailadmins', 'enrol_paypal'), '', 0));
41 // Note: let's reuse the ext sync constants and strings here, internally it is very similar,
42 // it describes what should happen when users are not supposed to be enrolled any more.
43 $options = array(
44 ENROL_EXT_REMOVED_KEEP => get_string('extremovedkeep', 'enrol'),
45 ENROL_EXT_REMOVED_SUSPENDNOROLES => get_string('extremovedsuspendnoroles', 'enrol'),
46 ENROL_EXT_REMOVED_UNENROL => get_string('extremovedunenrol', 'enrol'),
48 $settings->add(new admin_setting_configselect('enrol_paypal/expiredaction', get_string('expiredaction', 'enrol_paypal'), get_string('expiredaction_help', 'enrol_paypal'), ENROL_EXT_REMOVED_SUSPENDNOROLES, $options));
50 //--- enrol instance defaults ----------------------------------------------------------------------------
51 $settings->add(new admin_setting_heading('enrol_paypal_defaults',
52 get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin')));
54 $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'),
55 ENROL_INSTANCE_DISABLED => get_string('no'));
56 $settings->add(new admin_setting_configselect('enrol_paypal/status',
57 get_string('status', 'enrol_paypal'), get_string('status_desc', 'enrol_paypal'), ENROL_INSTANCE_DISABLED, $options));
59 $settings->add(new admin_setting_configtext('enrol_paypal/cost', get_string('cost', 'enrol_paypal'), '', 0, PARAM_FLOAT, 4));
61 $paypalcurrencies = enrol_get_plugin('paypal')->get_currencies();
62 $settings->add(new admin_setting_configselect('enrol_paypal/currency', get_string('currency', 'enrol_paypal'), '', 'USD', $paypalcurrencies));
64 if (!during_initial_install()) {
65 $options = get_default_enrol_roles(context_system::instance());
66 $student = get_archetype_roles('student');
67 $student = reset($student);
68 $settings->add(new admin_setting_configselect('enrol_paypal/roleid',
69 get_string('defaultrole', 'enrol_paypal'),
70 get_string('defaultrole_desc', 'enrol_paypal'),
71 $student->id ?? null,
72 $options));
75 $settings->add(new admin_setting_configduration('enrol_paypal/enrolperiod',
76 get_string('enrolperiod', 'enrol_paypal'), get_string('enrolperiod_desc', 'enrol_paypal'), 0));