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 class Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Select extends Mage_Adminhtml_Block_Widget_Grid_Column_Filter_Abstract
00035 {
00036 protected function _getOptions()
00037 {
00038 $colOptions = $this->getColumn()->getOptions();
00039 if ( !empty($colOptions) && is_array($colOptions) ) {
00040 $options = array(array('value' => null, 'label' => ''));
00041 foreach ($colOptions as $value => $label) {
00042 $options[] = array('value' => $value, 'label' => $label);
00043 }
00044 return $options;
00045 }
00046 return array();
00047 }
00048
00049 public function getHtml()
00050 {
00051 $html = '<select name="'.$this->_getHtmlName().'" id="'.$this->_getHtmlId().'" class="no-changes">';
00052 $value = $this->getValue();
00053 foreach ($this->_getOptions() as $option){
00054 $selected = ( ($option['value'] == $value && (!is_null($value))) ? ' selected="selected"' : '' );
00055 $html.= '<option value="'.$option['value'].'"'.$selected.'>'.$option['label'].'</option>';
00056 }
00057 $html.='</select>';
00058 return $html;
00059 }
00060
00061 public function getCondition()
00062 {
00063 if (is_null($this->getValue())) {
00064 return null;
00065 }
00066 return array('eq' => $this->getValue());
00067 }
00068
00069 }