Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Main Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Promo_Catalog_Edit_Tab_Main:

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 35 of file Main.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 38 of file Main.php.

00039     {
00040         $model = Mage::registry('current_promo_catalog_rule');
00041 
00042         //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
00043         $form = new Varien_Data_Form();
00044 
00045         $form->setHtmlIdPrefix('rule_');
00046 
00047         $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('catalogrule')->__('General Information')));
00048 
00049         $fieldset->addField('auto_apply', 'hidden', array(
00050             'name' => 'auto_apply',
00051         ));
00052 
00053         if ($model->getId()) {
00054             $fieldset->addField('rule_id', 'hidden', array(
00055                 'name' => 'rule_id',
00056             ));
00057         }
00058 
00059         $fieldset->addField('name', 'text', array(
00060             'name' => 'name',
00061             'label' => Mage::helper('catalogrule')->__('Rule Name'),
00062             'title' => Mage::helper('catalogrule')->__('Rule Name'),
00063             'required' => true,
00064         ));
00065 
00066         $fieldset->addField('description', 'textarea', array(
00067             'name' => 'description',
00068             'label' => Mage::helper('catalogrule')->__('Description'),
00069             'title' => Mage::helper('catalogrule')->__('Description'),
00070             'style' => 'width: 98%; height: 100px;',
00071         ));
00072 
00073         $fieldset->addField('is_active', 'select', array(
00074             'label'     => Mage::helper('catalogrule')->__('Status'),
00075             'title'     => Mage::helper('catalogrule')->__('Status'),
00076             'name'      => 'is_active',
00077             'required' => true,
00078             'options'    => array(
00079                 '1' => Mage::helper('catalogrule')->__('Active'),
00080                 '0' => Mage::helper('catalogrule')->__('Inactive'),
00081             ),
00082         ));
00083 
00084         if (!Mage::app()->isSingleStoreMode()) {
00085             $fieldset->addField('website_ids', 'multiselect', array(
00086                 'name'      => 'website_ids[]',
00087                 'label'     => Mage::helper('catalogrule')->__('Websites'),
00088                 'title'     => Mage::helper('catalogrule')->__('Websites'),
00089                 'required'  => true,
00090                 'values'    => Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray(),
00091             ));
00092         }
00093         else {
00094             $fieldset->addField('website_ids', 'hidden', array(
00095                 'name'      => 'website_ids[]',
00096                 'value'     => Mage::app()->getStore(true)->getWebsiteId()
00097             ));
00098             $model->setWebsiteIds(Mage::app()->getStore(true)->getWebsiteId());
00099         }
00100 
00101         $customerGroups = Mage::getResourceModel('customer/group_collection')
00102             ->load()->toOptionArray();
00103 
00104         $found = false;
00105         foreach ($customerGroups as $group) {
00106             if ($group['value']==0) {
00107                 $found = true;
00108             }
00109         }
00110         if (!$found) {
00111             array_unshift($customerGroups, array('value'=>0, 'label'=>Mage::helper('catalogrule')->__('NOT LOGGED IN')));
00112         }
00113 
00114         $fieldset->addField('customer_group_ids', 'multiselect', array(
00115             'name'      => 'customer_group_ids[]',
00116             'label'     => Mage::helper('catalogrule')->__('Customer Groups'),
00117             'title'     => Mage::helper('catalogrule')->__('Customer Groups'),
00118             'required'  => true,
00119             'values'    => $customerGroups,
00120         ));
00121 
00122         $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
00123         $fieldset->addField('from_date', 'date', array(
00124             'name'   => 'from_date',
00125             'label'  => Mage::helper('catalogrule')->__('From Date'),
00126             'title'  => Mage::helper('catalogrule')->__('From Date'),
00127             'image'  => $this->getSkinUrl('images/grid-cal.gif'),
00128             'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
00129             'format'       => $dateFormatIso
00130         ));
00131         $fieldset->addField('to_date', 'date', array(
00132             'name'   => 'to_date',
00133             'label'  => Mage::helper('catalogrule')->__('To Date'),
00134             'title'  => Mage::helper('catalogrule')->__('To Date'),
00135             'image'  => $this->getSkinUrl('images/grid-cal.gif'),
00136             'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
00137             'format'       => $dateFormatIso
00138         ));
00139 
00140         $fieldset->addField('sort_order', 'text', array(
00141             'name' => 'sort_order',
00142             'label' => Mage::helper('catalogrule')->__('Priority'),
00143         ));
00144 
00145         $form->setValues($model->getData());
00146 
00147         //$form->setUseContainer(true);
00148 
00149         if ($model->isReadonly()) {
00150             foreach ($fieldset->getElements() as $element) {
00151                 $element->setReadonly(true, true);
00152             }
00153         }
00154 
00155         $this->setForm($form);
00156 
00157         return parent::_prepareForm();
00158     }


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