当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Data_Form::getElement方法代码示例

本文整理汇总了PHP中Varien_Data_Form::getElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::getElement方法的具体用法?PHP Varien_Data_Form::getElement怎么用?PHP Varien_Data_Form::getElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Data_Form的用法示例。


在下文中一共展示了Varien_Data_Form::getElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initForm

 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_credit');
     $customer = Mage::registry('current_customer');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('credit')->__('Credit Information')));
     $fieldset->addField('credit', 'text', array('label' => Mage::helper('credit')->__('Credit'), 'name' => 'credit'));
     $fieldset->addField('amount_credit', 'text', array('label' => Mage::helper('credit')->__('Amount of Credits'), 'name' => 'amount_credit', 'note' => Mage::helper('catalog')->__('Number of Credits which you want to add or subtract'), 'class' => 'validate-number'));
     $yesnoSource = Mage::getModel('adminhtml/system_config_source_yesno')->toOptionArray();
     $fieldset->addField('is_refund_product', 'select', array('name' => 'is_refund_product', 'label' => Mage::helper('catalog')->__('Product Refunding'), 'title' => Mage::helper('catalog')->__('Product Refunding'), 'note' => Mage::helper('catalog')->__('Default is No. Choose Yes if is refund product'), 'values' => $yesnoSource));
     $fieldset->addField('creditmemo', 'select', array('name' => 'creditmemo', 'label' => Mage::helper('catalog')->__('Credit Memo'), 'title' => Mage::helper('catalog')->__('Credit Memo'), 'values' => $this->_getCreditmemo()));
     if ($customer->isReadonly()) {
         $form->getElement('credit')->setReadonly(true, true);
     }
     if (Mage::registry('current_customer')) {
         $credit = Mage::getModel('credit/creditcustomer')->load($customer->getId())->getData('credit');
         $form->getElement('credit')->setValue($credit);
     }
     // if not exist credit memo
     if (!$this->_getCreditmemo()) {
         $form->getElement('is_refund_product')->setDisabled(1);
         $form->getElement('creditmemo')->setDisabled(1);
     }
     $form->getElement('credit')->setDisabled(1);
     $this->setForm($form);
     return $this;
 }
开发者ID:liemnv,项目名称:Groupon-Clone-On-Magento,代码行数:27,代码来源:Credit.php

示例2: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $prefix = '_customerbalance';
     $form->setHtmlIdPrefix($prefix);
     $form->setFieldNameSuffix('customerbalance');
     $customer = Mage::getModel('customer/customer')->load($this->getRequest()->getParam('id'));
     /** @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $form->addFieldset('storecreidt_fieldset', array('legend' => Mage::helper('enterprise_customerbalance')->__('Update Balance')));
     if (!Mage::getSingleton('enterprise_customerbalance/balance')->shouldCustomerHaveOneBalance($customer)) {
         $fieldset->addField('website_id', 'select', array('name' => 'website_id', 'label' => Mage::helper('enterprise_customerbalance')->__('Website'), 'title' => Mage::helper('enterprise_customerbalance')->__('Website'), 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(), 'onchange' => 'updateEmailWebsites()'));
     }
     $fieldset->addField('amount_delta', 'text', array('name' => 'amount_delta', 'label' => Mage::helper('enterprise_customerbalance')->__('Update Balance'), 'title' => Mage::helper('enterprise_customerbalance')->__('Update Balance'), 'comment' => Mage::helper('enterprise_customerbalance')->__('An amount on which to change the balance')));
     $fieldset->addField('notify_by_email', 'checkbox', array('name' => 'notify_by_email', 'label' => Mage::helper('enterprise_customerbalance')->__('Notify Customer by Email'), 'title' => Mage::helper('enterprise_customerbalance')->__('Notify Customer by Email'), 'after_element_html' => '<script type="text/javascript">' . "\n                updateEmailWebsites();\n                \$('{$prefix}notify_by_email').disableSendemail = function() {\n                    \$('{$prefix}store_id').disabled = (this.checked) ? false : true;\n                }.bind(\$('{$prefix}notify_by_email'));\n                Event.observe('{$prefix}notify_by_email', 'click', \$('{$prefix}notify_by_email').disableSendemail);\n                \$('{$prefix}notify_by_email').disableSendemail();\n                " . '</script>'));
     $field = $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => Mage::helper('enterprise_customerbalance')->__('Send Email Notification From the Following Store View'), 'title' => Mage::helper('enterprise_customerbalance')->__('Send Email Notification From the Following Store View')));
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
     $field->setRenderer($renderer);
     $fieldset->addField('comment', 'text', array('name' => 'comment', 'label' => Mage::helper('enterprise_customerbalance')->__('Comment'), 'title' => Mage::helper('enterprise_customerbalance')->__('Comment'), 'comment' => Mage::helper('enterprise_customerbalance')->__('Comment')));
     if ($customer->isReadonly()) {
         if ($form->getElement('website_id')) {
             $form->getElement('website_id')->setReadonly(true, true);
         }
         $form->getElement('store_id')->setReadonly(true, true);
         $form->getElement('amount_delta')->setReadonly(true, true);
         $form->getElement('notify_by_email')->setReadonly(true, true);
     }
     $form->setValues($customer->getData());
     $this->setForm($form);
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:30,代码来源:Form.php

示例3: _prepareForm

 /**
  * Preparing form elements for editing Entity Type
  *
  * @return $this
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post'));
     $entityType = Mage::registry('etm_entity_type');
     $fieldSet = $form->addFieldset('entity_type_data', array('class' => 'fieldset-wide', 'legend' => Mage::helper('goodahead_etm')->__('General')));
     $validateClass = sprintf('required-entry validate-code validate-length maximum-length-%d', Goodahead_Core_Helper_Data::getConstValue('Mage_Eav_Model_Entity_Attribute::ATTRIBUTE_CODE_MAX_LENGTH', 50));
     $fieldSet->addField('entity_type_code', 'text', array('label' => Mage::helper('goodahead_etm')->__('Entity Type Code'), 'name' => 'entity_type_code', 'class' => $validateClass, 'required' => true));
     $fieldSet->addField('entity_type_name', 'text', array('label' => Mage::helper('goodahead_etm')->__('Entity Type Name'), 'name' => 'entity_type_name', 'class' => 'required-entry', 'required' => true));
     if ($entityType->getId()) {
         //            $form->addField('entity_type_id', 'hidden', array(
         //                'name' => 'entity_type_id',
         //            ));
         // TODO: Rework
         $entityTypeAttributes = Mage::getModel('goodahead_etm/source_entity_attribute')->toOptionsArrayWithoutExcludedTypes($entityType, true, array('boolean', 'multiselect', 'select', 'image', 'static'));
         $fieldSet->addField('default_attribute_id', 'select', array('label' => Mage::helper('goodahead_etm')->__('Default Attribute'), 'name' => 'default_attribute_id', 'required' => false, 'values' => $entityTypeAttributes, 'note' => Mage::helper('goodahead_etm')->__('This attribute is used to display entity label')), 'entity_type_name');
         $form->getElement('entity_type_code')->setReadonly('readonly');
         $form->getElement('entity_type_code')->setDisabled(1);
         Mage::dispatchEvent('goodahead_etm_entity_types_edit_prepare_form_main_section', array('form' => $form));
         $form->setValues($entityType->getData());
     } else {
         Mage::dispatchEvent('goodahead_etm_entity_types_edit_prepare_form_main_section', array('form' => $form));
     }
     $form->setFieldNameSuffix('data');
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:eniuz,项目名称:entitytype-manager,代码行数:31,代码来源:Form.php

示例4: initForm

 public function initForm()
 {
     $customer = Mage::registry('current_customer');
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('address_fieldset', array('legend' => Mage::helper('customer')->__("Edit Customer's Address")));
     $addressModel = Mage::getModel('customer/address');
     $this->_setFieldset($addressModel->getAttributes(), $fieldset);
     if ($streetElement = $form->getElement('street')) {
         $streetElement->setLineCount(Mage::helper('customer/address')->getStreetLines());
     }
     if ($regionElement = $form->getElement('region')) {
         $regionElement->setRenderer(Mage::getModel('adminhtml/customer_renderer_region'));
     }
     if ($regionElement = $form->getElement('region_id')) {
         $regionElement->setNoDisplay(true);
     }
     if ($country = $form->getElement('country_id')) {
         $country->addClass('countries');
     }
     if ($this->isReadonly()) {
         foreach ($addressModel->getAttributes() as $attribute) {
             $element = $form->getElement($attribute->getAttributeCode());
             if ($element) {
                 $element->setReadonly(true, true);
             }
         }
     }
     $addressCollection = $customer->getAddresses();
     $this->assign('customer', $customer);
     $this->assign('addressCollection', $addressCollection);
     $this->setForm($form);
     return $this;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:33,代码来源:Addresses.php

示例5: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('animation');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'method' => 'post'));
     if ($model->getId()) {
         $model->setData('anim_id', $model->getId());
         $form->addField('anim_id', 'hidden', array('name' => 'id'));
     }
     $fieldset = $form->addFieldset('animation_fieldset', array('legend' => $this->helper('revslider')->__('Animation Settings')));
     $fieldset->addField('anim_preview', 'text', array('note' => Mage::helper('revslider')->__('Preview Transition (Speed, Easing, Split Text and Spit Delay only for preview)')));
     $form->getElement('anim_preview')->setRenderer($this->getLayout()->createBlock('revslider/adminhtml_widget_form_animation_preview'));
     $fieldset->addField('name', 'text', array('name' => 'anim-name', 'label' => Mage::helper('revslider')->__('Animation Name'), 'title' => Mage::helper('revslider')->__('Animation Name'), 'class' => 'required-entry'));
     $fieldset->addField('anim_speed', 'text', array('label' => Mage::helper('revslider')->__('Speed'), 'title' => Mage::helper('revslider')->__('(ms)'), 'value' => 500));
     $fieldset->addField('anim_easing', 'select', array('label' => Mage::helper('revslider')->__('Easing'), 'title' => Mage::helper('revslider')->__('Easing'), 'values' => Mage::getModel('revslider/slide')->getLayerEaseOptions()));
     $fieldset->addField('anim_split', 'select', array('label' => Mage::helper('revslider')->__('Split Text Per'), 'title' => Mage::helper('revslider')->__('Split Text Per'), 'values' => Mage::getModel('revslider/slide')->getLayerAnimationSplitOptions()));
     $fieldset->addField('anim_splitdelay', 'text', array('label' => Mage::helper('revslider')->__('Split Delay (ms)'), 'title' => Mage::helper('revslider')->__('Split Delay (ms)'), 'value' => 10));
     $fieldset->addField('anim_settings', 'text', array());
     $form->getElement('anim_settings')->setRenderer($this->getLayout()->createBlock('revslider/adminhtml_widget_form_animation_settings'));
     $form->setUseContainer(true);
     if ($model->getId()) {
         $form->setValues($model->getData());
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:25,代码来源:Form.php

示例6: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('googleoptimizer_fields', array('legend' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Google Optimizer Scripts')));
     if ($this->getProduct()->getStoreId() == '0') {
         Mage::helper('Mage_GoogleOptimizer_Helper_Data')->setStoreId(Mage::app()->getDefaultStoreView());
     } else {
         Mage::helper('Mage_GoogleOptimizer_Helper_Data')->setStoreId($this->getProduct()->getStoreId());
     }
     $disabledScriptsFields = false;
     $values = array();
     if ($this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getData()) {
         $disabledScriptsFields = true;
         $values = $this->getGoogleOptimizer()->getData();
         $checkedUseDefault = true;
         if ($this->getGoogleOptimizer()->getStoreId() == $this->getProduct()->getStoreId()) {
             $checkedUseDefault = false;
             $disabledScriptsFields = false;
             $fieldset->addField('code_id', 'hidden', array('name' => 'code_id'));
         }
         // show 'use default' checkbox if store different for default and product has scripts for default store
         if ($this->getProduct()->getStoreId() != '0') {
             $fieldset->addField('store_flag', 'checkbox', array('name' => 'store_flag', 'value' => '1', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Use Default Values'), 'class' => 'checkbox', 'required' => false, 'onchange' => 'googleOptimizerScopeAction()'))->setIsChecked($checkedUseDefault);
         }
     }
     $fieldset->addField('conversion_page', 'select', array('name' => 'conversion_page', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page'), 'values' => Mage::getModel('Mage_GoogleOptimizer_Model_Adminhtml_System_Config_Source_Googleoptimizer_Conversionpages')->toOptionArray(), 'class' => 'select googleoptimizer validate-googleoptimizer', 'required' => false, 'onchange' => 'googleOptimizerConversionPageAction(this)'));
     if ($this->getProduct()->getStoreId() == '0' && !Mage::app()->hasSingleStore()) {
         $fieldset->addField('conversion_page_url', 'note', array('name' => 'conversion_page_url', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page URL'), 'text' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Please select store view to see the URL.')));
     } else {
         $fieldset->addField('conversion_page_url', 'text', array('name' => 'conversion_page_url', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page URL'), 'class' => 'input-text', 'readonly' => 'readonly', 'required' => false, 'note' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Please copy and paste this value to experiment edit form.')));
     }
     $fieldset->addField('export_controls', 'text', array('name' => 'export_controls'));
     $fieldset->addField('control_script', 'textarea', array('name' => 'control_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Control Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $fieldset->addField('tracking_script', 'textarea', array('name' => 'tracking_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Tracking Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $fieldset->addField('conversion_script', 'textarea', array('name' => 'conversion_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $attributes = Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getProductAttributes($this->getProduct());
     $fieldset->addField('attributes', 'multiselect', array('name' => 'attributes', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Attributes'), 'class' => 'googleoptimizer validate-googleoptimizer validate-googleoptimizer-attributes', 'values' => $attributes, 'required' => false, 'onchange' => 'googleOptimizerAttributesCheckAction(this)', 'note' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('The limit is 8 attributes only.')));
     if (Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getConversionPagesUrl() && $this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getConversionPage()) {
         $form->getElement('conversion_page_url')->setValue(Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getConversionPagesUrl()->getData($this->getGoogleOptimizer()->getConversionPage()));
     }
     if ($disabledScriptsFields) {
         foreach ($fieldset->getElements() as $element) {
             if ($element->getType() == 'textarea' || $element->getType() == 'select') {
                 $element->setDisabled($disabledScriptsFields);
             }
         }
         $form->getElement('export_controls')->setDisabled($disabledScriptsFields);
     }
     $fakeEntityAttribute = Mage::getModel('Mage_Catalog_Model_Resource_Eav_Attribute');
     foreach ($fieldset->getElements() as $element) {
         if ($element->getId() != 'store_flag') {
             $element->setEntityAttribute($fakeEntityAttribute);
         }
     }
     $form->getElement('export_controls')->setRenderer($this->getLayout()->createBlock('Mage_GoogleOptimizer_Block_Adminhtml_Catalog_Form_Renderer_Import'));
     $form->addValues($values);
     $form->setFieldNameSuffix('googleoptimizer');
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:natxetee,项目名称:magento2,代码行数:60,代码来源:Googleoptimizer.php

示例7: _prepareForm

 /**
  * 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();
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:37,代码来源:Abstract.php

示例8: _prepareForm

 /**
  * Prepare attributes form
  *
  * @return null
  */
 protected function _prepareForm()
 {
     $group = $this->getGroup();
     if ($group) {
         $form = new Varien_Data_Form();
         // Initialize product object as form property to use it during elements generation
         $form->setDataObject(Mage::registry('product'));
         $fieldset = $form->addFieldset('group_fields' . $group->getId(), array('legend' => Mage::helper('catalog')->__($group->getAttributeGroupName()), 'class' => 'fieldset-wide'));
         $attributes = $this->getGroupAttributes();
         $this->_setFieldset($attributes, $fieldset, array('gallery'));
         $urlKey = $form->getElement('url_key');
         if ($urlKey) {
             $urlKey->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_form_renderer_attribute_urlkey'));
         }
         $tierPrice = $form->getElement('tier_price');
         if ($tierPrice) {
             $tierPrice->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_tier'));
         }
         $groupPrice = $form->getElement('group_price');
         if ($groupPrice) {
             $groupPrice->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_group'));
         }
         $recurringProfile = $form->getElement('recurring_profile');
         if ($recurringProfile) {
             $recurringProfile->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_recurring'));
         }
         // Add new attribute button if it is not an image tab
         if (!$form->getElement('media_gallery') && Mage::getSingleton('admin/session')->isAllowed('catalog/attributes/attributes')) {
             $headerBar = $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_attributes_create');
             $headerBar->getConfig()->setTabId('group_' . $group->getId())->setGroupId($group->getId())->setStoreId($form->getDataObject()->getStoreId())->setAttributeSetId($form->getDataObject()->getAttributeSetId())->setTypeId($form->getDataObject()->getTypeId())->setProductId($form->getDataObject()->getId());
             $fieldset->setHeaderBar($headerBar->toHtml());
         }
         if ($form->getElement('meta_description')) {
             $form->getElement('meta_description')->setOnkeyup('checkMaxLength(this, 255);');
         }
         $values = Mage::registry('product')->getData();
         // Set default attribute values for new product
         if (!Mage::registry('product')->getId()) {
             foreach ($attributes as $attribute) {
                 if (!isset($values[$attribute->getAttributeCode()])) {
                     $values[$attribute->getAttributeCode()] = $attribute->getDefaultValue();
                 }
             }
         }
         if (Mage::registry('product')->hasLockedAttributes()) {
             foreach (Mage::registry('product')->getLockedAttributes() as $attribute) {
                 $element = $form->getElement($attribute);
                 if ($element) {
                     $element->setReadonly(true, true);
                 }
             }
         }
         $form->addValues($values);
         $form->setFieldNameSuffix('product');
         Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
         $this->setForm($form);
     }
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:63,代码来源:Attributes.php

示例9: initForm

 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_account');
     $form->setFieldNameSuffix('account');
     $customer = AO::registry('current_customer');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => AO::helper('customer')->__('Account Information')));
     $this->_setFieldset($customer->getAttributes(), $fieldset);
     if ($customer->getId()) {
         $form->getElement('website_id')->setDisabled('disabled');
         $form->getElement('created_in')->setDisabled('disabled');
     } else {
         $fieldset->removeField('created_in');
     }
     $form->getElement('email')->addClass('validate-email');
     //        if (AO::app()->isSingleStoreMode()) {
     //            $fieldset->removeField('website_id');
     //            $fieldset->addField('website_id', 'hidden', array(
     //                'name'      => 'website_id'
     //            ));
     //            $customer->setWebsiteId(AO::app()->getStore(true)->getWebsiteId());
     //        }
     if ($customer->getId()) {
         // add password management fieldset
         $newFieldset = $form->addFieldset('password_fieldset', array('legend' => AO::helper('customer')->__('Password Management')));
         // New customer password
         $field = $newFieldset->addField('new_password', 'text', array('label' => AO::helper('customer')->__('New Password'), 'name' => 'new_password', 'class' => 'validate-new-password'));
         $field->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_newpass'));
         // prepare customer confirmation control (only for existing customers)
         $confirmationKey = $customer->getConfirmation();
         if ($confirmationKey || $customer->isConfirmationRequired()) {
             $confirmationAttribute = $customer->getAttribute('confirmation');
             if (!$confirmationKey) {
                 $confirmationKey = $customer->getRandomConfirmationKey();
             }
             $element = $fieldset->addField('confirmation', 'select', array('name' => 'confirmation', 'label' => AO::helper('customer')->__($confirmationAttribute->getFrontendLabel())))->setEntityAttribute($confirmationAttribute)->setValues(array('' => 'Confirmed', $confirmationKey => 'Not confirmed'));
             // prepare send welcome email checkbox, if customer is not confirmed
             // no need to add it, if website id is empty
             if ($customer->getConfirmation() && $customer->getWebsiteId()) {
                 $fieldset->addField('sendemail', 'checkbox', array('name' => 'sendemail', 'label' => AO::helper('customer')->__('Send Welcome Email after Confirmation')));
             }
         }
     } else {
         $newFieldset = $form->addFieldset('password_fieldset', array('legend' => AO::helper('customer')->__('Password Management')));
         $field = $newFieldset->addField('password', 'text', array('label' => AO::helper('customer')->__('Password'), 'class' => 'input-text required-entry validate-password', 'name' => 'password', 'required' => true));
         $field->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_newpass'));
         // prepare send welcome email checkbox
         $fieldset->addField('sendemail', 'checkbox', array('label' => AO::helper('customer')->__('Send welcome email'), 'name' => 'sendemail', 'id' => 'sendemail'));
     }
     // make sendemail disabled, if website_id has empty value
     if ($sendemail = $form->getElement('sendemail')) {
         $prefix = $form->getHtmlIdPrefix();
         $sendemail->setAfterElementHtml('<script type="text/javascript">' . "\n                \$('{$prefix}website_id').disableSendemail = function() {\n                    \$('{$prefix}sendemail').disabled = ('' == this.value || '0' == this.value);\n                }.bind(\$('{$prefix}website_id'));\n                Event.observe('{$prefix}website_id', 'click', \$('{$prefix}website_id').disableSendemail);\n                \$('{$prefix}website_id').disableSendemail();\n                " . '</script>');
     }
     $form->setValues($customer->getData());
     $this->setForm($form);
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:58,代码来源:Customer_Edit_Tab_Account.php

示例10: _prepareForm

 protected function _prepareForm()
 {
     $data = Mage::registry('followupemail_data');
     if (is_object($data)) {
         $data = $data->getData();
     }
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('general', array('legend' => $this->__('Rule')));
     # title field
     $fieldset->addField('title', 'text', array('label' => $this->__('Title'), 'name' => 'title', 'required' => true));
     # is_active field
     $fieldset->addField('is_active', 'select', array('label' => $this->__('Status'), 'name' => 'is_active', 'values' => AW_Followupemail_Model_Source_Rule_Status::toOptionArray()));
     # active from field
     $outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     try {
         if (isset($data['active_from']) && !empty($data['active_from'])) {
             $data['active_from'] = Mage::app()->getLocale()->date($data['active_from'], Varien_Date::DATETIME_INTERNAL_FORMAT);
         }
     } catch (Exception $e) {
         unset($data['active_from']);
         throw $e;
     }
     $fieldset->addField('active_from', 'date', array('label' => Mage::helper('followupemail')->__('Rule active from'), 'name' => 'active_from', 'title' => $this->__('Rule active from'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $outputFormat, 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT, 'time' => true, 'required' => false, 'note' => $this->__('Leave empty for unlimited usage')));
     # active to field
     try {
         if (isset($data['active_to']) && !empty($data['active_to'])) {
             $data['active_to'] = Mage::app()->getLocale()->date($data['active_to'], Varien_Date::DATETIME_INTERNAL_FORMAT);
         }
     } catch (Exception $e) {
         unset($data['active_to']);
         throw $e;
     }
     $fieldset->addField('active_to', 'date', array('label' => Mage::helper('followupemail')->__('Rule active to'), 'name' => 'active_to', 'title' => $this->__('Rule active to'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $outputFormat, 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT, 'time' => true, 'required' => false, 'note' => $this->__('Leave empty for unlimited usage')));
     # event_type field
     $fieldset->addField('event_type', 'select', array('label' => $this->__('Event'), 'name' => 'event_type', 'values' => IWE_EmailReminder_Model_Source_Rule_Types::toOptionArray(), 'required' => true, 'onchange' => 'checkEventType()'));
     # cancel_events field
     $fieldset->addField('cancel_events', 'multiselect', array('label' => $this->__('Cancellation events'), 'name' => 'cancel_events[]', 'values' => AW_Followupemail_Model_Source_Rule_Types::toOptionArray(TRUE), 'note' => $this->__('Once selected event(s) happen they cancel email sending for the object')));
     /* Adding the sales rept list */
     # event_type field
     $fieldset->addField('sales_rep_id', 'select', array('label' => $this->__('Sales Rep'), 'name' => 'sales_rep_id', 'values' => $this->getSalesPersonList(), 'required' => true));
     # customer_groups field
     $fieldset->addField('customer_groups', 'multiselect', array('name' => 'customer_groups[]', 'label' => $this->__('Customer groups'), 'title' => $this->__('Customer groups'), 'required' => true, 'values' => AW_Followupemail_Model_Source_Customer_Group::toOptionArray()));
     # sku field
     $fieldset->addField('sku', 'text', array('label' => $this->__('SKU'), 'name' => 'sku', 'note' => $this->__('Separate multiple SKUs by commas')));
     # sale_amount_value field
     $fieldset->addField('sale_amount_value', 'select', array('label' => $this->__('Sale amount'), 'name' => 'sale_amount_value', 'value' => $data['sale_amount_value'], 'condition' => $data['sale_amount_condition'], 'conditions' => Mage::getModel('followupemail/source_rule_saleamount')->toOptionArray(true)));
     $form->getElement('sale_amount_value')->setRenderer($this->getLayout()->createBlock('followupemail/adminhtml_rule_edit_tab_details_saleamount'));
     # chain field
     $fieldset->addField('chain', 'text', array('label' => $this->__('Email chain'), 'name' => 'chain', 'required' => true, 'class' => 'requried-entry'));
     $form->getElement('chain')->setRenderer($this->getLayout()->createBlock('followupemail/adminhtml_rule_edit_tab_details_chain'));
     $form->setValues($data);
     $this->setForm($form);
     return $this;
 }
开发者ID:ngagestudios,项目名称:emailreminders,代码行数:54,代码来源:General.php

示例11: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('entity_attribute');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('Attribute Properties')));
     if ($model->getAttributeId()) {
         $fieldset->addField('attribute_id', 'hidden', array('name' => 'attribute_id'));
     }
     $yesno = array(array('value' => 0, 'label' => Mage::helper('catalog')->__('No')), array('value' => 1, 'label' => Mage::helper('catalog')->__('Yes')));
     $fieldset->addField('attribute_code', 'text', array('name' => 'attribute_code', 'label' => Mage::helper('catalog')->__('Attribute Identifier'), 'title' => Mage::helper('catalog')->__('Attribute Identifier'), 'note' => Mage::helper('catalog')->__('For internal use. Must be unique with no spaces'), 'class' => 'validate-code', 'required' => true));
     $fieldset->addField('is_global', 'select', array('name' => 'is_global', 'label' => Mage::helper('catalog')->__('Scope'), 'title' => Mage::helper('catalog')->__('Scope'), 'note' => Mage::helper('catalog')->__('Declare atrribute value saving scope'), 'values' => array(Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE => Mage::helper('catalog')->__('Store View'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_WEBSITE => Mage::helper('catalog')->__('Website'), Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL => Mage::helper('catalog')->__('Global'))));
     $fieldset->addField('frontend_input', 'select', array('name' => 'frontend_input', 'label' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'title' => Mage::helper('catalog')->__('Catalog Input Type for Store Owner'), 'value' => 'text', 'values' => array(array('value' => 'text', 'label' => Mage::helper('catalog')->__('Text Field')), array('value' => 'textarea', 'label' => Mage::helper('catalog')->__('Text Area')), array('value' => 'date', 'label' => Mage::helper('catalog')->__('Date')), array('value' => 'boolean', 'label' => Mage::helper('catalog')->__('Yes/No')), array('value' => 'multiselect', 'label' => Mage::helper('catalog')->__('Multiple Select')), array('value' => 'select', 'label' => Mage::helper('catalog')->__('Dropdown')), array('value' => 'price', 'label' => Mage::helper('catalog')->__('Price')), array('value' => 'image', 'label' => Mage::helper('catalog')->__('Image')), array('value' => 'gallery', 'label' => Mage::helper('catalog')->__('Gallery')), array('value' => 'media_image', 'label' => Mage::helper('catalog')->__('Media Image')))));
     $fieldset->addField('default_value_text', 'text', array('name' => 'default_value_text', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_yesno', 'select', array('name' => 'default_value_yesno', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'values' => $yesno, 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_date', 'date', array('name' => 'default_value_date', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('default_value_textarea', 'textarea', array('name' => 'default_value_textarea', 'label' => Mage::helper('catalog')->__('Default value'), 'title' => Mage::helper('catalog')->__('Default value'), 'value' => $model->getDefaultValue()));
     $fieldset->addField('is_unique', 'select', array('name' => 'is_unique', 'label' => Mage::helper('catalog')->__('Unique Value'), 'title' => Mage::helper('catalog')->__('Unique Value (not shared with other products)'), 'note' => Mage::helper('catalog')->__('Not shared with other products'), 'values' => $yesno));
     $fieldset->addField('is_required', 'select', array('name' => 'is_required', 'label' => Mage::helper('catalog')->__('Values Required'), 'title' => Mage::helper('catalog')->__('Values Required'), 'values' => $yesno));
     $fieldset->addField('frontend_class', 'select', array('name' => 'frontend_class', 'label' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'title' => Mage::helper('catalog')->__('Input Validation for Store Owner'), 'values' => array(array('value' => '', 'label' => Mage::helper('catalog')->__('None')), array('value' => 'validate-number', 'label' => Mage::helper('catalog')->__('Decimal Number')), array('value' => 'validate-digits', 'label' => Mage::helper('catalog')->__('Integer Number')), array('value' => 'validate-email', 'label' => Mage::helper('catalog')->__('Email')), array('value' => 'validate-url', 'label' => Mage::helper('catalog')->__('Url')), array('value' => 'validate-alpha', 'label' => Mage::helper('catalog')->__('Letters')), array('value' => 'validate-alphanum', 'label' => Mage::helper('catalog')->__('Letters(a-z) or Numbers(0-9)')))));
     /*
             $fieldset->addField('use_in_super_product', 'select', array(
                 'name' => 'use_in_super_product',
                 'label' => Mage::helper('catalog')->__('Apply To Configurable/Grouped Product'),
                 'values' => $yesno,
             )); */
     $fieldset->addField('apply_to', 'multiselect', array('name' => 'apply_to[]', 'label' => Mage::helper('catalog')->__('Apply To'), 'values' => Mage_Catalog_Model_Product_Type::getOptions(), 'value' => array(Mage_Catalog_Model_Product_Type::DEFAULT_TYPE), 'required' => true));
     $fieldset->addField('is_configurable', 'select', array('name' => 'is_configurable', 'label' => Mage::helper('catalog')->__('Use To Create Configurable Product'), 'values' => $yesno));
     // -----
     // frontend properties fieldset
     $fieldset = $form->addFieldset('front_fieldset', array('legend' => Mage::helper('catalog')->__('Frontend Properties')));
     $fieldset->addField('is_searchable', 'select', array('name' => 'is_searchable', 'label' => Mage::helper('catalog')->__('Use in quick search'), 'title' => Mage::helper('catalog')->__('Use in quick search'), 'values' => $yesno));
     $fieldset->addField('is_visible_in_advanced_search', 'select', array('name' => 'is_visible_in_advanced_search', 'label' => Mage::helper('catalog')->__('Use in advanced search'), 'title' => Mage::helper('catalog')->__('Use in advanced search'), 'values' => $yesno));
     $fieldset->addField('is_comparable', 'select', array('name' => 'is_comparable', 'label' => Mage::helper('catalog')->__('Comparable on Front-end'), 'title' => Mage::helper('catalog')->__('Comparable on Front-end'), 'values' => $yesno));
     $fieldset->addField('is_filterable', 'select', array('name' => 'is_filterable', 'label' => Mage::helper('catalog')->__("Use In Layered Navigation"), 'title' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown'), 'note' => Mage::helper('catalog')->__('Can be used only with catalog input type Dropdown'), 'values' => array(array('value' => '0', 'label' => Mage::helper('catalog')->__('No')), array('value' => '1', 'label' => Mage::helper('catalog')->__('Filterable (with results)')), array('value' => '2', 'label' => Mage::helper('catalog')->__('Filterable (no results)')))));
     if ($model->getIsUserDefined() || !$model->getId()) {
         $fieldset->addField('is_visible_on_front', 'select', array('name' => 'is_visible_on_front', 'label' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'), 'title' => Mage::helper('catalog')->__('Visible on Catalog Pages on Front-end'), 'values' => $yesno));
     }
     if ($model->getId()) {
         $form->getElement('attribute_code')->setDisabled(1);
         $form->getElement('frontend_input')->setDisabled(1);
     }
     if (!$model->getIsUserDefined() && $model->getId()) {
         $form->getElement('is_unique')->setDisabled(1);
     }
     $form->addValues($model->getData());
     if ($model->getApplyTo()) {
         $form->getElement('apply_to')->setValue(explode(',', $model->getApplyTo()));
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:51,代码来源:Main.php

示例12: _prepareForm

 protected function _prepareForm()
 {
     if ($group = $this->getGroup()) {
         $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' . $group->getId(), array('legend' => Mage::helper('catalog')->__($group->getAttributeGroupName())));
         $attributes = $this->getGroupAttributes();
         $this->_setFieldset($attributes, $fieldset, array('gallery'));
         if ($tierPrice = $form->getElement('tier_price')) {
             $tierPrice->setRenderer($this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_price_tier'));
         }
         /**
          * Add new attribute button if not image tab
          */
         if (!$form->getElement('media_gallery') && Mage::getSingleton('admin/session')->isAllowed('catalog/attributes/attributes')) {
             $headerBar = $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_attributes_create');
             $headerBar->getConfig()->setTabId('group_' . $group->getId())->setGroupId($group->getId())->setStoreId($form->getDataObject()->getStoreId())->setAttributeSetId($form->getDataObject()->getAttributeSetId())->setTypeId($form->getDataObject()->getTypeId())->setProductId($form->getDataObject()->getId());
             $fieldset->setHeaderBar($headerBar->toHtml());
         }
         if ($form->getElement('meta_description')) {
             $form->getElement('meta_description')->setOnkeyup('checkMaxLength(this, 255);');
         }
         $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();
                 }
             }
         }
         if (Mage::registry('product')->hasLockedAttributes()) {
             foreach (Mage::registry('product')->getLockedAttributes() as $attribute) {
                 if ($element = $form->getElement($attribute)) {
                     $element->setReadonly(true, true);
                 }
             }
         }
         Mage::dispatchEvent('adminhtml_catalog_product_edit_prepare_form', array('form' => $form));
         $form->addValues($values);
         $form->setFieldNameSuffix('product');
         $this->setForm($form);
     }
 }
开发者ID:jauderho,项目名称:magento-mirror,代码行数:50,代码来源:Attributes.php

示例13: _prepareForm

 protected function _prepareForm()
 {
     $customer = Mage::registry('current_customer');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_account');
     $form->setFieldNameSuffix('account');
     $customerForm = Mage::getModel('customer/form');
     $customerForm->setEntity($customer)->setFormCode('wholesale')->initDefaultValues();
     $attributes = $customerForm->getAttributes();
     foreach ($attributes as $attribute) {
         $attribute->setFrontendLabel(Mage::helper('customer')->__($attribute->getFrontend()->getLabel()));
         $attribute->unsIsVisible();
     }
     $fieldset = $form->addFieldset('dealer_fieldset', array('legend' => Mage::helper('customer')->__('Dealer Information')));
     $this->_setFieldset($attributes, $fieldset, array('application'));
     /**
     		if(Vikont_Wholesale_Model_Source_Dealer_Status::CANDIDATE == $customer->getData(Vikont_Wholesale_Helper_Data::ATTR_DEALER_STATUS)) {
     
     			$buttonsHtml = $this->getLayout()->createBlock('adminhtml/template')
     					->setTemplate('vk_wholesale/customer/edit/tab/wholesale/action.phtml')
     					->toHtml();
     
     			$form->getElement('dealer_status')
     					->setAfterElementHtml($buttonsHtml);
     		} /**/
     $notifyCheckboxHtml = '<div class="wsa-customer-notifycustomer-container"><input type="checkbox" name="account[dealer_status_customer_notify]" checked="checked" value="1" id="dealer_status_customer_notify"><label for="dealer_status_customer_notify">' . $this->__('Notify customer on dealer status changed') . '</label></div>';
     $form->getElement('dealer_status')->setAfterElementHtml($notifyCheckboxHtml);
     $form->getElement('dealer_cost')->addClass('validate-number')->setNote($this->__('A percentage value over the cost. If not set, the value from customer group will be taken'));
     /**
     // just another way of adding fields. Magento is diverse!
     		$fieldset->addField('dealer_status', 'select', array(
     				'label' => Mage::helper('customer')->__('Dealer status'),
     				'name'  => Vikont_Wholesale_Helper_Data::ATTR_DEALER_STATUS,
     				'values' => Mage::getModel('wholesale/source_dealer_status')->toShortOptionArray(),
     //				'value' => $customer->getData(Vikont_Wholesale_Helper_Data::ATTR_DEALER_STATUS),
     			));
     
     		$fieldset->addField('dealer_cost', 'text', array(
     				'label' => Mage::helper('customer')->__('Dealer cost'),
     				'name'  => Vikont_Wholesale_Helper_Data::ATTR_DEALER_COST,
     				'required' => true,
     				'class' => 'validate-number',
     				'note' => $this->__('A percentage value over the cost. If not set, a customer group setting will be taken'),
     //				'value' => $customer->getData(Vikont_Wholesale_Helper_Data::ATTR_DEALER_COST),
     			));
     /**/
     $form->setValues($customer->getData());
     $this->setForm($form);
     return $this;
 }
开发者ID:rcclaudrey,项目名称:dev,代码行数:50,代码来源:Dealer.php

示例14: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('css');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'method' => 'post'));
     if ($model->getId()) {
         $form->addField('id', 'hidden', array('name' => 'id'));
     }
     $setting = Mage::helper('core')->jsonDecode($model->getSettings());
     if (isset($setting['hover'])) {
         $model->setUsingHover(true);
     }
     $preview = $form->addFieldset('css_preview_fieldset', array('class' => 'no-spacing'));
     $preview->addField('css_preview', 'text', array());
     $form->getElement('css_preview')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_css_preview'));
     $preview->addField('css_state', 'radios', array('name' => 'css_state', 'label' => Mage::helper('dynamicslideshow')->__('State'), 'value' => 1, 'values' => array(array('value' => 1, 'label' => Mage::helper('dynamicslideshow')->__('Normal')), array('value' => 2, 'label' => Mage::helper('dynamicslideshow')->__('Hover')))));
     $preview->addField('css_hover', 'radios', array('name' => 'css_hover', 'label' => Mage::helper('dynamicslideshow')->__('Using Hover'), 'value' => $model->getUsingHover() ? 1 : 2, 'values' => array(array('value' => 1, 'label' => Mage::helper('dynamicslideshow')->__('Yes')), array('value' => 2, 'label' => Mage::helper('dynamicslideshow')->__('No')))));
     $preview->addField('css_mode', 'radios', array('name' => 'css_mode', 'label' => Mage::helper('dynamicslideshow')->__('Edit Mode'), 'value' => 1, 'values' => array(array('value' => 1, 'label' => Mage::helper('dynamicslideshow')->__('Simple')), array('value' => 2, 'label' => Mage::helper('dynamicslideshow')->__('Advanced')))));
     $container = $form->addFieldset('css_container_fieldset', array('class' => 'no-spacing'));
     $advance = $form->addFieldset('css_advance_fieldset', array('class' => 'no-spacing'));
     $f4 = $advance->addFieldset('css_advance_fieldset_content', array('legend' => Mage::helper('dynamicslideshow')->__('Advanced Style')));
     $f4->addField('css_css', 'textarea', array('name' => 'css_css'));
     $form->getElement('css_css')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_code'));
     $left = $container->addFieldset('left_fieldset', array('class' => 'no-spacing'));
     $right = $container->addFieldset('right_fieldset', array('class' => 'no-spacing'));
     // Font Fieldset
     $f1 = $left->addFieldset('css_font_fieldset', array('legend' => Mage::helper('dynamicslideshow')->__('Font'), 'class' => 'popup-half-fieldset'));
     $f1->addField('css_font-family', 'text', array('name' => 'css_font-family', 'label' => Mage::helper('dynamicslideshow')->__('Family')));
     $f1->addField('css_color', 'text', array('name' => 'css_color', 'label' => Mage::helper('dynamicslideshow')->__('Color'), 'class' => 'color {required:false}'));
     $f1->addField('css_padding', 'text', array('name' => 'css_padding[]', 'label' => Mage::helper('dynamicslideshow')->__('Padding'), 'labels' => array(Mage::helper('dynamicslideshow')->__('Top'), Mage::helper('dynamicslideshow')->__('Right'), Mage::helper('dynamicslideshow')->__('Bottom'), Mage::helper('dynamicslideshow')->__('Left')), 'min' => 0, 'max' => 150, 'count' => 4));
     $form->getElement('css_padding')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_four'));
     $f1->addField('css_font-style', 'select', array('name' => 'css_font-style', 'label' => Mage::helper('dynamicslideshow')->__('Style'), 'values' => Mage::getModel('dynamicslideshow/slides')->getOptCssFontStyle()));
     $f1->addField('css_font-size', 'text', array('name' => 'css_font-size', 'label' => Mage::helper('dynamicslideshow')->__('Size'), 'min' => 0, 'max' => 150));
     $form->getElement('css_font-size')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_sliders'));
     $f1->addField('css_line-height', 'text', array('name' => 'css_line-height', 'label' => Mage::helper('dynamicslideshow')->__('Line-Height'), 'min' => 0, 'max' => 180));
     $form->getElement('css_line-height')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_sliders'));
     $f1->addField('css_font-weight', 'text', array('name' => 'css_font-weight', 'label' => Mage::helper('dynamicslideshow')->__('Weight'), 'min' => 100, 'max' => 900, 'step' => 100));
     $form->getElement('css_font-weight')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_sliders'));
     $f1->addField('css_text-decoration', 'select', array('name' => 'css_text-decoration', 'label' => Mage::helper('dynamicslideshow')->__('Decoration'), 'values' => Mage::getModel('dynamicslideshow/slides')->getOptCssDecoration()));
     // Background Fieldset
     $f2 = $right->addFieldset('css_bg_fieldset', array('legend' => Mage::helper('dynamicslideshow')->__('Background'), 'class' => 'popup-half-fieldset'));
     $f2->addField('css_background-color', 'text', array('name' => 'css_background-color', 'label' => Mage::helper('dynamicslideshow')->__('Color'), 'class' => 'color {required:false}'));
     $f2->addField('css_background-transparency', 'text', array('name' => 'css_background-transparency', 'label' => Mage::helper('dynamicslideshow')->__('Transparency'), 'min' => 0, 'max' => 100));
     $form->getElement('css_background-transparency')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_sliders'));
     // Border Fieldset
     $f3 = $right->addFieldset('css_border_fieldset', array('legend' => Mage::helper('dynamicslideshow')->__('Border'), 'class' => 'popup-half-fieldset'));
     $f3->addField('css_border-color', 'text', array('name' => 'css_border-color', 'label' => Mage::helper('dynamicslideshow')->__('Color'), 'class' => 'color {required:false}'));
     $f3->addField('css_border-style', 'select', array('name' => 'css_border-style', 'label' => Mage::helper('dynamicslideshow')->__('Style'), 'values' => Mage::getModel('dynamicslideshow/slides')->getOptCssBorderStyle()));
     $f3->addField('css_border-width', 'text', array('name' => 'css_border-width', 'label' => Mage::helper('dynamicslideshow')->__('Width'), 'min' => 0, 'max' => 25));
     $form->getElement('css_border-width')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_sliders'));
     $f3->addField('css_border-radius', 'text', array('name' => 'css_border-radius[]', 'label' => Mage::helper('dynamicslideshow')->__('Radius'), 'labels' => array(Mage::helper('dynamicslideshow')->__('Top Left'), Mage::helper('dynamicslideshow')->__('Top Right'), Mage::helper('dynamicslideshow')->__('Bottom Right'), Mage::helper('dynamicslideshow')->__('Bottom Left')), 'min' => 0, 'max' => 150, 'count' => 4));
     $form->getElement('css_border-radius')->setRenderer($this->getLayout()->createBlock('dynamicslideshow/adminhtml_widget_form_four'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:mSupply,项目名称:runnable_test_repo,代码行数:55,代码来源:Form.php

示例15: _prepareForm

 protected function _prepareForm()
 {
     $deal = Mage::registry('collpur_deal');
     if (!$deal->getProductId()) {
         $deal->setData('product_id', $this->getRequest()->getParam('product_id'));
         $deal->setData('product_visibility', $this->getRequest()->getParam('product_visibility'));
     }
     $product = Mage::getModel('catalog/product')->load($deal->getProductId());
     if ($product->getId()) {
         $deal->setData('product_name', $product->getName());
         $deal->setData('product_name_label', $product->getName());
     } else {
         throw new Exception('Incorrect product');
     }
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('deal_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('collpur')->__('General Information')));
     if ($deal->getId()) {
         $fieldset->addField('id', 'hidden', array('name' => 'id'));
     }
     $fieldset->addField('product_id', 'hidden', array('name' => 'product_id'));
     $fieldset->addField('product_visibility', 'hidden', array('name' => 'product_visibility'));
     $fieldset->addField('product_name', 'hidden', array('name' => 'product_name'));
     $fieldset->addField('product_name_label', 'label', array('name' => 'product_name_label', 'label' => Mage::helper('collpur')->__('Product name'), 'title' => Mage::helper('collpur')->__('Product name')));
     if (Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_ids', 'hidden', array('name' => 'store_ids[]', 'value' => Mage::app()->getStore()->getId()));
     } else {
         $fieldset->addField('store_ids', 'multiselect', array('name' => 'store_ids[]', 'label' => $this->__('Store view'), 'title' => $this->__('Store view'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     }
     $fieldset->addField('is_active', 'select', array('label' => $this->__('Is active'), 'title' => $this->__('Is active'), 'name' => 'is_active', 'options' => array('1' => $this->__('Yes'), '0' => $this->__('No'))));
     $fieldset->addField('is_featured', 'select', array('label' => $this->__('Is featured'), 'title' => $this->__('Is featured'), 'name' => 'is_featured', 'options' => array('1' => $this->__('Yes'), '0' => $this->__('No'))));
     $fieldset->addField('qty_to_reach_deal', 'text', array('name' => 'qty_to_reach_deal', 'label' => $this->__('Qty to reach deal'), 'title' => $this->__('Qty to reach deal')));
     $fieldset->addField('maximum_allowed_purchases', 'text', array('name' => 'maximum_allowed_purchases', 'label' => $this->__('Maximum allowed purchases'), 'title' => $this->__('Maximum allowed purchases'), 'after_element_html' => 'Leave empty for unlimited'));
     $outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
     $fieldset->addField('available_from', 'date', array('name' => 'available_from', 'label' => $this->__('Available from'), 'title' => $this->__('Available from'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $outputFormat, 'time' => true));
     $fieldset->addField('available_to', 'date', array('name' => 'available_to', 'label' => $this->__('Available to'), 'title' => $this->__('Available to'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $outputFormat, 'time' => true));
     $fieldset->addField('price', 'text', array('name' => 'price', 'label' => $this->__('Deal price'), 'title' => $this->__('Deal price')));
     $fieldset->addField('auto_close', 'select', array('label' => $this->__('Automatically close deal on success'), 'title' => $this->__('Automatically close deal on success'), 'name' => 'auto_close', 'options' => array('1' => $this->__('Yes'), '0' => $this->__('No'))));
     $fieldset->addField('url_key', 'text', array('name' => 'url_key', 'label' => $this->__('Url key'), 'title' => $this->__('Url key'), 'after_element_html' => 'Leave empty to use the URL of the related product. Note, only Latin symbols, numbers, hyphens and underscores are allowed in the url key'));
     $form->setValues($deal->getData());
     if ($deal->getData('available_from')) {
         $form->getElement('available_from')->setValue(Mage::app()->getLocale()->date($deal->getData('available_from'), Varien_Date::DATETIME_INTERNAL_FORMAT));
     }
     if ($deal->getData('available_to')) {
         $form->getElement('available_to')->setValue(Mage::app()->getLocale()->date($deal->getData('available_to'), Varien_Date::DATETIME_INTERNAL_FORMAT));
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:bigtailbear14,项目名称:rosstheme,代码行数:49,代码来源:AW_Collpur_Block_Adminhtml_Deal_Edit_Tab_General.php


注:本文中的Varien_Data_Form::getElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。