1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Adminhtml
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Order create data
29: *
30: * @category Mage
31: * @package Mage_Adminhtml
32: * @author Magento Core Team <core@magentocommerce.com>
33: */
34: class Mage_Adminhtml_Block_Sales_Order_Create_Data extends Mage_Adminhtml_Block_Sales_Order_Create_Abstract
35: {
36: /**
37: * Retrieve avilable currency codes
38: *
39: * @return unknown
40: */
41: public function getAvailableCurrencies()
42: {
43: $dirtyCodes = $this->getStore()->getAvailableCurrencyCodes();
44: $codes = array();
45: if (is_array($dirtyCodes) && count($dirtyCodes)) {
46: $rates = Mage::getModel('directory/currency')->getCurrencyRates(
47: Mage::app()->getStore()->getBaseCurrency(),
48: $dirtyCodes
49: );
50: foreach ($dirtyCodes as $code) {
51: if (isset($rates[$code]) || $code == Mage::app()->getStore()->getBaseCurrencyCode()) {
52: $codes[] = $code;
53: }
54: }
55: }
56: return $codes;
57: }
58:
59: /**
60: * Retrieve curency name by code
61: *
62: * @param string $code
63: * @return string
64: */
65: public function getCurrencyName($code)
66: {
67: return Mage::app()->getLocale()->currency($code)->getName();
68: }
69:
70: /**
71: * Retrieve curency name by code
72: *
73: * @param string $code
74: * @return string
75: */
76: public function getCurrencySymbol($code)
77: {
78: $currency = Mage::app()->getLocale()->currency($code);
79: return $currency->getSymbol() ? $currency->getSymbol() : $currency->getShortName();
80: }
81:
82: /**
83: * Retrieve current order currency code
84: *
85: * @return string
86: */
87: public function getCurrentCurrencyCode()
88: {
89: return $this->getStore()->getCurrentCurrencyCode();
90: }
91:
92: }
93: