00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Mage_Adminhtml_Block_Dashboard_Bar extends Mage_Adminhtml_Block_Dashboard_Abstract
00036 {
00037 protected $_totals = array();
00038 protected $_currentCurrencyCode = null;
00039
00040 protected function _construct()
00041 {
00042 parent::_construct();
00043 $this->setTemplate('dashboard/bar.phtml');
00044 }
00045
00046 protected function getTotals()
00047 {
00048 return $this->_totals;
00049 }
00050
00051 public function addTotal($label, $value, $isQuantity=false)
00052 {
00053
00054
00055
00056
00057
00058
00059
00060
00061 if (!$isQuantity) {
00062 $value = $this->format($value);
00063 }
00064 $decimals = '';
00065 $this->_totals[] = array(
00066 'label' => $label,
00067 'value' => $value,
00068 'decimals' => $decimals,
00069 );
00070
00071 return $this;
00072 }
00073
00074
00075
00076
00077
00078
00079
00080 public function format($price)
00081 {
00082 return $this->getCurrency()->format($price);
00083 }
00084
00085
00086
00087
00088
00089
00090 public function setCurrency($currency)
00091 {
00092 $this->_currency = $currency;
00093 }
00094
00095
00096
00097
00098
00099
00100 public function getCurrency()
00101 {
00102 if (is_null($this->_currentCurrencyCode)) {
00103 if ($this->getRequest()->getParam('store')) {
00104 $this->_currentCurrencyCode = Mage::app()->getStore($this->getRequest()->getParam('store'))->getBaseCurrency();
00105 } else if ($this->getRequest()->getParam('website')){
00106 $this->_currentCurrencyCode = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getBaseCurrency();
00107 } else if ($this->getRequest()->getParam('group')){
00108 $this->_currentCurrencyCode = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getWebsite()->getBaseCurrency();
00109 } else {
00110 $this->_currentCurrencyCode = Mage::app()->getStore()->getBaseCurrency();
00111 }
00112 }
00113
00114 return $this->_currentCurrencyCode;
00115 }
00116 }