Merge branch 'MDL-30175' of git://github.com/stronk7/moodle
[moodle.git] / enrol / paypal / settings.php
blob3352d2b971378d476af6b9f093cbfaf34359b0ce
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Paypal enrolments plugin settings and presets.
21 * @package enrol
22 * @subpackage paypal
23 * @copyright 2010 Eugene Venter
24 * @author Eugene Venter - based on code by Petr Skoda and others
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28 defined('MOODLE_INTERNAL') || die();
30 if ($ADMIN->fulltree) {
32 //--- settings ------------------------------------------------------------------------------------------
33 $settings->add(new admin_setting_heading('enrol_paypal_settings', '', get_string('pluginname_desc', 'enrol_paypal')));
35 $settings->add(new admin_setting_configtext('enrol_paypal/paypalbusiness', get_string('businessemail', 'enrol_paypal'), get_string('businessemail_desc', 'enrol_paypal'), '', PARAM_EMAIL));
37 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailstudents', get_string('mailstudents', 'enrol_paypal'), '', 0));
39 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailteachers', get_string('mailteachers', 'enrol_paypal'), '', 0));
41 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailadmins', get_string('mailadmins', 'enrol_paypal'), '', 0));
43 //--- enrol instance defaults ----------------------------------------------------------------------------
44 $settings->add(new admin_setting_heading('enrol_paypal_defaults',
45 get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin')));
47 $options = array(ENROL_INSTANCE_ENABLED => get_string('yes'),
48 ENROL_INSTANCE_DISABLED => get_string('no'));
49 $settings->add(new admin_setting_configselect('enrol_paypal/status',
50 get_string('status', 'enrol_paypal'), get_string('status_desc', 'enrol_paypal'), ENROL_INSTANCE_DISABLED, $options));
52 $settings->add(new admin_setting_configtext('enrol_paypal/cost', get_string('cost', 'enrol_paypal'), '', 0, PARAM_FLOAT, 4));
54 $paypalcurrencies = array('USD' => 'US Dollars',
55 'EUR' => 'Euros',
56 'JPY' => 'Japanese Yen',
57 'GBP' => 'British Pounds',
58 'CAD' => 'Canadian Dollars',
59 'AUD' => 'Australian Dollars'
61 $settings->add(new admin_setting_configselect('enrol_paypal/currency', get_string('currency', 'enrol_paypal'), '', 'USD', $paypalcurrencies));
63 if (!during_initial_install()) {
64 $options = get_default_enrol_roles(get_context_instance(CONTEXT_SYSTEM));
65 $student = get_archetype_roles('student');
66 $student = reset($student);
67 $settings->add(new admin_setting_configselect('enrol_paypal/roleid',
68 get_string('defaultrole', 'enrol_paypal'), get_string('defaultrole_desc', 'enrol_paypal'), $student->id, $options));
71 $settings->add(new admin_setting_configtext('enrol_paypal/enrolperiod',
72 get_string('enrolperiod', 'enrol_paypal'), get_string('enrolperiod_desc', 'enrol_paypal'), 0, PARAM_INT));