Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Currency Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Currency:

Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract Mage_Adminhtml_Block_Abstract Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Interface Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object Mage_Adminhtml_Block_Report_Grid_Column_Renderer_Currency

List of all members.

Public Member Functions

 render (Varien_Object $row)
 renderCss ()

Protected Member Functions

 _getCurrencyCode ($row)
 _getRate ($row)

Protected Attributes

 $_defaultWidth = 100

Static Protected Attributes

static $_currencies = array()


Detailed Description

Definition at line 35 of file Currency.php.


Member Function Documentation

_getCurrencyCode ( row  )  [protected]

Definition at line 67 of file Currency.php.

00068     {
00069         if ($code = $this->getColumn()->getCurrencyCode()) {
00070             return $code;
00071         }
00072         if ($code = $row->getData($this->getColumn()->getCurrency())) {
00073             return $code;
00074         }
00075         return false;
00076     }

_getRate ( row  )  [protected]

Definition at line 78 of file Currency.php.

00079     {
00080         if ($rate = $this->getColumn()->getRate()) {
00081             return floatval($rate);
00082         }
00083         if ($rate = $row->getData($this->getColumn()->getRateField())) {
00084             return floatval($rate);
00085         }
00086         return 1;
00087     }

render ( Varien_Object row  ) 

Renders grid column

Parameters:
Varien_Object $row
Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.

Reimplemented in Mage_Adminhtml_Block_Report_Grid_Column_Renderer_Currency.

Definition at line 50 of file Currency.php.

00051     {
00052         if ($data = $row->getData($this->getColumn()->getIndex())) {
00053             $currency_code = $this->_getCurrencyCode($row);
00054 
00055             if (!$currency_code) {
00056                 return $data;
00057             }
00058 
00059             $data = floatval($data) * $this->_getRate($row);
00060             $data = sprintf("%f", $data);
00061             $data =Mage::app()->getLocale()->currency($currency_code)->toCurrency($data);
00062             return $data;
00063         }
00064         return $this->getColumn()->getDefault();
00065     }

renderCss (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.

Definition at line 89 of file Currency.php.

00090     {
00091         return parent::renderCss() . ' a-right';
00092     }


Member Data Documentation

$_currencies = array() [static, protected]

Currency objects cache

Definition at line 42 of file Currency.php.

$_defaultWidth = 100 [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.

Definition at line 37 of file Currency.php.


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

Generated on Sat Jul 4 17:23:09 2009 for Magento by  doxygen 1.5.8