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


PHP Varien_Data_Form_Element_Hidden::addClass方法代码示例

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


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

示例1: _toHtml

 protected function _toHtml()
 {
     $element = $this->getElement();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     $fieldset = $element->getForm()->getElement($this->getFieldsetId());
     $chooserId = $this->getUniqId();
     $config = $this->getConfig();
     // add chooser element to fieldset
     $chooser = $fieldset->addField('chooser' . $element->getId(), 'note', array('label' => $config->getLabel() ? $config->getLabel() : '', 'value_class' => 'value2'));
     $hiddenHtml = '';
     if ($this->getHiddenEnabled()) {
         $hidden = new Varien_Data_Form_Element_Hidden($element->getData());
         $hidden->setId("{$chooserId}value")->setForm($element->getForm());
         if ($element->getRequired()) {
             $hidden->addClass('required-entry');
         }
         $hiddenHtml = $hidden->getElementHtml();
         $element->setValue('');
     }
     $buttons = $config->getButtons();
     $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($chooserId . '.choose()');
     $delButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($chooserId . 'del_control')->setClass('btn-del-img')->setLabel(' Delete image ')->setOnclick('del(this)');
     $chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml() . $delButton->toHtml());
     // render label and chooser scripts
     $configJson = Mage::helper('core')->jsonEncode($config->getData());
     return '
         <label class="widget-option-label" id="' . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
         <div id="' . $chooserId . 'advice-container" class="hidden"></div>
         <script type="text/javascript">
             ' . $chooserId . ' = new WysiwygWidget.chooser("' . $chooserId . '", "' . $this->getSourceUrl() . '", ' . $configJson . ');
         </script>
     ';
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:33,代码来源:Widget.php

示例2: _toHtml

    /**
     * Return chooser HTML and init scripts
     *
     * @return string
     */
    protected function _toHtml()
    {
        $element = $this->getElement();
        /* @var $fieldset Varien_Data_Form_Element_Fieldset */
        $fieldset = $element->getForm()->getElement($this->getFieldsetId());
        $chooserId = $this->getUniqId();
        $config = $this->getConfig();
        // add chooser element to fieldset
        $chooser = $fieldset->addField('chooser' . $element->getId(), 'note', array('label' => $config->getLabel() ? $config->getLabel() : '', 'value_class' => 'value2'));
        $hiddenHtml = '';
        if ($this->getHiddenEnabled()) {
            $hidden = new Varien_Data_Form_Element_Hidden($element->getData());
            $hidden->setId("{$chooserId}value")->setForm($element->getForm());
            if ($element->getRequired()) {
                $hidden->addClass('required-entry');
            }
            $hiddenHtml = $hidden->getElementHtml();
            $element->setValue('');
        }
        $buttons = $config->getButtons();
        $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($chooserId . '.choose()')->setDisabled($element->getReadonly());
        $chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml());
        // render label and chooser scripts
        $configJson = Mage::helper('core')->jsonEncode($config->getData());
        return '
            <label class="widget-option-label" id="' . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
            <div id="' . $chooserId . 'advice-container" class="hidden"></div>
            <script type="text/javascript">//<![CDATA[
                (function() {
                    var instantiateChooser = function() {
                        window.' . $chooserId . ' = new WysiwygWidget.chooser(
                            "' . $chooserId . '",
                            "' . $this->getSourceUrl() . '",
                            ' . $configJson . '
                        );
                        if ($("' . $chooserId . 'value")) {
                            $("' . $chooserId . 'value").advaiceContainer = "' . $chooserId . 'advice-container";
                        }
                    }

                    if (document.loaded) { //allow load over ajax
                        instantiateChooser();
                    } else {
                        document.observe("dom:loaded", instantiateChooser);
                    }
                })();
            //]]></script>
        ';
    }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:54,代码来源:Chooser.php

示例3: _toHtml

 /**
  * Return chooser HTML and init scripts
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (is_null(Mage::registry('megamenu_adminhtml_widget_chooser'))) {
         return parent::_toHtml();
     }
     //unregister
     Mage::unregister('megamenu_adminhtml_widget_chooser');
     $element = $this->getElement();
     $htmlIdPrefix = $element->getForm()->getHtmlIdPrefix();
     /* @var $fieldset Varien_Data_Form_Element_Fieldset */
     // $fieldset  = $element->getForm()->getElement($this->getFieldsetId());// getForm >> getFieldset >> field
     $chooserId = $this->getUniqId();
     // echo $chooserId;die;	//options_fieldset_megamenu_sm_megamenu_product_id44c9ff3c66b2985cea68c24a0e23ef5b
     // $sourceUrl chua' megamenu gay loi khi ajax	 :http://127.0.0.1/mage1510/index.php/*megamenu*/catalog_product_widget/chooser/uniq_id/options_fieldset_megamenu_id_pathc0244322fc3e6acc4edb
     $admin = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
     $SourceUrl = str_replace("/megamenu/", "/{$admin}/", $this->getSourceUrl());
     $SourceUrl = str_replace("/uniq_id/", "/uniq_id/" . $htmlIdPrefix, $SourceUrl);
     $this->setSourceUrl($SourceUrl);
     $config = $this->getConfig();
     // add chooser element to fieldset
     // $chooser = $fieldset->addField('chooser' . $element->getId(), 'note', array(
     // 'label'       => $config->getLabel() ? $config->getLabel() : '',
     // 'value_class' => 'value2',
     // ));
     $hiddenHtml = '';
     if ($this->getHiddenEnabled()) {
         $hidden = new Varien_Data_Form_Element_Hidden($element->getData());
         $hidden->setId("{$chooserId}value")->setForm($element->getForm());
         if ($element->getRequired()) {
             $hidden->addClass('required-entry');
         }
         $hiddenHtml = $hidden->getElementHtml();
         $element->setValue('');
     }
     // $config->getData() ;// array(1) {    ["buttons"] => array(2) {      ["open"] => string(17) "Select Product..."      ["close"] => string(5) "Close"    }  }
     $configJson = Mage::helper('core')->jsonEncode($config->getData());
     $js = '
         <script type="text/javascript">
             ' . $htmlIdPrefix . $chooserId . ' = new WysiwygWidget.chooser("' . $htmlIdPrefix . $chooserId . '", "' . $this->getSourceUrl() . '", ' . $configJson . ');
             // $("' . $chooserId . 'value").advaiceContainer = "' . $chooserId . 'advice-container";
         </script>
     ';
     $buttons = $config->getButtons();
     $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($htmlIdPrefix . $chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($htmlIdPrefix . $chooserId . '.choose();$$(\'.' . $hidden->getName() . '\')[0].id=\'\';$$(\'.data_type\')[0].id=\'' . $htmlIdPrefix . $chooserId . 'value\';');
     // ->setOnclick($htmlIdPrefix.$chooserId.'.choose();$$(\'.'.$hidden->getName().'\')[0].name=$$(\'.data_type\')[0].name;');
     // $chooser->setData('after_element_html', $hiddenHtml . $chooseButton->toHtml().$js);
     // render label and chooser scripts
     $configJson = Mage::helper('core')->jsonEncode($config->getData());
     return '<div id="' . $htmlIdPrefix . 'box_' . $chooserId . '">
         <label style="background-color: #EEE2BE; float: left; font-size: 15px; height: 21px; width: 46%; margin-right:3px; overflow:hidden;" class="widget-option-label" id="' . $htmlIdPrefix . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
         <div id="' . $htmlIdPrefix . $chooserId . 'advice-container" class="hidden"></div>
     ' . $hiddenHtml . $chooseButton->toHtml() . $js . '</div>';
 }
开发者ID:Aerotexextintores,项目名称:novosite,代码行数:58,代码来源:Chooser.php

示例4: _toHtml

 /**
  * Return chooser HTML and init scripts
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (is_null(Mage::registry('megamenu_adminhtml_widget_chooser'))) {
         return parent::_toHtml();
     }
     Mage::unregister('megamenu_adminhtml_widget_chooser');
     $element = $this->getElement();
     $htmlIdPrefix = $element->getForm()->getHtmlIdPrefix();
     $chooserId = $this->getUniqId();
     $admin = Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
     $SourceUrl = str_replace("/megamenu/", "/{$admin}/", $this->getSourceUrl());
     $SourceUrl = str_replace("/uniq_id/", "/uniq_id/" . $htmlIdPrefix, $SourceUrl);
     $this->setSourceUrl($SourceUrl);
     $config = $this->getConfig();
     $hiddenHtml = '';
     if ($this->getHiddenEnabled()) {
         $hidden = new Varien_Data_Form_Element_Hidden($element->getData());
         $hidden->setId("{$chooserId}value")->setForm($element->getForm());
         if ($element->getRequired()) {
             $hidden->addClass('required-entry');
         }
         $hiddenHtml = $hidden->getElementHtml();
         $element->setValue('');
     }
     $configJson = Mage::helper('core')->jsonEncode($config->getData());
     $js = '
         <script type="text/javascript">
             ' . $htmlIdPrefix . $chooserId . ' = new WysiwygWidget.chooser("' . $htmlIdPrefix . $chooserId . '", "' . $this->getSourceUrl() . '", ' . $configJson . ');
         </script>
     ';
     $buttons = $config->getButtons();
     $chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setId($htmlIdPrefix . $chooserId . 'control')->setClass('btn-chooser')->setLabel($buttons['open'])->setOnclick($htmlIdPrefix . $chooserId . '.choose();$$(\'.' . $hidden->getName() . '\')[0].id=\'\';$$(\'.data_type\')[0].id=\'' . $htmlIdPrefix . $chooserId . 'value\';');
     $configJson = Mage::helper('core')->jsonEncode($config->getData());
     return '<div id="' . $htmlIdPrefix . 'box_' . $chooserId . '">
         <label style="background-color: #EEE2BE; float: left; font-size: 15px; height: 21px; width: 46%; margin-right:3px; overflow:hidden;" class="widget-option-label" id="' . $htmlIdPrefix . $chooserId . 'label">' . ($this->getLabel() ? $this->getLabel() : Mage::helper('widget')->__('Not Selected')) . '</label>
         <div id="' . $htmlIdPrefix . $chooserId . 'advice-container" class="hidden"></div>
     ' . $hiddenHtml . $chooseButton->toHtml() . $js . '</div>';
 }
开发者ID:omusico,项目名称:losvineros,代码行数:43,代码来源:Chooser.php


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