Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Price Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Price:

Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract Mage_Adminhtml_Block_Abstract Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Interface Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getHtml ()
 getDisplayCurrencySelect ()
 getCurrencyAffect ()
 getValue ($index=null)
 getCondition ()
 prepareRates ($displayCurrency)

Protected Member Functions

 _getCurrencyModel ()
 _getCurrencySelectHtml ()
 _getCurrencyList ()
 _getRate ($from, $to)

Protected Attributes

 $_currencyList = null
 $_currencyModel = null


Detailed Description

Definition at line 34 of file Price.php.


Member Function Documentation

_getCurrencyList (  )  [protected]

Definition at line 93 of file Price.php.

00094     {
00095         if (is_null($this->_currencyList)) {
00096             $this->_currencyList = $this->_getCurrencyModel()->getConfigAllowCurrencies();
00097         }
00098         return $this->_currencyList;
00099     }

_getCurrencyModel (  )  [protected]

Definition at line 69 of file Price.php.

00070     {
00071         if (is_null($this->_currencyModel))
00072             $this->_currencyModel = Mage::getModel('directory/currency');
00073 
00074         return $this->_currencyModel;
00075     }

_getCurrencySelectHtml (  )  [protected]

Definition at line 77 of file Price.php.

00078     {
00079 
00080         $value = $this->getEscapedValue('currency');
00081         if (!$value)
00082             $value = $this->getColumn()->getCurrencyCode();
00083 
00084         $html  = '';
00085         $html .= '<select name="'.$this->_getHtmlName().'[currency]" id="'.$this->_getHtmlId().'_currency">';
00086         foreach ($this->_getCurrencyList() as $currency) {
00087             $html .= '<option value="' . $currency . '" '.($currency == $value ? 'selected="selected"' : '').'>' . $currency . '</option>';
00088         }
00089         $html .= '</select>';
00090         return $html;
00091     }

_getRate ( from,
to 
) [protected]

Definition at line 135 of file Price.php.

00136     {
00137         return Mage::getModel('directory/currency')->load($from)->getRate($to);
00138     }

getCondition (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract.

Definition at line 114 of file Price.php.

00115     {
00116         $value = $this->getValue();
00117 
00118         if (isset($value['currency']) && $this->getCurrencyAffect()) {
00119             $displayCurrency = $value['currency'];
00120         } else {
00121             $displayCurrency = $this->getColumn()->getCurrencyCode();
00122         }
00123         $rate = $this->_getRate($displayCurrency, $this->getColumn()->getCurrencyCode());
00124 
00125         if (isset($value['from']))
00126             $value['from'] *= $rate;
00127 
00128         if (isset($value['to']))
00129             $value['to'] *= $rate;
00130 
00131         $this->prepareRates($displayCurrency);
00132         return $value;
00133     }

getCurrencyAffect (  ) 

Definition at line 60 of file Price.php.

00061     {
00062         if (!is_null($this->getColumn()->getData('currency_affect'))) {
00063             return $this->getColumn()->getData('currency_affect');
00064         } else {
00065             return true;
00066         }
00067     }

getDisplayCurrencySelect (  ) 

Definition at line 51 of file Price.php.

00052     {
00053         if (!is_null($this->getColumn()->getData('display_currency_select'))) {
00054             return $this->getColumn()->getData('display_currency_select');
00055         } else {
00056             return true;
00057         }
00058     }

getHtml (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract.

Definition at line 39 of file Price.php.

00040     {
00041         $html  = '<div class="range">';
00042         $html .= '<div class="range-line"><span class="label">' . Mage::helper('adminhtml')->__('From').':</span> <input type="text" name="'.$this->_getHtmlName().'[from]" id="'.$this->_getHtmlId().'_from" value="'.$this->getEscapedValue('from').'" class="input-text no-changes"/></div>';
00043         $html .= '<div class="range-line"><span class="label">' . Mage::helper('adminhtml')->__('To').' : </span><input type="text" name="'.$this->_getHtmlName().'[to]" id="'.$this->_getHtmlId().'_to" value="'.$this->getEscapedValue('to').'" class="input-text no-changes"/></div>';
00044         if ($this->getDisplayCurrencySelect())
00045             $html .= '<div class="range-line"><span class="label">' . Mage::helper('adminhtml')->__('In').' : </span>' . $this->_getCurrencySelectHtml() . '</div>';
00046         $html .= '</div>';
00047 
00048         return $html;
00049     }

getValue ( index = null  ) 

Definition at line 101 of file Price.php.

00102     {
00103         if ($index) {
00104             return $this->getData('value', $index);
00105         }
00106         $value = $this->getData('value');
00107         if ((isset($value['from']) && strlen($value['from']) > 0) || (isset($value['to']) && strlen($value['to']) > 0)) {
00108             return $value;
00109         }
00110         return null;
00111     }

prepareRates ( displayCurrency  ) 

Definition at line 140 of file Price.php.

00141     {
00142         $storeCurrency = $this->getColumn()->getCurrencyCode();
00143 
00144         $rate = $this->_getRate($storeCurrency, $displayCurrency);
00145         if ($rate) {
00146             $this->getColumn()->setRate($rate);
00147             $this->getColumn()->setCurrencyCode($displayCurrency);
00148         }
00149     }


Member Data Documentation

$_currencyList = null [protected]

Definition at line 36 of file Price.php.

$_currencyModel = null [protected]

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:08 2009 for Magento by  doxygen 1.5.8