Mage_Adminhtml_Block_Rating_Edit_Tab_Options Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Rating_Edit_Tab_Options:

Mage_Adminhtml_Block_Widget_Form Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _prepareForm ()


Detailed Description

Definition at line 32 of file Options.php.


Member Function Documentation

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 35 of file Options.php.

00036     {
00037         $form = new Varien_Data_Form();
00038 
00039         $fieldset = $form->addFieldset('options_form', array('legend'=>Mage::helper('rating')->__('Assigned Options')));
00040 
00041         if( Mage::registry('rating_data') ) {
00042             $collection = Mage::getModel('rating/rating_option')
00043                 ->getResourceCollection()
00044                 ->addRatingFilter(Mage::registry('rating_data')->getId())
00045                 ->load();
00046 
00047             $i = 1;
00048             foreach( $collection->getItems() as $item ) {
00049                 $fieldset->addField('option_code_' . $item->getId() , 'text', array(
00050                                         'label'     => Mage::helper('rating')->__('Option Label'),
00051                                         'required'  => true,
00052                                         'name'      => 'option_title[' . $item->getId() . ']',
00053                                         'value'     => ( $item->getCode() ) ? $item->getCode() : $i,
00054                                     )
00055                 );
00056                 $i ++;
00057             }
00058         } else {
00059             for( $i=1;$i<=5;$i++ ) {
00060                 $fieldset->addField('option_code_' . $i, 'text', array(
00061                                         'label'     => Mage::helper('rating')->__('Option Title'),
00062                                         'required'  => true,
00063                                         'name'      => 'option_title[add_' . $i . ']',
00064                                         'value'     => $i,
00065                                     )
00066                 );
00067             }
00068         }
00069 
00070         $this->setForm($form);
00071         return parent::_prepareForm();
00072     }


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

Generated on Sat Jul 4 17:22:54 2009 for Magento by  doxygen 1.5.8