Mage_Eav_Model_Entity_Attribute_Source_Boolean Class Reference

Inheritance diagram for Mage_Eav_Model_Entity_Attribute_Source_Boolean:

Mage_Eav_Model_Entity_Attribute_Source_Abstract Mage_Eav_Model_Entity_Attribute_Source_Interface Mage_GiftMessage_Model_Entity_Attribute_Source_Boolean_Config

List of all members.

Public Member Functions

 getAllOptions ()
 getOptionArray ()
 getOptionText ($value)
 getFlatColums ()
 getFlatIndexes ()
 getFlatUpdateSelect ($store)


Detailed Description

Definition at line 28 of file Boolean.php.


Member Function Documentation

getAllOptions (  ) 

Retrieve all options array

Returns:
array

Implements Mage_Eav_Model_Entity_Attribute_Source_Interface.

Reimplemented in Mage_GiftMessage_Model_Entity_Attribute_Source_Boolean_Config.

Definition at line 35 of file Boolean.php.

00036     {
00037         if (is_null($this->_options)) {
00038             $this->_options = array(
00039                 array(
00040                     'label' => Mage::helper('eav')->__('Yes'),
00041                     'value' =>  1
00042                 ),
00043                 array(
00044                     'label' => Mage::helper('eav')->__('No'),
00045                     'value' =>  0
00046                 ),
00047             );
00048         }
00049         return $this->_options;
00050     }

getFlatColums (  ) 

Retrieve Column(s) for Flat

Returns:
array

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 88 of file Boolean.php.

00089     {
00090         $columns = array();
00091         $columns[$this->getAttribute()->getAttributeCode()] = array(
00092             'type'      => 'tinyint(1)',
00093             'unsigned'  => false,
00094             'is_null'   => true,
00095             'default'   => null,
00096             'extra'     => null
00097         );
00098 
00099         return $columns;
00100     }

getFlatIndexes (  ) 

Retrieve Indexes(s) for Flat

Returns:
array

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 107 of file Boolean.php.

00108     {
00109         $indexes = array();
00110 
00111         $index = 'IDX_' . strtoupper($this->getAttribute()->getAttributeCode());
00112         $indexes[$index] = array(
00113             'type'      => 'index',
00114             'fields'    => array($this->getAttribute()->getAttributeCode())
00115         );
00116 
00117         return $indexes;
00118     }

getFlatUpdateSelect ( store  ) 

Retrieve Select For Flat Attribute update

Parameters:
int $store
Returns:
Varien_Db_Select|null

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 126 of file Boolean.php.

00127     {
00128         return Mage::getResourceModel('eav/entity_attribute')
00129             ->getFlatUpdateSelect($this->getAttribute(), $store);
00130     }

getOptionArray (  ) 

Retrieve option array

Returns:
array

Definition at line 57 of file Boolean.php.

00058     {
00059         $_options = array();
00060         foreach ($this->getAllOptions() as $option) {
00061             $_options[$option['value']] = $option['label'];
00062         }
00063         return $_options;
00064     }

getOptionText ( value  ) 

Get a text for option value

Parameters:
string|integer $value
Returns:
string

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Abstract.

Definition at line 72 of file Boolean.php.

00073     {
00074         $options = $this->getAllOptions();
00075         foreach ($options as $option) {
00076             if ($option['value'] == $value) {
00077                 return $option['label'];
00078             }
00079         }
00080         return false;
00081     }


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

Generated on Sat Jul 4 17:24:10 2009 for Magento by  doxygen 1.5.8