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


PHP Varien_Data_Form::addValues方法代码示例

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


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

示例1: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix("template");
     $form->setFieldNameSuffix("template");
     /* @var $template Mzax_Emarketing_Model_Template */
     $template = Mage::registry('current_template');
     if ($template->getId()) {
         $form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
     }
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
     $fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
     $fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
     $snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
     Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
     $editorConfig = new Varien_Object();
     $editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
     $editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
     $editorConfig->setSnippets($snippets);
     $editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
     // Setting custom renderer for content field to remove label column
     $renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
     $editor->setRenderer($renderer);
     $form->addValues($template->getData());
     $this->setForm($form);
     $form->setUseContainer(true);
     return parent::_prepareForm();
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:29,代码来源:Form.php

示例2: _prepareLayout

 /**
  * Prepare form for render
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $form = new Varien_Data_Form();
     $customerGroup = Mage::registry('current_group');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('customer')->__('Group Information')));
     $name = $fieldset->addField('customer_group_code', 'text', array('name' => 'code', 'label' => Mage::helper('customer')->__('Group Name'), 'title' => Mage::helper('customer')->__('Group Name'), 'class' => 'required-entry', 'required' => true));
     if ($customerGroup->getId() == 0 && $customerGroup->getCustomerGroupCode()) {
         $name->setDisabled(true);
     }
     $fieldset->addField('tax_class_id', 'select', array('name' => 'tax_class', 'label' => Mage::helper('customer')->__('Tax class'), 'title' => Mage::helper('customer')->__('Tax class'), 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('tax/class_source_customer')->toOptionArray()));
     if (!is_null($customerGroup->getId())) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'id', 'value' => $customerGroup->getId()));
     }
     if (Mage::getSingleton('adminhtml/session')->getCustomerGroupData()) {
         $form->addValues(Mage::getSingleton('adminhtml/session')->getCustomerGroupData());
         Mage::getSingleton('adminhtml/session')->setCustomerGroupData(null);
     } else {
         $form->addValues($customerGroup->getData());
     }
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/save'));
     $this->setForm($form);
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:29,代码来源:Form.php

示例3: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $installment = Mage::registry('current_installment_payment');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('installment')->__('Installment Payment')));
     $fieldset->addField('order_id', 'text', array('name' => 'order_id', 'label' => Mage::helper('installment')->__('Order Id'), 'title' => Mage::helper('installment')->__('Order Id'), 'readonly' => true));
     $fieldset->addField('installment_master_amount_due', 'text', array('name' => 'amount_due', 'label' => Mage::helper('installment')->__('Amount Due'), 'title' => Mage::helper('installment')->__('Amount Due'), 'required' => true));
     if (!is_null($installment->getId())) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'id', 'value' => $installment->getId()));
     }
     $data = Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData();
     if (Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData()) {
         $form->addValues(Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData());
         Mage::getSingleton('adminhtml/session')->setInstallmentPaymentData(null);
     } else {
         $form->addValues($installment->getData());
     }
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/adjust'));
     $form->setPost(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:25,代码来源:Form.php

示例4: _prepareForm

 /**
  * Prepare form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('tag_tag');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('tag')->__('General Information')));
     if ($model->getTagId()) {
         $fieldset->addField('tag_id', 'hidden', array('name' => 'tag_id'));
     }
     $fieldset->addField('form_key', 'hidden', array('name' => 'form_key', 'value' => Mage::getSingleton('core/session')->getFormKey()));
     $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => (int) $this->getRequest()->getParam('store')));
     $fieldset->addField('name', 'text', array('name' => 'tag_name', 'label' => Mage::helper('tag')->__('Tag Name'), 'title' => Mage::helper('tag')->__('Tag Name'), 'required' => true, 'after_element_html' => ' ' . Mage::helper('adminhtml')->__('[GLOBAL]')));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('tag')->__('Status'), 'title' => Mage::helper('tag')->__('Status'), 'name' => 'tag_status', 'required' => true, 'options' => array(Mage_Tag_Model_Tag::STATUS_DISABLED => Mage::helper('tag')->__('Disabled'), Mage_Tag_Model_Tag::STATUS_PENDING => Mage::helper('tag')->__('Pending'), Mage_Tag_Model_Tag::STATUS_APPROVED => Mage::helper('tag')->__('Approved')), 'after_element_html' => ' ' . Mage::helper('adminhtml')->__('[GLOBAL]')));
     $fieldset->addField('base_popularity', 'text', array('name' => 'base_popularity', 'label' => Mage::helper('tag')->__('Base Popularity'), 'title' => Mage::helper('tag')->__('Base Popularity'), 'after_element_html' => ' ' . Mage::helper('tag')->__('[STORE VIEW]')));
     if (!$model->getId() && !Mage::getSingleton('adminhtml/session')->getTagData()) {
         $model->setStatus(Mage_Tag_Model_Tag::STATUS_APPROVED);
     }
     if (Mage::getSingleton('adminhtml/session')->getTagData()) {
         $form->addValues(Mage::getSingleton('adminhtml/session')->getTagData());
         Mage::getSingleton('adminhtml/session')->setTagData(null);
     } else {
         $form->addValues($model->getData());
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:30,代码来源:Form.php

示例5: _prepareLayout

 /**
  * Prepare form for render
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $form = new Varien_Data_Form();
     $customerGroup = Mage::registry('current_group');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_Customer_Helper_Data')->__('Group Information')));
     $validateClass = sprintf('required-entry validate-length maximum-length-%d', Mage_Customer_Model_Group::GROUP_CODE_MAX_LENGTH);
     $name = $fieldset->addField('customer_group_code', 'text', array('name' => 'code', 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Group Name'), 'title' => Mage::helper('Mage_Customer_Helper_Data')->__('Group Name'), 'note' => Mage::helper('Mage_Customer_Helper_Data')->__('Maximum length must be less then %s symbols', Mage_Customer_Model_Group::GROUP_CODE_MAX_LENGTH), 'class' => $validateClass, 'required' => true));
     if ($customerGroup->getId() == 0 && $customerGroup->getCustomerGroupCode()) {
         $name->setDisabled(true);
     }
     $fieldset->addField('tax_class_id', 'select', array('name' => 'tax_class', 'label' => Mage::helper('Mage_Customer_Helper_Data')->__('Tax Class'), 'title' => Mage::helper('Mage_Customer_Helper_Data')->__('Tax Class'), 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('Mage_Tax_Model_Class_Source_Customer')->toOptionArray()));
     if (!is_null($customerGroup->getId())) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'id', 'value' => $customerGroup->getId()));
     }
     if (Mage::getSingleton('Mage_Adminhtml_Model_Session')->getCustomerGroupData()) {
         $form->addValues(Mage::getSingleton('Mage_Adminhtml_Model_Session')->getCustomerGroupData());
         Mage::getSingleton('Mage_Adminhtml_Model_Session')->setCustomerGroupData(null);
     } else {
         $form->addValues($customerGroup->getData());
     }
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/save'));
     $this->setForm($form);
 }
开发者ID:natxetee,项目名称:magento2,代码行数:30,代码来源:Form.php

示例6: _prepareForm

 /**
  * Prepare form for render
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $installment = Mage::registry('current_installment_type');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('installment')->__('Installment Type Information')));
     $validateClass = sprintf('required-entry validate-length maximum-length-%d', NGC_Installment_Model_Type::INSTALLMENT_TYPE_MAX_LENGTH);
     $fieldset->addField('installment_type_id', 'text', array('name' => 'type_id', 'label' => Mage::helper('installment')->__('Installment Type Id'), 'title' => Mage::helper('installment')->__('Installment Type Id'), 'note' => Mage::helper('installment')->__('Maximum length must be less then %s symbols', NGC_Installment_Model_Type::INSTALLMENT_TYPE_MAX_LENGTH), 'class' => $validateClass, 'required' => true));
     $validateClass = sprintf('required-entry validate-length maximum-length-%d', NGC_Installment_Model_Type::INSTALLMENT_DESC_MAX_LENGTH);
     $fieldset->addField('installment_type_description', 'textarea', array('name' => 'description', 'label' => Mage::helper('installment')->__('Description'), 'title' => Mage::helper('installment')->__('Description'), 'note' => Mage::helper('installment')->__('Maximum length must be less then %s symbols', NGC_Installment_Model_Type::INSTALLMENT_DESC_MAX_LENGTH), 'class' => $validateClass, 'required' => true));
     $fieldset->addField('installment_type_plan_active', 'select', array('name' => 'plan_active', 'label' => Mage::helper('installment')->__('This plan is'), 'title' => Mage::helper('installment')->__('Plan Status'), 'required' => true, 'class' => 'input-select', 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive'))));
     $fieldset->addField('installment_type_auto_adjust', 'select', array('name' => 'auto_adjust', 'label' => Mage::helper('installment')->__('Automatically adjust future installments'), 'title' => Mage::helper('installment')->__('Auto Adjust'), 'note' => Mage::helper('installment')->__('If an installment payment is soft declined, automatically adjust future installment payment due dates if future authorization successful'), 'required' => true, 'class' => 'input-select', 'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No'))));
     $fieldset->addField('installment_type_plan_default', 'select', array('name' => 'plan_default', 'label' => Mage::helper('installment')->__('Default Plan'), 'title' => Mage::helper('installment')->__('Plan Status'), 'required' => true, 'class' => 'input-select', 'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No'))));
     if (!is_null($installment->getId())) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'id', 'value' => $installment->getId()));
     }
     if (Mage::getSingleton('adminhtml/session')->getInstallmentTypeData()) {
         $form->addValues(Mage::getSingleton('adminhtml/session')->getInstallmentTypeData());
         Mage::getSingleton('adminhtml/session')->setInstallmentTypeData(null);
     } else {
         $form->addValues($installment->getData());
     }
     //        $form->setUseContainer(true);
     //        $form->setId('edit_form');
     //        $form->setAction($this->getUrl('*/*/save'));
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:31,代码来源:Properties.php

示例7: _prepareForm

    protected function _prepareForm()
    {
        $form = new Varien_Data_Form();
        $installment = Mage::registry('current_installment_payment');
        $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('installment')->__('Installment Payment Information')));
        $fieldset->addType('amount_due', 'NGC_Installment_Lib_Varien_Data_Form_Element_AmountDue');
        $fieldset->addField('order_id', 'text', array('name' => 'order_id', 'label' => Mage::helper('installment')->__('Order Id'), 'title' => Mage::helper('installment')->__('Order Id'), 'readonly' => true));
        $fieldset->addField('installment_master_sequence_number', 'text', array('name' => 'sequence_number', 'label' => Mage::helper('installment')->__('Sequence Number'), 'title' => Mage::helper('installment')->__('Sequence Number'), 'readonly' => true));
        $authPaid = $installment->getInstallmentMasterInstallmentAuthorized() || $installment->getInstallmentMasterInstallmentPaid();
        $required = !$authPaid ? true : false;
        $option = array('name' => 'amount_due', 'label' => Mage::helper('installment')->__('Amount Due'), 'title' => Mage::helper('installment')->__('Amount Due'), 'readonly' => true, 'required' => $required);
        $fieldset->addField('installment_master_amount_due', 'amount_due', $option);
        $outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
        $fieldType = $authPaid ? 'text' : 'date';
        $option = array('name' => 'amount_due_date', 'label' => Mage::helper('installment')->__('Amount Due Date'), 'title' => Mage::helper('installment')->__('Amount Due Date'), 'class' => 'validate-date', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT, 'format' => $outputFormat, 'time' => true, 'required' => $required);
        if ($authPaid) {
            $option = array_merge($option, array('readonly' => true));
        }
        $fieldset->addField('installment_master_amount_due_date', $fieldType, $option);
        $fieldset->addField('installment_master_installment_authorized', 'select', array('name' => 'installment_authorized', 'label' => Mage::helper('installment')->__('Installment Authorized'), 'title' => Mage::helper('installment')->__('Installment Authorized'), 'disabled' => 'disabled', 'class' => 'input-select', 'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No'))));
        $fieldset->addField('installment_master_installment_paid', 'select', array('name' => 'installment_paid', 'label' => Mage::helper('installment')->__('Installment Paid'), 'title' => Mage::helper('installment')->__('Installment Paid'), 'disabled' => 'disabled', 'class' => 'input-select', 'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No'))));
        $disabled = $authPaid ? 'disabled' : '';
        $suspendInstallment = $fieldset->addField('installment_master_suspend_installment', 'select', array('name' => 'suspend_installment', 'label' => Mage::helper('installment')->__('Suspend Installment'), 'title' => Mage::helper('installment')->__('Suspend Installment'), 'required' => $required, 'disabled' => $disabled, 'class' => 'input-select', 'options' => array('1' => Mage::helper('adminhtml')->__('Yes'), '0' => Mage::helper('adminhtml')->__('No')), 'onchange' => 'modifySuspendedReasonElement(this)'));
        $suspendInstallment->setAfterElementHtml('<script>
            function modifySuspendedReasonElement(selectElem){
                if(selectElem.value == 0){
                    $("installment_master_suspended_reason").readOnly=true;
                    $("installment_master_suspended_reason").removeClassName(\'required-entry\');
                    var label = $$(\'label[for="installment_master_suspended_reason"] span\');
                    $(label[0]).remove();
                } else {
                    $("installment_master_suspended_reason").readOnly=false;
                    $("installment_master_suspended_reason").addClassName(\'required-entry\');
                    var label = $$(\'label[for="installment_master_suspended_reason"]\');
                    var elem = new Element("span").addClassName("required").update(" *");

                    $(label[0]).insert({bottom: elem});
                }
            }
        </script>');
        $fieldset->addField('installment_master_suspended_reason', 'textarea', array('name' => 'suspended_reason', 'id' => 'suspended_reason', 'label' => Mage::helper('installment')->__('Suspended Reason'), 'title' => Mage::helper('installment')->__('Suspended Reason'), 'readonly' => $installment->getInstallmentMasterSuspendInstallment() ? true : false));
        if (!is_null($installment->getId())) {
            // If edit add id
            $form->addField('id', 'hidden', array('name' => 'id', 'value' => $installment->getId()));
        }
        $data = Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData();
        if (Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData()) {
            $form->addValues(Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData());
            Mage::getSingleton('adminhtml/session')->setInstallmentPaymentData(null);
        } else {
            $form->addValues($installment->getData());
        }
        //        $form->setUseContainer(true);
        //        $form->setId('edit_form');
        //        $form->setAction($this->getUrl('*/*/save'));
        $this->setForm($form);
        return parent::_prepareForm();
    }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:58,代码来源:Properties.php

示例8: _prepareLayout

 /**
  * Prepare form for render
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $form = new Varien_Data_Form();
     $template = Mage::registry('seosuite_template_edit');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('customer')->__('Template Information')));
     $tCode = $fieldset->addField('template_code', 'hidden', array('name' => 'template_code', 'label' => Mage::helper('seosuite')->__('Template Code'), 'title' => Mage::helper('seosuite')->__('Template Code'), 'required' => true));
     //        $tCode->setAfterElementHtml('<div>'.Mage::helper('seosuite')->__($template->getTemplateName()).'</div>');
     //        $templateName = $fieldset->addField('template_name', 'text',
     //            array(
     //                'name'  => 'template_name',
     //                'label' => Mage::helper('seosuite')->__('Template Name'),
     //                'title' => Mage::helper('seosuite')->__('Template Name'),
     //                'required' => true,
     //            )
     //        );
     if (!$template->getTemplateKey()) {
         $tCode->setAfterElementHtml('<div style="font-size: 15px;margin-top:5px;color:red;"><u><b>You need to specify the template value for all store views</b></u></div>');
     }
     $templateKey = $fieldset->addField('template_key', 'text', array('name' => 'store_template[template_key]', 'label' => Mage::helper('seosuite')->__('Template Rule'), 'title' => Mage::helper('seosuite')->__('Template Rule'), 'required' => true));
     $fieldset->addField('status', 'select', array('name' => 'status', 'label' => Mage::helper('seosuite')->__('Template Status'), 'title' => Mage::helper('seosuite')->__('Template Status'), 'values' => array(0 => Mage::helper('seosuite')->__('Disabled'), 1 => Mage::helper('seosuite')->__('Enabled')), 'required' => true));
     $template->getIsDefaultValue() ? $checked = 'checked=1' : ($checked = '');
     if ($template->getStoreId()) {
         $storeId = $template->getStoreId();
     } else {
         $storeId = Mage::app()->getRequest()->getParam('store', 0);
     }
     if ($storeId) {
         $templateKey->setAfterElementHtml("<input type=checkbox " . $checked . " id='useDefault_template_key'>Use default\n                <script type='text/javascript'>\n                    Event.observe('useDefault_template_key','change',function(){\n                        getDefault();\n                    });\n                    getDefault();\n                    function getDefault()\n                    {\n                        if(\$('useDefault_template_key').checked) {\n                            \$('template_key').disabled = true;\n                        } else {\n                            \$('template_key').disabled = false;\n                        }\n                    }\n                </script>\n            ");
     }
     $templateKey->setAfterElementHtml("<div style='width:1000px'>" . $template->getComment() . "</div>");
     // If edit add id
     $form->addField('template_store_id', 'hidden', array('name' => 'store_template[store_id]', 'value' => $storeId));
     $form->addField('entity_id', 'hidden', array('name' => 'store_template[entity_id]'));
     if (!is_null($template->getTemplateId())) {
         // If edit add id
         $form->addField('id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
     }
     if (Mage::getSingleton('adminhtml/session')->getCustomerGroupData()) {
         $form->addValues(Mage::getSingleton('adminhtml/session')->getCustomerGroupData());
         Mage::getSingleton('adminhtml/session')->setCustomerGroupData(null);
     } else {
         $form->addValues($template->getData());
     }
     $form->setUseContainer(true);
     $form->setId('edit_form');
     $form->setAction($this->getUrl('*/*/save'));
     $this->setForm($form);
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:52,代码来源:Form.php

示例9: _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('marketplace/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:andrebellafronte,项目名称:MM_Marketplace,代码行数:65,代码来源:Attributes.php

示例10: _prepareForm

 protected function _prepareForm()
 {
     $actionUrl = $this->getUrl('*/*/sales');
     $form = new Varien_Data_Form(array('id' => 'filter_form', 'action' => $actionUrl, 'method' => 'get'));
     $htmlIdPrefix = 'sales_report_';
     $form->setHtmlIdPrefix($htmlIdPrefix);
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('reports')->__('Filter')));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('store_ids', 'hidden', array('name' => 'store_ids'));
     $statuses = Mage::getModel('sales/order_config')->getStatuses();
     $values = array();
     foreach ($statuses as $code => $label) {
         if (false === strpos($code, 'pending')) {
             $values[] = array('label' => Mage::helper('reports')->__($label), 'value' => $code);
         }
     }
     $fieldset->addField('report_type', 'select', array('name' => 'report_type', 'options' => $this->_reportTypeOptions, 'label' => Mage::helper('reports')->__('Report Type'), 'title' => Mage::helper('reports')->__('Report Type')));
     $fieldset->addField('period_type', 'select', array('name' => 'period_type', 'options' => array('day' => Mage::helper('reports')->__('Day'), 'month' => Mage::helper('reports')->__('Month'), 'year' => Mage::helper('reports')->__('Year')), 'label' => Mage::helper('reports')->__('Period'), 'title' => Mage::helper('reports')->__('Period')));
     $fieldset->addField('from', 'date', array('name' => 'from', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('reports')->__('From'), 'title' => Mage::helper('reports')->__('From'), 'required' => true));
     $fieldset->addField('to', 'date', array('name' => 'to', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('reports')->__('To'), 'title' => Mage::helper('reports')->__('To'), 'required' => true));
     $fieldset->addField('show_order_statuses', 'select', array('name' => 'show_order_statuses', 'label' => Mage::helper('reports')->__('Order Status'), 'title' => Mage::helper('reports')->__('Order Status'), 'options' => array('0' => Mage::helper('reports')->__('Any'), '1' => Mage::helper('reports')->__('Specified')), 'note' => Mage::helper('reports')->__('Applies to Any of the Specified Order Statuses')));
     $fieldset->addField('order_statuses', 'multiselect', array('name' => 'order_statuses', 'values' => $values, 'display' => 'none'));
     $fieldset->addField('show_empty_rows', 'select', array('name' => 'show_empty_rows', 'options' => array('1' => 'Yes', '0' => 'No'), 'label' => Mage::helper('reports')->__('Empty Rows'), 'title' => Mage::helper('reports')->__('Empty Rows')));
     $form->addValues($this->getFilterData()->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     // define field dependencies
     $this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_form_element_dependence')->addFieldMap("{$htmlIdPrefix}show_order_statuses", 'show_order_statuses')->addFieldMap("{$htmlIdPrefix}order_statuses", 'order_statuses')->addFieldDependence('order_statuses', 'show_order_statuses', '1'));
     return parent::_prepareForm();
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:30,代码来源:Form.php

示例11: _prepareForm

 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('general', array('legend' => Mage::helper('core')->__('General Settings')));
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', array('label' => Mage::helper('core')->__('Store'), 'title' => Mage::helper('core')->__('Store'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), 'name' => 'store_id', 'required' => true));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => Mage::app()->getStore(true)->getId()));
     }
     $fieldset->addField('design', 'select', array('label' => Mage::helper('core')->__('Custom Design'), 'title' => Mage::helper('core')->__('Custom Design'), 'values' => Mage::getSingleton('core/design_source_design')->getAllOptions(), 'name' => 'design', 'required' => true));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => Mage::helper('core')->__('Date From'), 'title' => Mage::helper('core')->__('Date From'), 'name' => 'date_from', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('label' => Mage::helper('core')->__('Date To'), 'title' => Mage::helper('core')->__('Date To'), 'name' => 'date_to', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $formData = Mage::getSingleton('adminhtml/session')->getDesignData(true);
     if (!$formData) {
         $formData = Mage::registry('design')->getData();
     } else {
         $formData = $formData['design'];
     }
     $form->addValues($formData);
     $form->setFieldNameSuffix('design');
     $this->setForm($form);
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:25,代码来源:General.php

示例12: _prepareForm

 /**
  * Add fields to form and create template info form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Template Information'), 'class' => 'fieldset-wide'));
     $templateId = $this->getEmailTemplate()->getId();
     if ($templateId) {
         $fieldset->addField('used_currently_for', 'label', array('label' => Mage::helper('adminhtml')->__('Used Currently For'), 'container_id' => 'used_currently_for', 'after_element_html' => '<script type="text/javascript">' . (!$this->getEmailTemplate()->getSystemConfigPathsWhereUsedCurrently() ? '$(\'' . 'used_currently_for' . '\').hide(); ' : '') . '</script>'));
     }
     if (!$templateId) {
         $fieldset->addField('used_default_for', 'label', array('label' => Mage::helper('adminhtml')->__('Used as Default For'), 'container_id' => 'used_default_for', 'after_element_html' => '<script type="text/javascript">' . (!(bool) $this->getEmailTemplate()->getOrigTemplateCode() ? '$(\'' . 'used_default_for' . '\').hide(); ' : '') . '</script>'));
     }
     $fieldset->addField('template_code', 'text', array('name' => 'template_code', 'label' => Mage::helper('adminhtml')->__('Template Name'), 'required' => true));
     $fieldset->addField('template_subject', 'text', array('name' => 'template_subject', 'label' => Mage::helper('adminhtml')->__('Template Subject'), 'required' => true));
     $fieldset->addField('orig_template_variables', 'hidden', array('name' => 'orig_template_variables'));
     $fieldset->addField('variables', 'hidden', array('name' => 'variables', 'value' => Zend_Json::encode($this->getVariables())));
     $fieldset->addField('template_variables', 'hidden', array('name' => 'template_variables'));
     $insertVariableButton = $this->getLayout()->createBlock('adminhtml/widget_button', '', array('type' => 'button', 'label' => Mage::helper('adminhtml')->__('Insert Variable...'), 'onclick' => 'templateControl.openVariableChooser();return false;'));
     $fieldset->addField('insert_variable', 'note', array('text' => $insertVariableButton->toHtml()));
     $fieldset->addField('template_text', 'textarea', array('name' => 'template_text', 'label' => Mage::helper('adminhtml')->__('Template Content'), 'title' => Mage::helper('adminhtml')->__('Template Content'), 'required' => true, 'style' => 'height:24em;'));
     if (!$this->getEmailTemplate()->isPlain()) {
         $fieldset->addField('template_styles', 'textarea', array('name' => 'template_styles', 'label' => Mage::helper('adminhtml')->__('Template Styles'), 'container_id' => 'field_template_styles'));
     }
     if ($templateId) {
         $form->addValues($this->getEmailTemplate()->getData());
     }
     if ($values = Mage::getSingleton('adminhtml/session')->getData('email_template_form_data', true)) {
         $form->setValues($values);
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:36,代码来源:Form.php

示例13: _prepareForm

 protected function _prepareForm()
 {
     $actionUrl = $this->getUrl('*/*/sales');
     $form = new Varien_Data_Form(array('id' => 'filter_form', 'action' => $actionUrl, 'method' => 'get'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('reports')->__('Filter')));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('store_ids', 'hidden', array('name' => 'store_ids'));
     $fieldset->addField('from', 'date', array('name' => 'from', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('reports')->__('From'), 'title' => Mage::helper('reports')->__('From'), 'required' => true));
     $fieldset->addField('to', 'date', array('name' => 'to', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('reports')->__('To'), 'title' => Mage::helper('reports')->__('To'), 'required' => true));
     $fieldset->addField('period_type', 'select', array('name' => 'period_type', 'options' => array('day' => Mage::helper('reports')->__('Day'), 'month' => Mage::helper('reports')->__('Month'), 'year' => Mage::helper('reports')->__('Year')), 'label' => Mage::helper('reports')->__('Period Type'), 'title' => Mage::helper('reports')->__('Period Type')));
     $fieldset->addField('report_type', 'select', array('name' => 'report_type', 'options' => $this->_reportTypeOptions, 'label' => Mage::helper('reports')->__('Report Type'), 'title' => Mage::helper('reports')->__('Report Type')));
     $statuses = Mage::getModel('sales/order_config')->getStatuses();
     $values = array();
     foreach ($statuses as $code => $label) {
         if (false === strpos($code, 'pending')) {
             $values[] = array('label' => Mage::helper('reports')->__($label), 'value' => $code);
         }
     }
     $fieldset->addField('order_statuses', 'multiselect', array('name' => 'order_statuses', 'values' => $values, 'label' => Mage::helper('reports')->__('Status'), 'title' => Mage::helper('reports')->__('Status')));
     $fieldset->addField('show_empty_rows', 'select', array('name' => 'show_empty_rows', 'options' => array('1' => 'Yes', '0' => 'No'), 'label' => Mage::helper('reports')->__('Show Empty Rows'), 'title' => Mage::helper('reports')->__('Show Empty Rows')));
     $form->addValues($this->getFilterData()->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:25,代码来源:Form.php

示例14: _prepareForm

 protected function _prepareForm()
 {
     $model = Mage::registry('tmcore_module');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setHtmlIdPrefix('module_');
     $stores = Mage::getSingleton('adminhtml/system_store')->getStoreOptionHash(true);
     if (isset($stores[0])) {
         $stores[0] = Mage::helper('adminhtml')->__('All Store Views');
     }
     if ($model->getDataVersion() && ($upgrades = $model->getUpgradesToRun())) {
         $fieldset = $form->addFieldset('upgrade_fieldset', array('legend' => Mage::helper('tmcore')->__('Upgrade Information'), 'class' => 'fieldset-wide'));
         $fieldset->addField('skip_upgrade', 'checkbox', array('name' => 'skip_upgrade', 'label' => Mage::helper('tmcore')->__('Activate this checkbox, if you want to skip the upgrade operations'), 'title' => Mage::helper('tmcore')->__('Activate this checkbox, if you want to skip the upgrade operations'), 'value' => 1));
         $label = Mage::helper('tmcore')->__('Module data will be upgraded from %s to %s at the following stores', $model->getDataVersion(), $upgrades[count($upgrades) - 1]);
         $fieldset->addField('installed_stores', 'textarea', array('label' => $label, 'title' => $label, 'value' => implode("\n", array_intersect_key($stores, array_flip($model->getStores()))), 'readonly' => 1));
     }
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('tmcore')->__('Install and Reinstall Information'), 'class' => 'fieldset-wide'));
     $fieldset->addField('code', 'hidden', array('name' => 'id'));
     if ($model->isValidationRequired()) {
         $note = '';
         if ($model->getRemote()) {
             $link = $model->getRemote()->getIdentityKeyLink();
             $note = Mage::helper('tmcore')->__('Get your identity key at <a href="%s" title="%s" target="_blank">%s</a>', $link, $link, $link);
         }
         $fieldset->addField('identity_key', 'textarea', array('name' => 'identity_key', 'required' => true, 'label' => Mage::helper('tmcore')->__('Identity Key'), 'title' => Mage::helper('tmcore')->__('Identity Key'), 'note' => $note));
     }
     $field = $fieldset->addField('new_stores', 'multiselect', array('name' => 'new_stores[]', 'label' => Mage::helper('tmcore')->__('Select stores to install or reinstall module'), 'title' => Mage::helper('tmcore')->__('Select stores to install or reinstall module'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
     $field->setRenderer($renderer);
     if ($installedStores = $model->getStores()) {
         $fieldset->addField('installed_stores_info', 'label', array('label' => Mage::helper('tmcore')->__('Module is already installed at following stores'), 'title' => Mage::helper('tmcore')->__('Module is already installed at following stores'), 'value' => implode(", ", array_intersect_key($stores, array_flip($installedStores))), 'readonly' => 1));
     }
     $form->addValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:xiaoguizhidao,项目名称:tyler-live,代码行数:35,代码来源:Main.php

示例15: _prepareForm

 /**
  *
  * return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('tax_rule');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('tax')->__('Tax Rule Information')));
     $productClasses = Mage::getModel('tax/class')->getCollection()->setClassTypeFilter(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT)->toOptionArray();
     $customerClasses = Mage::getModel('tax/class')->getCollection()->setClassTypeFilter(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER)->toOptionArray();
     /**
      * Get rates array without memory leak
      */
     $rates = Mage::getModel('tax/calculation_rate')->getCollection()->getOptionRates();
     $fieldset->addField('code', 'text', array('name' => 'code', 'label' => Mage::helper('tax')->__('Name'), 'class' => 'required-entry', 'required' => true));
     $fieldset->addField('tax_customer_class', 'multiselect', array('name' => 'tax_customer_class', 'label' => Mage::helper('tax')->__('Customer Tax Class'), 'class' => 'required-entry', 'values' => $customerClasses, 'value' => $model->getCustomerTaxClasses(), 'required' => true));
     $fieldset->addField('tax_product_class', 'multiselect', array('name' => 'tax_product_class', 'label' => Mage::helper('tax')->__('Product Tax Class'), 'class' => 'required-entry', 'values' => $productClasses, 'value' => $model->getProductTaxClasses(), 'required' => true));
     $fieldset->addField('tax_rate', 'multiselect', array('name' => 'tax_rate', 'label' => Mage::helper('tax')->__('Tax Rate'), 'class' => 'required-entry', 'values' => $rates, 'value' => $model->getRates(), 'required' => true));
     $fieldset->addField('priority', 'text', array('name' => 'priority', 'label' => Mage::helper('tax')->__('Priority'), 'class' => 'validate-not-negative-number', 'value' => (int) $model->getPriority(), 'required' => true, 'note' => Mage::helper('tax')->__('Tax rates at the same priority are added, others are compounded.')));
     $fieldset->addField('calculate_subtotal', 'checkbox', array('name' => 'calculate_subtotal', 'label' => Mage::helper('tax')->__('Calculate off subtotal only'), 'onclick' => 'this.value = this.checked ? 1 : 0;', 'checked' => $model->getCalculateSubtotal()));
     $fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('tax')->__('Sort Order'), 'class' => 'validate-not-negative-number', 'value' => (int) $model->getPosition(), 'required' => true));
     if ($model->getId() > 0) {
         $fieldset->addField('tax_calculation_rule_id', 'hidden', array('name' => 'tax_calculation_rule_id', 'value' => $model->getId(), 'no_span' => true));
     }
     $form->addValues($model->getData());
     $form->setAction($this->getUrl('*/tax_rule/save'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
开发者ID:okite11,项目名称:frames21,代码行数:31,代码来源:Form.php


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