mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
Merge branch 'w51_MDL-7537_m25_paypalcur' of git://github.com/skodak/moodle
This commit is contained in:
commit
6c8d7fed66
@ -48,13 +48,7 @@ class enrol_paypal_edit_form extends moodleform {
|
||||
$mform->addElement('text', 'cost', get_string('cost', 'enrol_paypal'), array('size'=>4));
|
||||
$mform->setDefault('cost', $plugin->get_config('cost'));
|
||||
|
||||
$paypalcurrencies = array('USD' => 'US Dollars',
|
||||
'EUR' => 'Euros',
|
||||
'JPY' => 'Japanese Yen',
|
||||
'GBP' => 'British Pounds',
|
||||
'CAD' => 'Canadian Dollars',
|
||||
'AUD' => 'Australian Dollars'
|
||||
);
|
||||
$paypalcurrencies = $plugin->get_currencies();
|
||||
$mform->addElement('select', 'currency', get_string('currency', 'enrol_paypal'), $paypalcurrencies);
|
||||
$mform->setDefault('currency', $plugin->get_config('currency'));
|
||||
|
||||
|
@ -34,6 +34,20 @@ defined('MOODLE_INTERNAL') || die();
|
||||
*/
|
||||
class enrol_paypal_plugin extends enrol_plugin {
|
||||
|
||||
public function get_currencies() {
|
||||
// See https://www.paypal.com/cgi-bin/webscr?cmd=p/sell/mc/mc_intro-outside,
|
||||
// 3-character ISO-4217: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_currency_codes
|
||||
$codes = array(
|
||||
'AUD', 'BRL', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'ILS', 'JPY',
|
||||
'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'SEK', 'SGD', 'THB', 'TRY', 'TWD', 'USD');
|
||||
$currencies = array();
|
||||
foreach ($codes as $c) {
|
||||
$currencies[$c] = new lang_string($c, 'core_currencies');
|
||||
}
|
||||
|
||||
return $currencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns optional enrolment information icons.
|
||||
*
|
||||
|
@ -51,13 +51,7 @@ if ($ADMIN->fulltree) {
|
||||
|
||||
$settings->add(new admin_setting_configtext('enrol_paypal/cost', get_string('cost', 'enrol_paypal'), '', 0, PARAM_FLOAT, 4));
|
||||
|
||||
$paypalcurrencies = array('USD' => 'US Dollars',
|
||||
'EUR' => 'Euros',
|
||||
'JPY' => 'Japanese Yen',
|
||||
'GBP' => 'British Pounds',
|
||||
'CAD' => 'Canadian Dollars',
|
||||
'AUD' => 'Australian Dollars'
|
||||
);
|
||||
$paypalcurrencies = enrol_get_plugin('paypal')->get_currencies();
|
||||
$settings->add(new admin_setting_configselect('enrol_paypal/currency', get_string('currency', 'enrol_paypal'), '', 'USD', $paypalcurrencies));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user