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 * Paypal enrolments plugin settings and presets. 19 * 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 24 */ 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 if ($ADMIN->fulltree) { 29 30 //--- settings ------------------------------------------------------------------------------------------ 31 $settings->add(new admin_setting_heading('enrol_paypal_settings', '', get_string('pluginname_desc', 'enrol_paypal'))); 32 33 $settings->add(new admin_setting_configtext('enrol_paypal/paypalbusiness', get_string('businessemail', 'enrol_paypal'), get_string('businessemail_desc', 'enrol_paypal'), '', PARAM_EMAIL)); 34 35 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailstudents', get_string('mailstudents', 'enrol_paypal'), '', 0)); 36 37 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailteachers', get_string('mailteachers', 'enrol_paypal'), '', 0)); 38 39 $settings->add(new admin_setting_configcheckbox('enrol_paypal/mailadmins', get_string('mailadmins', 'enrol_paypal'), '', 0)); 40 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'), 47 ); 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)); 49 50 //--- enrol instance defaults ---------------------------------------------------------------------------- 51 $settings->add(new admin_setting_heading('enrol_paypal_defaults', 52 get_string('enrolinstancedefaults', 'admin'), get_string('enrolinstancedefaults_desc', 'admin'))); 53 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)); 58 59 $settings->add(new admin_setting_configtext('enrol_paypal/cost', get_string('cost', 'enrol_paypal'), '', 0, PARAM_FLOAT, 4)); 60 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)); 63 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)); 73 } 74 75 $settings->add(new admin_setting_configduration('enrol_paypal/enrolperiod', 76 get_string('enrolperiod', 'enrol_paypal'), get_string('enrolperiod_desc', 'enrol_paypal'), 0)); 77 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body