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


PHP Varien_Data_Form::getHtmlIdPrefix方法代码示例

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


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

示例1: _prepareForm

 /**
  * Prepare coupon codes generation parameters form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     /**
      * @var Mage_SalesRule_Helper_Coupon $couponHelper
      */
     $couponHelper = Mage::helper('salesrule/coupon');
     $model = Mage::registry('current_promo_quote_rule');
     $ruleId = $model->getId();
     $form->setHtmlIdPrefix('coupons_');
     $gridBlock = $this->getLayout()->getBlock('promo_quote_edit_tab_coupons_grid');
     $gridBlockJsObject = '';
     if ($gridBlock) {
         $gridBlockJsObject = $gridBlock->getJsObjectName();
     }
     $fieldset = $form->addFieldset('information_fieldset', array('legend' => Mage::helper('salesrule')->__('Coupons Information')));
     $fieldset->addClass('ignore-validate');
     $fieldset->addField('rule_id', 'hidden', array('name' => 'rule_id', 'value' => $ruleId));
     $fieldset->addField('qty', 'text', array('name' => 'qty', 'label' => Mage::helper('salesrule')->__('Coupon Qty'), 'title' => Mage::helper('salesrule')->__('Coupon Qty'), 'required' => true, 'class' => 'validate-digits validate-greater-than-zero'));
     $fieldset->addField('length', 'text', array('name' => 'length', 'label' => Mage::helper('salesrule')->__('Code Length'), 'title' => Mage::helper('salesrule')->__('Code Length'), 'required' => true, 'note' => Mage::helper('salesrule')->__('Excluding prefix, suffix and separators.'), 'value' => $couponHelper->getDefaultLength(), 'class' => 'validate-digits validate-greater-than-zero'));
     $fieldset->addField('format', 'select', array('label' => Mage::helper('salesrule')->__('Code Format'), 'name' => 'format', 'options' => $couponHelper->getFormatsList(), 'required' => true, 'value' => $couponHelper->getDefaultFormat()));
     $fieldset->addField('prefix', 'text', array('name' => 'prefix', 'label' => Mage::helper('salesrule')->__('Code Prefix'), 'title' => Mage::helper('salesrule')->__('Code Prefix'), 'value' => $couponHelper->getDefaultPrefix()));
     $fieldset->addField('suffix', 'text', array('name' => 'suffix', 'label' => Mage::helper('salesrule')->__('Code Suffix'), 'title' => Mage::helper('salesrule')->__('Code Suffix'), 'value' => $couponHelper->getDefaultSuffix()));
     $fieldset->addField('dash', 'text', array('name' => 'dash', 'label' => Mage::helper('salesrule')->__('Dash Every X Characters'), 'title' => Mage::helper('salesrule')->__('Dash Every X Characters'), 'note' => Mage::helper('salesrule')->__('If empty no separation.'), 'value' => $couponHelper->getDefaultDashInterval(), 'class' => 'validate-digits'));
     $idPrefix = $form->getHtmlIdPrefix();
     $generateUrl = $this->getGenerateUrl();
     $fieldset->addField('generate_button', 'note', array('text' => $this->getButtonHtml(Mage::helper('salesrule')->__('Generate'), "generateCouponCodes('{$idPrefix}' ,'{$generateUrl}', '{$gridBlockJsObject}')", 'generate')));
     $this->setForm($form);
     Mage::dispatchEvent('adminhtml_promo_quote_edit_tab_coupons_form_prepare_form', array('form' => $form));
     return parent::_prepareForm();
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:36,代码来源:Form.php

示例2: _prepareForm

 /**
  * Prepare Hour form.
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $model = Mage::registry("location_data");
     $locationId = $model->getId();
     $form->setHtmlIdPrefix('hour_');
     $gridBlock = $this->getLayout()->getBlock('location_tab_hour_grid');
     $gridBlockJsObject = '';
     if ($gridBlock) {
         $gridBlockJsObject = $gridBlock->getJsObjectName();
     }
     $fieldset = $form->addFieldset("location_form", array("legend" => Mage::helper("dhlocation")->__("Opening Hours")));
     $fieldset->addClass('ignore-validate');
     $fieldset->addField('location_id', 'hidden', array('name' => 'location_id', 'value' => $locationId));
     $fieldset->addField("day", "text", array("label" => Mage::helper("dhlocation")->__("Day of the week"), "class" => "required-entry", "required" => true, "name" => "day"));
     $fieldset->addField("open", "text", array("label" => Mage::helper("dhlocation")->__("Opening time"), "name" => "open"));
     $fieldset->addField("close", "text", array("label" => Mage::helper("dhlocation")->__("Closing time"), "name" => "close", "after_element_html" => "<br /><small>If opening and closing time are empty, it will appear as \"closed\"</small>"));
     $idPrefix = $form->getHtmlIdPrefix();
     $generateUrl = $this->getGenerateUrl();
     $fieldset->addField('generate_button', 'note', array('text' => $this->getButtonHtml(Mage::helper('dhlocation')->__('Add Hours'), "DOGHOUSE.Location.saveHour('{$idPrefix}' ,'{$generateUrl}', '{$gridBlockJsObject}')", 'generate')));
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:rob3000,项目名称:Doghouse_Location,代码行数:28,代码来源:Form.php

示例3: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $htmlIdPrefix = $form->getHtmlIdPrefix();
     $fieldset = $form->addFieldset('multiflatrate_config_form', array('legend' => Mage::helper('smdropship')->__('Shipping Config')));
     $model = Mage::registry('current_rate');
     if ($model->getId()) {
         $fieldset->addField('rate_id', 'hidden', array('name' => 'rate_id'));
     }
     $fieldset->addField('title', 'text', array('label' => Mage::helper('smdropship')->__('Title'), 'class' => 'required-entry', 'required' => true, 'name' => 'title'));
     $fieldset->addField('description', 'textarea', array('label' => Mage::helper('smdropship')->__('Description'), 'name' => 'description'));
     $fieldset->addField('in_related_vendors', 'hidden', array('label' => Mage::helper('smdropship')->__('Vendors'), 'name' => 'vendor_ids'));
     $fieldset->addField('price', 'text', array('label' => Mage::helper('smdropship')->__('Price'), 'class' => 'required-entry', 'required' => true, 'name' => 'price'));
     $fieldset->addField('type', 'select', array('label' => Mage::helper('smdropship')->__('Type'), 'class' => 'required-entry', 'required' => true, 'name' => 'type', 'values' => array(array('label' => Mage::helper('smdropship')->__('Not Free'), 'value' => 'nofree'), array('label' => Mage::helper('smdropship')->__('Free'), 'value' => 'free'))), 'to');
     $fieldset->addField('order_amount_limit', 'text', array('label' => Mage::helper('smdropship')->__('Order Amount Limit'), 'display' => 'none', 'name' => 'order_amount_limit'), 'type');
     // define field dependencies
     //if ($this->getFieldVisibility('type') && $this->getFieldVisibility('order_amount_limit')) {
     $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap("{$htmlIdPrefix}type", 'type')->addFieldMap("{$htmlIdPrefix}order_amount_limit", 'order_amount_limit')->addFieldDependence('order_amount_limit', 'type', 'free'));
     //}
     $fieldset->addField('active', 'select', array('label' => Mage::helper('smdropship')->__('Status'), 'class' => 'required-entry', 'required' => true, 'name' => 'active', 'values' => array(array('label' => Mage::helper('smdropship')->__('Disable'), 'value' => 0), array('label' => Mage::helper('smdropship')->__('Enable'), 'value' => 1))));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:shashankkanungo,项目名称:magento,代码行数:24,代码来源:SM_Dropship_Block_Adminhtml_Shipping_Edit_Tab_Form.php

示例4: _prepareForm

 /**
  * Set form id prefix, set values if jobs is editing
  *
  * @return Zeon_Jobs_Block_Adminhtml_Category_Edit_Tab_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $htmlIdPrefix = 'jobs_category_';
     $form->setHtmlIdPrefix($htmlIdPrefix);
     $fieldsetHtmlClass = 'fieldset-wide';
     $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => $this->getTabId()));
     $model = Mage::registry('current_category');
     $contents = $model->getDescription();
     Mage::dispatchEvent('adminhtml_category_edit_tab_form_before_prepare_form', array('model' => $model, 'form' => $form));
     // add category information fieldset
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('zeon_jobs')->__('Category information'), 'class' => $fieldsetHtmlClass));
     $fieldset->addField('title', 'text', array('label' => Mage::helper('zeon_jobs')->__('Title'), 'name' => 'title', 'required' => true, 'disabled' => (bool) $model->getIsReadonly()));
     $fieldset->addField('identifier', 'text', array('label' => Mage::helper('zeon_jobs')->__('Identifier'), 'name' => 'identifier'));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('zeon_jobs')->__('Status'), 'name' => 'status', 'required' => true, 'disabled' => (bool) $model->getIsReadonly(), 'options' => Mage::getModel('zeon_jobs/status')->getAllOptions()));
     if (!$model->getId()) {
         $model->setData('status', Zeon_Jobs_Model_Status::STATUS_ENABLED);
     }
     $fieldset->addField('description', 'editor', array('name' => 'description', 'required' => true, 'value' => isset($contents[0]) ? $contents[0] : '', 'label' => Mage::helper('zeon_jobs')->__('Description'), 'disabled' => (bool) $model->getIsReadonly(), 'config' => $wysiwygConfig, 'wysiwyg' => false, 'container_id' => 'description', 'after_element_html' => '<script type="text/javascript">' . ((bool) $model->getIsReadonly() ? '$(\'buttons' . $form->getHtmlIdPrefix() . 'description\').hide(); ' : '') . (isset($contents[0]) ? '' : (!$model->getId() ? '' : '$(\'description\').hide();')) . '</script>'));
     $fieldset->addField('sort_order', 'text', array('label' => Mage::helper('zeon_jobs')->__('Sort Order'), 'title' => Mage::helper('zeon_jobs')->__('Sort Order'), 'name' => 'sort_order', 'disabled' => (bool) $model->getIsReadonly()));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:xiaoguizhidao,项目名称:BumblebeeSite,代码行数:29,代码来源:Form.php

示例5: 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

示例6: _prepareForm

 /**
  * Prepare Banners Content Tab form, define Editor settings
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $banner = Mage::registry('current_banner');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('banner_content_');
     $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => $this->getTabId(), 'skip_widgets' => array('enterprise_banner/widget_banner')));
     $fieldsetHtmlClass = 'fieldset-wide';
     $storeContents = $banner->getStoreContents();
     $model = Mage::registry('current_banner');
     Mage::dispatchEvent('adminhtml_banner_edit_tab_content_before_prepare_form', array('model' => $model, 'form' => $form));
     // add default content fieldset
     $fieldset = $form->addFieldset('default_fieldset', array('legend' => Mage::helper('enterprise_banner')->__('Default Content'), 'class' => $fieldsetHtmlClass));
     $fieldset->addField('store_0_content_use', 'checkbox', array('name' => 'store_contents_not_use[0]', 'required' => false, 'label' => Mage::helper('enterprise_banner')->__('Banner Default Content for All Store Views'), 'onclick' => "\$('store_default_content').toggle();\n                \$('" . $form->getHtmlIdPrefix() . "store_default_content').disabled = !\$('" . $form->getHtmlIdPrefix() . "store_default_content').disabled;", 'checked' => isset($storeContents[0]) ? false : (!$model->getId() ? false : true), 'after_element_html' => '<label for="' . $form->getHtmlIdPrefix() . 'store_0_content_use">' . Mage::helper('enterprise_banner')->__('No Default Content') . '</label>', 'value' => 0, 'fieldset_html_class' => 'store', 'disabled' => (bool) $model->getIsReadonly() || $model->getCanSaveAllStoreViewsContent() === false));
     $field = $fieldset->addField('store_default_content', 'editor', array('name' => 'store_contents[0]', 'value' => isset($storeContents[0]) ? $storeContents[0] : '', 'disabled' => (bool) $model->getIsReadonly() || $model->getCanSaveAllStoreViewsContent() === false || (isset($storeContents[0]) ? false : (!$model->getId() ? false : true)), 'config' => $wysiwygConfig, 'wysiwyg' => false, 'container_id' => 'store_default_content', 'after_element_html' => '<script type="text/javascript">' . ((bool) $model->getIsReadonly() || $model->getCanSaveAllStoreViewsContent() === false ? '$(\'buttons' . $form->getHtmlIdPrefix() . 'store_default_content\').hide(); ' : '') . (isset($storeContents[0]) ? '' : (!$model->getId() ? '' : '$(\'store_default_content\').hide();')) . '</script>'));
     // fieldset and content areas per store views
     $fieldset = $form->addFieldset('scopes_fieldset', array('legend' => Mage::helper('enterprise_banner')->__('Store View Specific Content'), 'class' => $fieldsetHtmlClass, 'table_class' => 'form-list stores-tree'));
     $wysiwygConfig->setUseContainer(true);
     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) {
                 $storeContent = isset($storeContents[$store->getId()]) ? $storeContents[$store->getId()] : '';
                 $contentFieldId = 's_' . $store->getId() . '_content';
                 $wysiwygConfig = clone $wysiwygConfig;
                 $fieldset->addField('store_' . $store->getId() . '_content_use', 'checkbox', array('name' => 'store_contents_not_use[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'onclick' => "\$('{$contentFieldId}').toggle(); \$('" . $form->getHtmlIdPrefix() . $contentFieldId . "').disabled = !\$('" . $form->getHtmlIdPrefix() . $contentFieldId . "').disabled;", 'checked' => $storeContent ? false : true, 'after_element_html' => '<label for="' . $form->getHtmlIdPrefix() . 'store_' . $store->getId() . '_content_use">' . Mage::helper('enterprise_banner')->__('Use Default') . '</label>', 'value' => $store->getId(), 'fieldset_html_class' => 'store', 'disabled' => (bool) $model->getIsReadonly()));
                 $fieldset->addField($contentFieldId, 'editor', array('name' => 'store_contents[' . $store->getId() . ']', 'required' => false, 'disabled' => (bool) $model->getIsReadonly() || ($storeContent ? false : true), 'value' => $storeContent, 'container_id' => $contentFieldId, 'config' => $wysiwygConfig, 'wysiwyg' => false, 'after_element_html' => '<script type="text/javascript">' . ((bool) $model->getIsReadonly() ? '$(\'buttons' . $form->getHtmlIdPrefix() . $contentFieldId . '\').hide(); ' : '') . ($storeContent ? '' : '$(\'' . $contentFieldId . '\').hide();') . '</script>'));
             }
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:42,代码来源:Content.php

示例7: initForm

 /**
  * Initialize form
  *
  * @return Mage_Adminhtml_Block_Customer_Edit_Tab_Account
  */
 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_account');
     $form->setFieldNameSuffix('account');
     $customer = Mage::registry('current_customer');
     /** @var $customerForm Mage_Customer_Model_Form */
     $customerForm = Mage::getModel('customer/form');
     $customerForm->setEntity($customer)->setFormCode('adminhtml_customer')->initDefaultValues();
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('customer')->__('Account Information')));
     $attributes = $customerForm->getAttributes();
     foreach ($attributes as $attribute) {
         /* @var $attribute Mage_Eav_Model_Entity_Attribute */
         $attribute->setFrontendLabel(Mage::helper('customer')->__($attribute->getFrontend()->getLabel()));
         $attribute->unsIsVisible();
     }
     $disableAutoGroupChangeAttributeName = 'disable_auto_group_change';
     $this->_setFieldset($attributes, $fieldset, array($disableAutoGroupChangeAttributeName));
     $form->getElement('group_id')->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_attribute_group')->setDisableAutoGroupChangeAttribute($customerForm->getAttribute($disableAutoGroupChangeAttributeName))->setDisableAutoGroupChangeAttributeValue($customer->getData($disableAutoGroupChangeAttributeName)));
     if ($customer->getId()) {
         $form->getElement('website_id')->setDisabled('disabled');
         $form->getElement('created_in')->setDisabled('disabled');
     } else {
         $fieldset->removeField('created_in');
         $form->getElement('website_id')->addClass('validate-website-has-store');
         $websites = array();
         foreach (Mage::app()->getWebsites(true) as $website) {
             $websites[$website->getId()] = !is_null($website->getDefaultStore());
         }
         $prefix = $form->getHtmlIdPrefix();
         $form->getElement('website_id')->setAfterElementHtml('<script type="text/javascript">' . "\n                var {$prefix}_websites = " . Mage::helper('core')->jsonEncode($websites) . ";\n                Validation.add(\n                    'validate-website-has-store',\n                    '" . Mage::helper('core')->jsQuoteEscape(Mage::helper('customer')->__('Please select a website which contains store view')) . "',\n                    function(v, elem){\n                        return {$prefix}_websites[elem.value] == true;\n                    }\n                );\n                Element.observe('{$prefix}website_id', 'change', function(){\n                    Validation.validate(\$('{$prefix}website_id'))\n                }.bind(\$('{$prefix}website_id')));\n                " . '</script>');
     }
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
     $form->getElement('website_id')->setRenderer($renderer);
     //        if (Mage::app()->isSingleStoreMode()) {
     //            $fieldset->removeField('website_id');
     //            $fieldset->addField('website_id', 'hidden', array(
     //                'name'      => 'website_id'
     //            ));
     //            $customer->setWebsiteId(Mage::app()->getStore(true)->getWebsiteId());
     //        }
     $customerStoreId = null;
     if ($customer->getId()) {
         $customerStoreId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
     }
     $prefixElement = $form->getElement('prefix');
     if ($prefixElement) {
         $prefixOptions = $this->helper('customer')->getNamePrefixOptions($customerStoreId);
         if (!empty($prefixOptions)) {
             $fieldset->removeField($prefixElement->getId());
             $prefixField = $fieldset->addField($prefixElement->getId(), 'select', $prefixElement->getData(), $form->getElement('group_id')->getId());
             $prefixField->setValues($prefixOptions);
             if ($customer->getId()) {
                 $prefixField->addElementValues($customer->getPrefix());
             }
         }
     }
     $suffixElement = $form->getElement('suffix');
     if ($suffixElement) {
         $suffixOptions = $this->helper('customer')->getNameSuffixOptions($customerStoreId);
         if (!empty($suffixOptions)) {
             $fieldset->removeField($suffixElement->getId());
             $suffixField = $fieldset->addField($suffixElement->getId(), 'select', $suffixElement->getData(), $form->getElement('lastname')->getId());
             $suffixField->setValues($suffixOptions);
             if ($customer->getId()) {
                 $suffixField->addElementValues($customer->getSuffix());
             }
         }
     }
     if ($customer->getId()) {
         if (!$customer->isReadonly()) {
             // Add password management fieldset
             $newFieldset = $form->addFieldset('password_fieldset', array('legend' => Mage::helper('customer')->__('Password Management')));
             // New customer password
             $field = $newFieldset->addField('new_password', 'text', array('label' => Mage::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' => Mage::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' => Mage::helper('customer')->__('Send Welcome Email after Confirmation')));
                     $customer->setData('sendemail', '1');
                 }
             }
             if (Mage::helper('customer')->getIsRequireAdminUserToChangeUserPassword()) {
                 $field = $newFieldset->addField('current_password', 'obscure', array('name' => 'current_password', 'label' => Mage::helper('customer')->__('Current Admin Password'), 'title' => Mage::helper('customer')->__('Current Admin Password'), 'required' => true));
                 $field->setRenderer($this->getLayout()->createBlock('adminhtml/customer_edit_renderer_adminpass'));
             }
//.........这里部分代码省略.........
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:101,代码来源:Account.php

示例8: initCustomForm

 public function initCustomForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_account');
     $form->setFieldNameSuffix('account');
     $customer = Mage::registry('current_customer');
     /** @var $customerForm Mage_Customer_Model_Form */
     $customerForm = Mage::getModel('ajaxlogin/customer');
     $customerForm->setEntity($customer)->setFormCode('adminhtml_customer')->initDefaultValues();
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('customer')->__('Custom Account Information')));
     $attributes = $customerForm->getCustomAttributes();
     foreach ($attributes as $attribute) {
         /* @var $attribute Mage_Eav_Model_Entity_Attribute */
         $attribute->setFrontendLabel(Mage::helper('customer')->__($attribute->getFrontend()->getLabel()));
         $attribute->unsIsVisible();
     }
     $disableAutoGroupChangeAttributeName = 'disable_auto_group_change';
     $this->_setFieldset($attributes, $fieldset, array($disableAutoGroupChangeAttributeName));
     if ($customer->getId()) {
         //            $form->getElement('website_id')->setDisabled('disabled');
         //            $form->getElement('created_in')->setDisabled('disabled');
     } else {
         $fieldset->removeField('created_in');
         $form->getElement('website_id');
         //->addClass('validate-website-has-store');
         $websites = array();
         foreach (Mage::app()->getWebsites(true) as $website) {
             $websites[$website->getId()] = !is_null($website->getDefaultStore());
         }
         $prefix = $form->getHtmlIdPrefix();
     }
     $form->setValues($customer->getData());
     $this->setForm($form);
     return $this;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:35,代码来源:Account.php

示例9: initForm

 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_account');
     $form->setFieldNameSuffix('account');
     $customer = Mage::registry('current_customer');
     /* @var $customerForm Mage_Customer_Model_Form */
     $customerForm = Mage::getModel('customer/form');
     $customerForm->setEntity($customer)->setFormCode('adminhtml_customer')->initDefaultValues();
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('customer')->__('Account Information')));
     $attributes = $customerForm->getAttributes();
     foreach ($attributes as $attribute) {
         $attribute->unsIsVisible();
     }
     $this->_setFieldset($attributes, $fieldset);
     if ($customer->getId()) {
         $form->getElement('website_id')->setDisabled('disabled');
         $form->getElement('created_in')->setDisabled('disabled');
     } else {
         $fieldset->removeField('created_in');
     }
     //        if (Mage::app()->isSingleStoreMode()) {
     //            $fieldset->removeField('website_id');
     //            $fieldset->addField('website_id', 'hidden', array(
     //                'name'      => 'website_id'
     //            ));
     //            $customer->setWebsiteId(Mage::app()->getStore(true)->getWebsiteId());
     //        }
     $customerStoreId = null;
     if ($customer->getId()) {
         $customerStoreId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
     }
     $prefixElement = $form->getElement('prefix');
     if ($prefixElement) {
         $prefixOptions = $this->helper('customer')->getNamePrefixOptions($customerStoreId);
         if (!empty($prefixOptions)) {
             $fieldset->removeField($prefixElement->getId());
             $prefixField = $fieldset->addField($prefixElement->getId(), 'select', $prefixElement->getData(), $form->getElement('group_id')->getId());
             $prefixField->setValues($prefixOptions);
             if ($customer->getId()) {
                 $prefixField->addElementValues($customer->getPrefix());
             }
         }
     }
     $suffixElement = $form->getElement('suffix');
     if ($suffixElement) {
         $suffixOptions = $this->helper('customer')->getNameSuffixOptions($customerStoreId);
         if (!empty($suffixOptions)) {
             $fieldset->removeField($suffixElement->getId());
             $suffixField = $fieldset->addField($suffixElement->getId(), 'select', $suffixElement->getData(), $form->getElement('lastname')->getId());
             $suffixField->setValues($suffixOptions);
             if ($customer->getId()) {
                 $suffixField->addElementValues($customer->getSuffix());
             }
         }
     }
     if ($customer->getId()) {
         if (!$customer->isReadonly()) {
             // add password management fieldset
             $newFieldset = $form->addFieldset('password_fieldset', array('legend' => Mage::helper('customer')->__('Password Management')));
             // New customer password
             $field = $newFieldset->addField('new_password', 'text', array('label' => Mage::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' => Mage::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' => Mage::helper('customer')->__('Send Welcome Email after Confirmation')));
                     $customer->setData('sendemail', '1');
                 }
             }
         }
     } else {
         $newFieldset = $form->addFieldset('password_fieldset', array('legend' => Mage::helper('customer')->__('Password Management')));
         $field = $newFieldset->addField('password', 'text', array('label' => Mage::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' => Mage::helper('customer')->__('Send Welcome Email'), 'name' => 'sendemail', 'id' => 'sendemail'));
         $customer->setData('sendemail', '1');
         if (!Mage::app()->isSingleStoreMode()) {
             $fieldset->addField('sendemail_store_id', 'select', array('label' => $this->helper('customer')->__('Send From'), 'name' => 'sendemail_store_id', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()));
         }
     }
     // make sendemail and sendmail_store_id disabled, if website_id has empty value
     $isSingleMode = Mage::app()->isSingleStoreMode();
     $sendEmailId = $isSingleMode ? 'sendemail' : 'sendemail_store_id';
     $sendEmail = $form->getElement($sendEmailId);
     $prefix = $form->getHtmlIdPrefix();
     if ($sendEmail) {
         $_disableStoreField = '';
         if (!$isSingleMode) {
             $_disableStoreField = "\$('{$prefix}sendemail_store_id').disabled=(''==this.value || '0'==this.value);";
         }
//.........这里部分代码省略.........
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:101,代码来源:Account.php

示例10: _disableSendEmailStoreForEmptyWebsite

 /**
  * Make sendemail or sendmail_store_id disabled if website_id has an empty value
  *
  * @param Varien_Data_Form $form
  */
 protected function _disableSendEmailStoreForEmptyWebsite(Varien_Data_Form $form)
 {
     $isSingleMode = Mage::app()->isSingleStoreMode();
     $sendEmailId = $isSingleMode ? 'sendemail' : 'sendemail_store_id';
     $sendEmail = $form->getElement($sendEmailId);
     $prefix = $form->getHtmlIdPrefix();
     if ($sendEmail) {
         $_disableStoreField = '';
         if (!$isSingleMode) {
             $_disableStoreField = "\$('{$prefix}sendemail_store_id').disabled=(''==this.value || '0'==this.value);";
         }
         $sendEmail->setAfterElementHtml('<script type="text/javascript">' . "\n                \$('{$prefix}website_id').disableSendemail = function() {\n                    \$('{$prefix}sendemail').disabled = ('' == this.value || '0' == this.value);" . $_disableStoreField . "}.bind(\$('{$prefix}website_id'));\n                Event.observe('{$prefix}website_id', 'change', \$('{$prefix}website_id').disableSendemail);\n                \$('{$prefix}website_id').disableSendemail();\n                " . '</script>');
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:19,代码来源:Account.php


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