Mage_Customer_Model_Customer_Attribute_Source_Store Class Reference

Inheritance diagram for Mage_Customer_Model_Customer_Attribute_Source_Store:

Mage_Eav_Model_Entity_Attribute_Source_Table Mage_Eav_Model_Entity_Attribute_Source_Abstract Mage_Eav_Model_Entity_Attribute_Source_Interface

List of all members.

Public Member Functions

 getAllOptions ()
 getOptionText ($value)


Detailed Description

Definition at line 34 of file Store.php.


Member Function Documentation

getAllOptions (  ) 

Retrieve All options

Returns:
array

Implements Mage_Eav_Model_Entity_Attribute_Source_Interface.

Definition at line 36 of file Store.php.

00037     {
00038         if (!$this->_options) {
00039             $collection = Mage::getResourceModel('core/store_collection');
00040             if ('store_id' == $this->getAttribute()->getAttributeCode()) {
00041                 $collection->setWithoutDefaultFilter();
00042             }
00043             $this->_options = Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm();
00044             if ('created_in' == $this->getAttribute()->getAttributeCode()) {
00045                 array_unshift($this->_options, array('value' => '0', 'label' => Mage::helper('customer')->__('Admin')));
00046             }
00047         }
00048         return $this->_options;
00049     }

getOptionText ( value  ) 

Get a text for option value

Parameters:
string|integer $value
Returns:
string

Reimplemented from Mage_Eav_Model_Entity_Attribute_Source_Table.

Definition at line 51 of file Store.php.

00052     {
00053         if(!$value)$value ='0';
00054         $isMultiple = false;
00055         if (strpos($value, ',')) {
00056             $isMultiple = true;
00057             $value = explode(',', $value);
00058         }
00059 
00060         if (!$this->_options) {
00061             $collection = Mage::getResourceModel('core/store_collection');
00062             if ('store_id' == $this->getAttribute()->getAttributeCode()) {
00063                 $collection->setWithoutDefaultFilter();
00064             }
00065             $this->_options = $collection->load()->toOptionArray();
00066             if ('created_in' == $this->getAttribute()->getAttributeCode()) {
00067                 array_unshift($this->_options, array('value' => '0', 'label' => Mage::helper('customer')->__('Admin')));
00068             }
00069         }
00070 
00071         if ($isMultiple) {
00072             $values = array();
00073             foreach ($value as $val) {
00074                 $values[] = $this->_options[$val];
00075             }
00076             return $values;
00077         }
00078         else {
00079             return $this->_options[$value];
00080         }
00081         return false;
00082     }


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

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