Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Promo_Quote_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_quote_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('salesrule')->__('General Information')));
00048 
00049         if ($model->getId()) {
00050             $fieldset->addField('rule_id', 'hidden', array(
00051                 'name' => 'rule_id',
00052             ));
00053         }
00054 
00055         $fieldset->addField('product_ids', 'hidden', array(
00056             'name' => 'product_ids',
00057         ));
00058 
00059         $fieldset->addField('name', 'text', array(
00060             'name' => 'name',
00061             'label' => Mage::helper('salesrule')->__('Rule Name'),
00062             'title' => Mage::helper('salesrule')->__('Rule Name'),
00063             'required' => true,
00064         ));
00065 
00066         $fieldset->addField('description', 'textarea', array(
00067             'name' => 'description',
00068             'label' => Mage::helper('salesrule')->__('Description'),
00069             'title' => Mage::helper('salesrule')->__('Description'),
00070             'style' => 'width: 98%; height: 100px;',
00071         ));
00072 
00073         $fieldset->addField('is_active', 'select', array(
00074             'label'     => Mage::helper('salesrule')->__('Status'),
00075             'title'     => Mage::helper('salesrule')->__('Status'),
00076             'name'      => 'is_active',
00077             'required' => true,
00078             'options'    => array(
00079                 '1' => Mage::helper('salesrule')->__('Active'),
00080                 '0' => Mage::helper('salesrule')->__('Inactive'),
00081             ),
00082         ));
00083 
00084 
00085         if (!Mage::app()->isSingleStoreMode()) {
00086             $fieldset->addField('website_ids', 'multiselect', array(
00087                 'name'      => 'website_ids[]',
00088                 'label'     => Mage::helper('catalogrule')->__('Websites'),
00089                 'title'     => Mage::helper('catalogrule')->__('Websites'),
00090                 'required'  => true,
00091                 'values'    => Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray(),
00092             ));
00093         }
00094         else {
00095             $fieldset->addField('website_ids', 'hidden', array(
00096                 'name'      => 'website_ids[]',
00097                 'value'     => Mage::app()->getStore(true)->getWebsiteId()
00098             ));
00099             $model->setWebsiteIds(Mage::app()->getStore(true)->getWebsiteId());
00100         }
00101 
00102         $customerGroups = Mage::getResourceModel('customer/group_collection')
00103             ->load()->toOptionArray();
00104 
00105         $found = false;
00106         foreach ($customerGroups as $group) {
00107             if ($group['value']==0) {
00108                 $found = true;
00109             }
00110         }
00111         if (!$found) {
00112             array_unshift($customerGroups, array('value'=>0, 'label'=>Mage::helper('salesrule')->__('NOT LOGGED IN')));
00113         }
00114 
00115         $fieldset->addField('customer_group_ids', 'multiselect', array(
00116             'name'      => 'customer_group_ids[]',
00117             'label'     => Mage::helper('salesrule')->__('Customer Groups'),
00118             'title'     => Mage::helper('salesrule')->__('Customer Groups'),
00119             'required'  => true,
00120             'values'    => $customerGroups,
00121         ));
00122 
00123         $fieldset->addField('coupon_code', 'text', array(
00124             'name' => 'coupon_code',
00125             'label' => Mage::helper('salesrule')->__('Coupon code'),
00126         ));
00127 
00128         $fieldset->addField('uses_per_coupon', 'text', array(
00129             'name' => 'uses_per_coupon',
00130             'label' => Mage::helper('salesrule')->__('Uses per coupon'),
00131         ));
00132 
00133         $fieldset->addField('uses_per_customer', 'text', array(
00134             'name' => 'uses_per_customer',
00135             'label' => Mage::helper('salesrule')->__('Uses per customer'),
00136         ));
00137 
00138         $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
00139         $fieldset->addField('from_date', 'date', array(
00140             'name'   => 'from_date',
00141             'label'  => Mage::helper('salesrule')->__('From Date'),
00142             'title'  => Mage::helper('salesrule')->__('From Date'),
00143             'image'  => $this->getSkinUrl('images/grid-cal.gif'),
00144             'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
00145             'format'       => $dateFormatIso
00146         ));
00147         $fieldset->addField('to_date', 'date', array(
00148             'name'   => 'to_date',
00149             'label'  => Mage::helper('salesrule')->__('To Date'),
00150             'title'  => Mage::helper('salesrule')->__('To Date'),
00151             'image'  => $this->getSkinUrl('images/grid-cal.gif'),
00152             'input_format' => Varien_Date::DATE_INTERNAL_FORMAT,
00153             'format'       => $dateFormatIso
00154         ));
00155 
00156         $fieldset->addField('sort_order', 'text', array(
00157             'name' => 'sort_order',
00158             'label' => Mage::helper('salesrule')->__('Priority'),
00159         ));
00160 
00161         $fieldset->addField('is_rss', 'select', array(
00162             'label'     => Mage::helper('salesrule')->__('Public In RSS Feed'),
00163             'title'     => Mage::helper('salesrule')->__('Public In RSS Feed'),
00164             'name'      => 'is_rss',
00165             'options'   => array(
00166                 '1' => Mage::helper('salesrule')->__('Yes'),
00167                 '0' => Mage::helper('salesrule')->__('No'),
00168             ),
00169         ));
00170 
00171         if(!$model->getId()){
00172             //set the default value for is_rss feed to yes for new promotion
00173             $model->setIsRss(1);
00174         }
00175 
00176         $form->setValues($model->getData());
00177 
00178         if ($model->isReadonly()) {
00179             foreach ($fieldset->getElements() as $element) {
00180                 $element->setReadonly(true, true);
00181             }
00182         }
00183 
00184         //$form->setUseContainer(true);
00185 
00186         $this->setForm($form);
00187 
00188         return parent::_prepareForm();
00189     }


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