Skip to content
Permalink
Browse files

Merge branch 'w51_MDL-7537_m25_paypalcur' of git://github.com/skodak/…

…moodle
  • Loading branch information...
danpoltawski committed Jan 8, 2013
2 parents 6d0a62b + 0456edb commit 6c8d7fed668ecaae8be1894d9634bd3bf659527f
Showing with 16 additions and 14 deletions.
  1. +1 −7 enrol/paypal/edit_form.php
  2. +14 −0 enrol/paypal/lib.php
  3. +1 −7 enrol/paypal/settings.php
@@ -48,13 +48,7 @@ function definition() {
$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 @@
*/
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 @@
$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()) {

0 comments on commit 6c8d7fe

Please sign in to comment.
You can’t perform that action at this time.