Varien_Data_Form PHP Class Code Examples

This page contains top rated real world PHP examples of class Varien_Data_Form extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: Form.php Project: tschifftner/Magento-MEP
0
 protected function _prepareForm()
 {
     if (!Mage::helper('mep/categories')->googleCategoriesAreInitialized()) {
         $form = new Varien_Data_Form(array());
         $formUpload = $form->addFieldset('file_selection', array('legend' => Mage::helper('mep')->__('Google Categories CSV')));
         $formUpload->addField('launch', 'button', array('label' => Mage::helper('mep')->__('Google categories initialisation'), 'value' => Mage::helper('mep')->__('Start'), 'name' => 'launch', 'class' => 'form-button', 'onclick' => 'startGoogleCategoriesImport(\'' . Mage::helper('adminhtml')->getUrl('/google/importcategories') . '\');'));
     } else {
         $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post'));
         $storeSelection = $form->addFieldset('store_selection', array('legend' => Mage::helper('mep')->__('Select a store')));
         $storeSelection->addField('store_selection_select', 'select', array('label' => Mage::helper('mep')->__('Store'), 'class' => 'required-entry', 'required' => true, 'name' => 'store_selection_select', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, false)));
         $categories = $form->addFieldset('categories', array('legend' => Mage::helper('mep')->__('Categories mapping')));
         $categories->setHtmlContent('
             <div id="categories_list"></div>
             <script type="text/javascript">
                 $(document).observe("dom:loaded", function() {
                     var googleMapping = new GoogleMapping();
                     googleMapping.options.requestUrl.loadcategories = \'' . Mage::helper('adminhtml')->getUrl('/google/loadcategories') . '\';
                     googleMapping.options.requestUrl.loadtaxonomies = \'' . Mage::helper('adminhtml')->getUrl('/google/loadtaxonomies') . '\';
                     googleMapping.load();
                 });
             </script>
         ');
     }
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #2
Show file File: Form.php Project: cewolf2002/magento
0
 /**
  * Prepare form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_template');
     if (!$model) {
         $model = new Varien_Object();
     }
     $action = $this->getUrl('*/*/saveTemplate');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $action, 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setHtmlIdPrefix('template_');
     $fieldset = $form->addFieldset('edit_template', array('legend' => $this->__('Template')));
     $this->_addElementTypes($fieldset);
     if ($model->getId()) {
         $fieldset->addField('id', 'hidden', array('name' => 'id'));
         $fieldset->addField('template_id', 'hidden', array('name' => 'template_id'));
     }
     $fieldset->addField('application_id', 'select', array('name' => 'application_id', 'label' => $this->__('Application'), 'title' => $this->__('Application'), 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false, 'values' => Mage::helper('xmlconnect')->getApplicationOptions(), 'note' => $this->__('Creating a Template is allowed only for applications which have device type iPhone.'), 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name'), 'required' => true, 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 255'), 'maxlength' => 255));
     $fieldset->addField('push_title', 'text', array('name' => 'push_title', 'label' => $this->__('Push Title'), 'title' => $this->__('Push Title'), 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 140'), 'maxlength' => 140));
     $this->_dependentFields['message_title'] = $fieldset->addField('message_title', 'text', array('name' => 'message_title', 'label' => $this->__('Message Title'), 'title' => $this->__('Message Title'), 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 255'), 'maxlength' => 255));
     $widgetFilters = array('is_email_compatible' => 1);
     $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('widget_filters' => $widgetFilters));
     $this->_dependentFields['content'] = $fieldset->addField('content', 'editor', array('label' => $this->__('Template Content'), 'title' => $this->__('Template Content'), 'name' => 'content', 'style' => 'height:30em;', 'state' => 'html', 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'config' => $wysiwygConfig));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #3
Show file File: Form.php Project: hirentricore/devmagento
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #4
Show file File: Form.php Project: SalesOneGit/s1_magento
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('add_review_form', array('legend' => Mage::helper('review')->__('Review Details')));
     $fieldset->addField('product_name', 'note', array('label' => Mage::helper('review')->__('Product'), 'text' => 'product_name'));
     $fieldset->addField('detailed_rating', 'note', array('label' => Mage::helper('review')->__('Product Rating'), 'required' => true, 'text' => '<div id="rating_detail">' . $this->getLayout()->createBlock('adminhtml/review_rating_detailed')->toHtml() . '</div>'));
     $fieldset->addField('status_id', 'select', array('label' => Mage::helper('review')->__('Status'), 'required' => true, 'name' => 'status_id', 'values' => Mage::helper('review')->getReviewStatusesOptionArray()));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('select_stores', 'multiselect', array('label' => Mage::helper('review')->__('Visible In'), 'required' => true, 'name' => 'select_stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     }
     $fieldset->addField('nickname', 'text', array('name' => 'nickname', 'title' => Mage::helper('review')->__('Nickname'), 'label' => Mage::helper('review')->__('Nickname'), 'maxlength' => '50', 'required' => true));
     $fieldset->addField('title', 'text', array('name' => 'title', 'title' => Mage::helper('review')->__('Summary of Review'), 'label' => Mage::helper('review')->__('Summary of Review'), 'maxlength' => '255', 'required' => true));
     $fieldset->addField('detail', 'textarea', array('name' => 'detail', 'title' => Mage::helper('review')->__('Review'), 'label' => Mage::helper('review')->__('Review'), 'style' => 'height: 600px;', 'required' => true));
     $fieldset->addField('product_id', 'hidden', array('name' => 'product_id'));
     /*$gridFieldset = $form->addFieldset('add_review_grid', array('legend' => Mage::helper('review')->__('Please select a product')));
       $gridFieldset->addField('products_grid', 'note', array(
           'text' => $this->getLayout()->createBlock('adminhtml/review_product_grid')->toHtml(),
       ));*/
     $form->setMethod('post');
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/post'));
     $this->setForm($form);
 }
Example #5
Show file File: Form.php Project: okite11/frames21
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #6
Show file File: Form.php Project: cabrerabywaters/magentoSunshine
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #7
Show file File: Labels.php Project: hientruong90/ee_14_installer
0
 protected function _prepareForm()
 {
     $rule = Mage::registry('current_promo_quote_rule');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('default_label_fieldset', array('legend' => Mage::helper('salesrule')->__('Default Label')));
     $labels = $rule->getStoreLabels();
     $fieldset->addField('store_default_label', 'text', array('name' => 'store_labels[0]', 'required' => false, 'label' => Mage::helper('salesrule')->__('Default Rule Label for All Store Views'), 'value' => isset($labels[0]) ? $labels[0] : ''));
     $fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('salesrule')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset');
     $fieldset->setRenderer($renderer);
     foreach (Mage::app()->getWebsites() as $website) {
         $fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
         foreach ($website->getGroups() as $group) {
             $stores = $group->getStores();
             if (count($stores) == 0) {
                 continue;
             }
             $fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
             foreach ($stores as $store) {
                 $fieldset->addField("s_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
             }
         }
     }
     if ($rule->isReadonly()) {
         foreach ($fieldset->getElements() as $element) {
             $element->setReadonly(true, true);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #8
Show file File: General.php Project: xiaoguizhidao/cupboardglasspipes.ecomitize.com
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('promotional_form', array('legend' => Mage::helper('promotional')->__('General')));
     $fieldset->addField('name', 'text', array('label' => Mage::helper('promotional')->__('Name'), 'name' => 'name', 'class' => 'required-entry', 'required' => true));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => Mage::helper('promotional')->__('Date From'), 'name' => 'date_from', 'required' => false, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('label' => Mage::helper('promotional')->__('Date To'), 'name' => 'date_to', 'required' => false, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_view', 'multiselect', array('label' => Mage::helper('promotional')->__('Store View'), 'name' => 'store_view', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     }
     $fieldset->addField('page_type', 'multiselect', array('label' => Mage::helper('promotional')->__('Page Type'), 'name' => 'page_type', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_page')->toOptionArray()));
     $fieldset->addField('position', 'select', array('label' => Mage::helper('promotional')->__('Position'), 'name' => 'position', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_position')->toOptionArray()));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('promotional')->__('Status'), 'name' => 'status', 'class' => 'required-entry', 'required' => true, 'values' => Mage::getModel('promotional/source_status')->toOptionArray()));
     $fieldset->addField('width', 'text', array('label' => Mage::helper('promotional')->__('Width, px'), 'name' => 'width', 'required' => false, 'note' => $this->__('Minimum width is 200px')));
     $fieldset->addField('height', 'text', array('label' => Mage::helper('promotional')->__('Height, px'), 'name' => 'height', 'required' => false, 'note' => $this->__('Miimum height is 300px')));
     if (Mage::getSingleton('adminhtml/session')->getPromotionalData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getPromotionalData());
         Mage::getSingleton('adminhtml/session')->setPromotionalData(null);
     } elseif (Mage::registry('promotional_data')) {
         $form->setValues(Mage::registry('promotional_data')->getData());
     }
     if (Mage::getSingleton('adminhtml/session')->getPromotionalData() == NULL && Mage::registry('promotional_data')->getData() == NULL) {
         $form->setValues(array('position' => Mage::helper('promotional')->getDefaultPosition()));
     }
     return parent::_prepareForm();
 }
Example #9
Show file File: Attributes.php Project: hirentricore/devmagento
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     /**
      * Initialize product object as form property
      * for using it in elements generation
      */
     $form->setDataObject(Mage::registry('product'));
     $fieldset = $form->addFieldset('group_fields', array());
     $attributes = $this->getGroupAttributes();
     $this->_setFieldset($attributes, $fieldset, array('gallery'));
     $values = Mage::registry('product')->getData();
     /**
      * Set attribute default values for new product
      */
     if (!Mage::registry('product')->getId()) {
         foreach ($attributes as $attribute) {
             if (!isset($values[$attribute->getAttributeCode()])) {
                 $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
             }
         }
     }
     Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
     $form->addValues($values);
     $form->setFieldNameSuffix('product');
     $this->setForm($form);
 }
Example #10
Show file File: Form.php Project: sixg/mkAnagh
0
 protected function _prepareForm()
 {
     $back = $this->getRequest()->getParam('back', '');
     $amount = $this->getRequest()->getPost('total', 0);
     $params = $this->getRequest()->getParams();
     $type = isset($params['type']) && in_array($params['type'], array_keys(Ced_CsMarketplace_Model_Vpayment::getStates())) ? $params['type'] : Ced_CsMarketplace_Model_Vpayment::TRANSACTION_TYPE_CREDIT;
     if ($back == 'edit' && $amount) {
         $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('payment_method' => Mage::helper('csmarketplace/acl')->getDefaultPaymentType(), 'type' => $type)), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     } else {
         $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/*', array('vendor_id' => $this->getRequest()->getParam('vendor_id'), 'type' => $type)), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     }
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #11
Show file File: Form.php Project: hirentricore/devmagento
0
 /**
  * Prepares form
  *
  * @return Mage_Adminhtml_Block_Sales_Order_Create_Giftmessage_Form
  */
 public function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('main', array('no_container' => true));
     $fieldset->addField('type', 'hidden', array('name' => $this->_getFieldName('type')));
     $form->setHtmlIdPrefix($this->_getFieldIdPrefix());
     if ($this->getEntityType() == 'item') {
         $this->_prepareHiddenFields($fieldset);
     } else {
         $this->_prepareVisibleFields($fieldset);
     }
     // Set default sender and recipient from billing and shipping adresses
     if (!$this->getMessage()->getSender()) {
         $this->getMessage()->setSender($this->getDefaultSender());
     }
     if (!$this->getMessage()->getRecipient()) {
         $this->getMessage()->setRecipient($this->getDefaultRecipient());
     }
     $this->getMessage()->setType($this->getEntityType());
     // Overriden default data with edited when block reloads througth Ajax
     $this->_applyPostData();
     $form->setValues($this->getMessage()->getData());
     $this->setForm($form);
     return $this;
 }
Example #12
Show file File: Form.php Project: cewolf2002/magento
0
 protected function _prepareForm()
 {
     $model = Mage::registry('cms_block');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix('block_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('cms')->__('General Information'), 'class' => 'fieldset-wide'));
     if ($model->getBlockId()) {
         $fieldset->addField('block_id', 'hidden', array('name' => 'block_id'));
     }
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => Mage::helper('cms')->__('Block Title'), 'title' => Mage::helper('cms')->__('Block Title'), 'required' => true));
     $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => Mage::helper('cms')->__('Identifier'), 'title' => Mage::helper('cms')->__('Identifier'), 'required' => true, 'class' => 'validate-xml-identifier'));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => Mage::helper('cms')->__('Status'), 'title' => Mage::helper('cms')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('cms')->__('Enabled'), '0' => Mage::helper('cms')->__('Disabled'))));
     if (!$model->getId()) {
         $model->setData('is_active', '1');
     }
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => Mage::helper('cms')->__('Content'), 'title' => Mage::helper('cms')->__('Content'), 'style' => 'height:36em', 'required' => true, 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig()));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #13
Show file File: General.php Project: blazeriaz/youguess
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('general', array('legend' => Mage::helper('core')->__('General Settings')));
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', array('label' => Mage::helper('core')->__('Store'), 'title' => Mage::helper('core')->__('Store'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), 'name' => 'store_id', 'required' => true));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => Mage::app()->getStore(true)->getId()));
     }
     $fieldset->addField('design', 'select', array('label' => Mage::helper('core')->__('Custom Design'), 'title' => Mage::helper('core')->__('Custom Design'), 'values' => Mage::getSingleton('core/design_source_design')->getAllOptions(), 'name' => 'design', 'required' => true));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => Mage::helper('core')->__('Date From'), 'title' => Mage::helper('core')->__('Date From'), 'name' => 'date_from', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('label' => Mage::helper('core')->__('Date To'), 'title' => Mage::helper('core')->__('Date To'), 'name' => 'date_to', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $formData = Mage::getSingleton('adminhtml/session')->getDesignData(true);
     if (!$formData) {
         $formData = Mage::registry('design')->getData();
     } else {
         $formData = $formData['design'];
     }
     $form->addValues($formData);
     $form->setFieldNameSuffix('design');
     $this->setForm($form);
 }
Example #14
Show file File: Main.php Project: okite11/frames21
0
 /**
  * Prepare form before rendering HTML
  *
  * @return Mage_Widget_Block_Adminhtml_Widget_Instance_Edit_Tab_Main
  */
 protected function _prepareForm()
 {
     $widgetInstance = $this->getWidgetInstance();
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('widget')->__('Frontend Properties')));
     if ($widgetInstance->getId()) {
         $fieldset->addField('instance_id', 'hidden', array('name' => 'isntance_id'));
     }
     $this->_addElementTypes($fieldset);
     $fieldset->addField('type', 'select', array('name' => 'type', 'label' => Mage::helper('widget')->__('Type'), 'title' => Mage::helper('widget')->__('Type'), 'class' => '', 'values' => $this->getTypesOptionsArray(), 'disabled' => true));
     $fieldset->addField('package_theme', 'select', array('name' => 'package_theme', 'label' => Mage::helper('widget')->__('Design Package/Theme'), 'title' => Mage::helper('widget')->__('Design Package/Theme'), 'required' => false, 'values' => $this->getPackegeThemeOptionsArray(), 'disabled' => true));
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => Mage::helper('widget')->__('Widget Instance Title'), 'title' => Mage::helper('widget')->__('Widget Instance Title'), 'class' => '', 'required' => true));
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_ids', 'multiselect', array('name' => 'store_ids[]', 'label' => Mage::helper('widget')->__('Assign to Store Views'), 'title' => Mage::helper('widget')->__('Assign to Store Views'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     }
     $fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('widget')->__('Sort Order'), 'title' => Mage::helper('widget')->__('Sort Order'), 'class' => '', 'required' => false, 'note' => Mage::helper('widget')->__('Sort Order of widget instances in the same block reference')));
     /* @var $layoutBlock Mage_Widget_Block_Adminhtml_Widget_Instance_Edit_Tab_Main_Layout */
     $layoutBlock = $this->getLayout()->createBlock('widget/adminhtml_widget_instance_edit_tab_main_layout')->setWidgetInstance($widgetInstance);
     $fieldset = $form->addFieldset('layout_updates_fieldset', array('legend' => Mage::helper('widget')->__('Layout Updates')));
     $fieldset->addField('layout_updates', 'note', array());
     $form->getElement('layout_updates_fieldset')->setRenderer($layoutBlock);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #15
Show file File: Form.php Project: monkviper/magento-lite
0
 /**
  * Enter description here...
  *
  * @return Mage_Adminhtml_Block_System_Config_Form
  */
 public function initForm()
 {
     $this->_initObjects();
     $form = new Varien_Data_Form();
     $sections = $this->_configFields->getSection($this->getSectionCode(), $this->getWebsiteCode(), $this->getStoreCode());
     if (empty($sections)) {
         $sections = array();
     }
     foreach ($sections as $section) {
         /* @var $section Varien_Simplexml_Element */
         if (!$this->_canShowField($section)) {
             continue;
         }
         foreach ($section->groups as $groups) {
             $groups = (array) $groups;
             usort($groups, array($this, '_sortForm'));
             foreach ($groups as $group) {
                 /* @var $group Varien_Simplexml_Element */
                 if (!$this->_canShowField($group)) {
                     continue;
                 }
                 $this->_initGroup($form, $group, $section);
             }
         }
     }
     $this->setForm($form);
     return $this;
 }
Example #16
Show file File: Form.php Project: buttasg/cowgirlk
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('brand_form', array('legend' => Mage::helper('brand')->__('Brand information')));
     $fieldset->addField('title', 'text', array('label' => Mage::helper('brand')->__('Title'), 'class' => 'required-entry', 'required' => true, 'name' => 'title'));
     $fieldset->addField('filename', 'image', array('label' => Mage::helper('brand')->__('File'), 'required' => false, 'name' => 'filename'));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('brand')->__('Status'), 'name' => 'status', 'values' => array(array('value' => 1, 'label' => Mage::helper('brand')->__('Enabled')), array('value' => 2, 'label' => Mage::helper('brand')->__('Disabled')))));
     $fieldset->addField('home_page', 'select', array('label' => Mage::helper('brand')->__('Home Page'), 'name' => 'home_page', 'values' => array(array('value' => 1, 'label' => Mage::helper('brand')->__('Enabled')), array('value' => 2, 'label' => Mage::helper('brand')->__('Disabled')))));
     /*$fieldset->addField('content', 'editor', array(
           'name'      => 'content',
           'label'     => Mage::helper('brand')->__('Content'),
           'title'     => Mage::helper('brand')->__('Content'),
           'style'     => 'width:700px; height:500px;',
           'wysiwyg'   => false,
           'required'  => true,
       ));*/
     if (Mage::getSingleton('adminhtml/session')->getBrandData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getBrandData());
         Mage::getSingleton('adminhtml/session')->setBrandData(null);
     } elseif (Mage::registry('brand_data')) {
         $form->setValues(Mage::registry('brand_data')->getData());
     }
     return parent::_prepareForm();
 }
Example #17
Show file File: Conditions.php Project: Mohitsahu123/layered-landing
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $this->setForm($form);
     $fieldset = $form->addFieldset('layeredlanding_form', array('legend' => Mage::helper('layeredlanding')->__('Landingpage Conditions'), 'class' => 'fieldset-wide'));
     $fieldset->addField('category_ids', 'multiselect', array('label' => Mage::helper('layeredlanding')->__('Categories'), 'class' => 'required-entry', 'required' => true, 'name' => 'category_ids', 'onchange' => '_estimate_product_count();', 'values' => Mage::getSingleton('layeredlanding/options_categories')->toOptionArray(), 'style' => 'width:80%'));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_ids', 'multiselect', array('name' => 'store_ids', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'onchange' => '_estimate_product_count();'));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_ids', 'hidden', array('name' => 'store_ids', 'value' => Mage::app()->getStore(true)->getId(), 'onchange' => '_estimate_product_count();'));
     }
     $fieldset->addField('attributes', 'text', array('name' => 'attributes', 'label' => Mage::helper('layeredlanding')->__('Attributes'), 'required' => false));
     $attributes = $form->getElement('attributes');
     $attributes->setRenderer($this->getLayout()->createBlock('layeredlanding/adminhtml_layeredlanding_edit_renderer_attributes'));
     if (Mage::getSingleton('adminhtml/session')->getLayeredlandingData()) {
         $data = Mage::getSingleton('adminhtml/session')->getLayeredlandingData();
         Mage::getSingleton('adminhtml/session')->setLayeredlandingData(null);
     } elseif (Mage::registry('layeredlanding_data')) {
         $data = Mage::registry('layeredlanding_data')->getData();
     }
     // modify multiselect values
     $data['store_ids'] = explode(',', $data['store_ids']);
     $data['category_ids'] = explode(',', $data['category_ids']);
     $form->setValues($data);
     return parent::_prepareForm();
 }
Example #18
Show file File: Abstract.php Project: Airmal/Magento-Em
0
 /**
  * Preparing default form elements for editing attribute
  *
  * @return Mage_Eav_Block_Adminhtml_Attribute_Edit_Main_Abstract
  */
 protected function _prepareForm()
 {
     $attributeObject = $this->getAttributeObject();
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('eav')->__('Attribute Properties')));
     if ($attributeObject->getAttributeId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $this->_addElementTypes($fieldset);
     $yesno = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $validateClass = sprintf('validate-code validate-length maximum-length-%d', Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH);
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('eav')->__('Attribute Code'), 'title' => Mage::helper('eav')->__('Attribute Code'), 'note' => Mage::helper('eav')->__('For internal use. Must be unique with no spaces. Maximum length of attribute code must be less then %s symbols', Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH), 'class' => $validateClass, 'required' => true));
     $inputTypes = Mage::getModel('eav/adminhtml_system_config_source_inputtype')->toOptionArray();
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('eav')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('eav')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => $inputTypes));
     $fieldset->addField('default_value_text', 'text', array('name' => 'default_value_text', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'value' => $attributeObject->getDefaultValue()));
     $fieldset->addField('default_value_yesno', 'select', array('name' => 'default_value_yesno', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'values' => $yesno, 'value' => $attributeObject->getDefaultValue()));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('default_value_date', 'date', array('name' => 'default_value_date', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'value' => $attributeObject->getDefaultValue(), 'format' => $dateFormatIso));
     $fieldset->addField('default_value_textarea', 'textarea', array('name' => 'default_value_textarea', 'label' => Mage::helper('eav')->__('Default Value'), 'title' => Mage::helper('eav')->__('Default Value'), 'value' => $attributeObject->getDefaultValue()));
     $fieldset->addField('is_unique', 'select', array('name' => 'is_unique', 'label' => Mage::helper('eav')->__('Unique Value'), 'title' => Mage::helper('eav')->__('Unique Value (not shared with other products)'), 'note' => Mage::helper('eav')->__('Not shared with other products'), 'values' => $yesno));
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('eav')->__('Values Required'), 'title' => Mage::helper('eav')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('eav')->__('Input Validation for Store Owner'), 'title' => Mage::helper('eav')->__('Input Validation for Store Owner'), 'values' => Mage::helper('eav')->getFrontendClasses($attributeObject->getEntityType()->getEntityTypeCode())));
     if ($attributeObject->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
         if (!$attributeObject->getIsUserDefined()) {
             $form->getElement('is_unique')->setDisabled(1);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }