Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Price Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Price:

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

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 Price.php.


Member Function Documentation

_getCurrencyCode ( row  )  [protected]

Definition at line 66 of file Price.php.

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

_getRate ( row  )  [protected]

Definition at line 77 of file Price.php.

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

render ( Varien_Object row  ) 

Renders grid column

Parameters:
Varien_Object $row
Returns:
string

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.

Definition at line 49 of file Price.php.

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

renderCss (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.

Definition at line 88 of file Price.php.

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


Member Data Documentation

$_currencies = array() [static, protected]

Currency objects cache

Definition at line 41 of file Price.php.

$_defaultWidth = 100 [protected]

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract.

Definition at line 37 of file Price.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