Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Uses currencies.php for currency list.

  • Loading branch information...
commit cb263abd7343b96998daafcef60e605c65987472 1 parent e2bc5b1
ethem authored
Showing with 7 additions and 12 deletions.
  1. +2 −2 enrol/authorize/config.html
  2. +5 −10 enrol/authorize/enrol.php
View
4 enrol/authorize/config.html
@@ -14,8 +14,8 @@
<td align="right">enrol_currency:</td>
<td>
<?php
- $currenciesarray = get_records_menu("currencies", "", "", "name", "code,name");
- choose_from_menu ($currenciesarray, "enrol_currency", $frm->enrol_currency, "","", "") ?>
+ $currencies = get_list_of_currencies();
+ choose_from_menu ($currencies, "enrol_currency", $frm->enrol_currency, "","", "") ?>
</td>
<td>
<?php print_string("currency") ?>
View
15 enrol/authorize/enrol.php
@@ -296,24 +296,19 @@ function get_course_cost($course) {
global $CFG;
$cost = (float)0;
- if (isset($coursecost))
- return $coursecost;
+ if (isset($this->coursecost))
+ return $this->coursecost;
- $currency = (empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency);
-
if (!empty($course->cost)) {
$cost = (float)(((float)$course->cost) < 0) ? $CFG->enrol_cost : $course->cost;
}
- if ( (!empty($course->currency)) && (intval($course->currency)!=0) ) {
- $objcur = get_record("currencies", "id", $course->currency);
- $currency = strval($objcur->code);
- }
+ $currency = (!empty($course->currency)) ? $course->currency : (empty($CFG->enrol_currency) ? 'USD' : $CFG->enrol_currency);
$cost = format_float($cost, 2);
- $coursecost = array('cost'=>$cost, 'currency'=>$currency);
+ $this->coursecost = array('cost'=>$cost, 'currency'=>$currency);
- return $coursecost;
+ return $this->coursecost;
}
/// Override the get_access_icons() function
Please sign in to comment.
Something went wrong with that request. Please try again.