From 7ad9dd54e6372327fb87f1611249ee2638eebfb3 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 22 Jul 2005 17:30:05 +0000 Subject: [PATCH] Added get_list_of_currencies() --- lib/moodlelib.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/moodlelib.php b/lib/moodlelib.php index b912b3d69b9..db59065cbe7 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -4876,6 +4876,40 @@ function get_list_of_timezones() { return $timezones; } +/** + * Returns a list of currencies in the current language + * + * @uses $CFG + * @uses $USER + * @return array + */ +function get_list_of_currencies() { + global $CFG, $USER; + + $lang = current_language(); + + if (!file_exists($CFG->dirroot .'/lang/'. $lang .'/currencies.php')) { + if ($parentlang = get_string('parentlanguage')) { + if (file_exists($CFG->dirroot .'/lang/'. $parentlang .'/currencies.php')) { + $lang = $parentlang; + } else { + $lang = 'en'; // currencies.php must exist in this pack + } + } else { + $lang = 'en'; // currencies.php must exist in this pack + } + } + + include($CFG->dirroot .'/lang/'. $lang .'/currencies.php'); + + if (!empty($string)) { + asort($string); + } + + return $string; +} + + /** * Can include a given document file (depends on second