Mage_Adminhtml_Block_Dashboard_Bar Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Dashboard_Bar:

Mage_Adminhtml_Block_Dashboard_Abstract Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_Dashboard_Sales Mage_Adminhtml_Block_Dashboard_Totals

List of all members.

Public Member Functions

 addTotal ($label, $value, $isQuantity=false)
 format ($price)
 setCurrency ($currency)
 getCurrency ()

Protected Member Functions

 _construct ()
 getTotals ()

Protected Attributes

 $_totals = array()
 $_currentCurrencyCode = null


Detailed Description

Definition at line 35 of file Bar.php.


Member Function Documentation

_construct (  )  [protected]

Internal constructor, that is called from real constructor

Please override this one instead of overriding real __construct constructor

Please override this one instead of overriding real __construct constructor

Reimplemented from Mage_Core_Block_Abstract.

Reimplemented in Mage_Adminhtml_Block_Dashboard_Sales, and Mage_Adminhtml_Block_Dashboard_Totals.

Definition at line 40 of file Bar.php.

00041     {
00042         parent::_construct();
00043         $this->setTemplate('dashboard/bar.phtml');
00044     }

addTotal ( label,
value,
isQuantity = false 
)

Definition at line 51 of file Bar.php.

00052     {
00053         /*if (!$isQuantity) {
00054             $value = $this->format($value);
00055             $decimals = substr($value, -2);
00056             $value = substr($value, 0, -2);
00057         } else {
00058             $value = ($value != '')?$value:0;
00059             $decimals = '';
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     }

format ( price  ) 

Formating value specific for this store

Parameters:
decimal $price
Returns:
string

Definition at line 80 of file Bar.php.

00081     {
00082         return $this->getCurrency()->format($price);
00083     }

getCurrency (  ) 

Retrieve currency model if not set then return currency model for current store

Returns:
Mage_Directory_Model_Currency

Definition at line 100 of file Bar.php.

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     }

getTotals (  )  [protected]

Definition at line 46 of file Bar.php.

00047     {
00048         return $this->_totals;
00049     }

setCurrency ( currency  ) 

Setting currency model

Parameters:
Mage_Directory_Model_Currency $currency

Definition at line 90 of file Bar.php.

00091     {
00092         $this->_currency = $currency;
00093     }


Member Data Documentation

$_currentCurrencyCode = null [protected]

Definition at line 38 of file Bar.php.

$_totals = array() [protected]

Definition at line 37 of file Bar.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:48 2009 for Magento by  doxygen 1.5.8