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


PHP HTML_QuickForm_Renderer_Default类代码示例

本文整理汇总了PHP中HTML_QuickForm_Renderer_Default的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_Renderer_Default类的具体用法?PHP HTML_QuickForm_Renderer_Default怎么用?PHP HTML_QuickForm_Renderer_Default使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: toHtml


//.........这里部分代码省略.........

function _hs_swapOptions(form, groupName, selectIndex)
{
    var hsValue = [];
    for (var i = 0; i <= selectIndex; i++) {
        hsValue[i] = _hs_findSelect(form, groupName, i).value;
    }

    _hs_replaceOptions(_hs_findSelect(form, groupName, selectIndex + 1),
                       _hs_findOptions(_hs_options[groupName][selectIndex], hsValue));
    if (selectIndex + 1 < _hs_options[groupName].length) {
        _hs_swapOptions(form, groupName, selectIndex + 1);
    }
}

function _hs_onReset(form, groupNames)
{
    for (var i = 0; i < groupNames.length; i++) {
        try {
            for (var j = 0; j <= _hs_options[groupNames[i]].length; j++) {
                _hs_setValue(_hs_findSelect(form, groupNames[i], j), _hs_defaults[groupNames[i]][j]);
                if (j < _hs_options[groupNames[i]].length) {
                    _hs_replaceOptions(_hs_findSelect(form, groupNames[i], j + 1),
                                       _hs_findOptions(_hs_options[groupNames[i]][j], _hs_defaults[groupNames[i]].slice(0, j + 1)));
                }
            }
        } catch (e) {
            if (!(e instanceof TypeError)) {
                throw e;
            }
        }
    }
}

function _hs_setupOnReset(form, groupNames)
{
    setTimeout(function() { _hs_onReset(form, groupNames); }, 25);
}

function _hs_onReload()
{
    var ctl;
    for (var i = 0; i < document.forms.length; i++) {
        for (var j in _hs_defaults) {
            if (ctl = _hs_findSelect(document.forms[i], j, 0)) {
                for (var k = 0; k < _hs_defaults[j].length; k++) {
                    _hs_setValue(_hs_findSelect(document.forms[i], j, k), _hs_defaults[j][k]);
                }
            }
        }
    }

    if (_hs_prevOnload) {
        _hs_prevOnload();
    }
}

var _hs_prevOnload = null;
if (window.onload) {
    _hs_prevOnload = window.onload;
}
window.onload = _hs_onReload;

var _hs_options = {};
var _hs_defaults = {};

JAVASCRIPT;
                define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
            }
            // option lists
            $jsParts = array();
            for ($i = 1; $i < $this->_nbElements; $i++) {
                $jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]);
            }
            $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" . implode(",\n", $jsParts) . "\n];\n";
            // default value; if we don't actually have any values yet just use
            // the first option (for single selects) or empty array (for multiple)
            $values = array();
            foreach (array_keys($this->_elements) as $key) {
                if (is_array($v = $this->_elements[$key]->getValue())) {
                    $values[] = count($v) > 1 ? $v : $v[0];
                } else {
                    // XXX: accessing the supposedly private _options array
                    $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0]) ? array() : $this->_elements[$key]->_options[0]['attr']['value'];
                }
            }
            $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " . $this->_convertArrayToJavascript($values, false) . ";\n";
        }
        include_once 'HTML/QuickForm/Renderer/Default.php';
        $renderer = new HTML_QuickForm_Renderer_Default();
        $renderer->setElementTemplate('{element}');
        parent::accept($renderer);
        if (!empty($onChange)) {
            $keys = array_keys($this->_elements);
            for ($i = 0; $i < count($keys) - 1; $i++) {
                $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i]));
            }
        }
        return (empty($this->_js) ? '' : "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") . $renderer->toHtml();
    }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:101,代码来源:hierselect.php

示例2: toHtml

 /**
  * Returns HTML for submitlink form element.
  *
  * @return string
  */
 function toHtml()
 {
     require_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     parent::accept($renderer);
     return $renderer->toHtml();
 }
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:13,代码来源:tags.php

示例3: toHtml

 /**
  * Returns Html for the group
  *
  * @since       1.0
  * @access      public
  * @return      string
  */
 function toHtml()
 {
     // Modified by Ivan Tcholakov, 16-MAR-2010. Suppressing a deprecation warning on PHP 5.3
     //$renderer =& new HTML_QuickForm_Renderer_Default();
     $renderer = new HTML_QuickForm_Renderer_Default();
     //
     $renderer->setElementTemplate('{element}');
     $this->accept($renderer);
     return $renderer->toHtml();
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:17,代码来源:group.php

示例4: HTML_QuickForm_Renderer_Dataface

 function HTML_QuickForm_Renderer_Dataface(&$form)
 {
     $this->_skinTool =& Dataface_SkinTool::getInstance();
     parent::HTML_QuickForm_Renderer_Default();
     $this->setRequiredNoteTemplate('');
 }
开发者ID:minger11,项目名称:Pipeline,代码行数:6,代码来源:Dataface.php

示例5: toHtml

 /**
  * Returns Html for the group
  * 
  * @since       1.0
  * @access      public
  * @return      string
  */
 function toHtml()
 {
     include_once(dirname(__FILE__) . '/Renderer/Default.php');
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     $this->accept($renderer);
     return $renderer->toHtml();
 } //end func toHtml
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:15,代码来源:group.php

示例6: toHtml

 /**
  * Returns Html for the group
  * 
  * @access    public
  * @return    string
  */
 function toHtml()
 {
     if ($this->_flagFrozen) {
         $this->_js = '';
     } else {
         // set the onchange attribute for each element
         $keys = array_keys($this->_elements);
         $nbElements = count($keys);
         $nbElementsUsingFnc = $nbElements - 1;
         // last element doesn't need it
         for ($i = 0; $i < $nbElementsUsingFnc; $i++) {
             $select = $this->_elements[$keys[$i]];
             $select->updateAttributes(array('onChange' => 'swapOptions(this, \'' . $this->getName() . '\', ' . $keys[$i] . ', ' . $nbElements . ', \'' . $this->_jsArrayName . '\');'));
         }
         // create the js function to call
         if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
             $this->_js .= "function swapOptions(frm, grpName, eleIndex, nbElements, arName)\n" . "{\n" . "  var n = \"\";\n" . "  var ctl;\n\n" . "  for (var i = 0; i < nbElements; i++) {\n" . "    ctl = frm.form[grpName+'['+i+']'];\n" . "    if (!ctl) {\n" . "      ctl = frm.form[grpName+'['+i+'][]'];\n" . "    }\n" . "    if (i <= eleIndex) {\n" . "      n += \"_\"+ctl.value;\n" . "    } else {\n" . "      ctl.length = 0;\n" . "    }\n" . "  }\n\n" . "  var t = eval(\"typeof(\"+arName + n +\")\");\n" . "  if (t != 'undefined') {\n" . "    var the_array = eval(arName+n);\n" . "    var j = 0;\n" . "    n = eleIndex + 1;\n" . "    ctl = frm.form[grpName+'['+ n +']'];\n" . "    if (!ctl) {\n" . "      ctl = frm.form[grpName+'['+ n +'][]'];\n" . "    }\n" . "    for (var i in the_array) {\n" . "      opt = new Option(the_array[i], i, false, false);\n" . "      ctl.options[j++] = opt;\n" . "    }\n" . "  }\n" . "  if (eleIndex+1 < nbElements) {\n" . "    swapOptions(frm, grpName, eleIndex+1, nbElements, arName);\n" . "  }\n" . "}\n";
             define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
         }
     }
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     parent::accept($renderer);
     return "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>" . $renderer->toHtml();
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:32,代码来源:hierselect.php

示例7: toHtml

 function toHtml()
 {
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     $renderer->setGroupElementTemplate('<div>{element}</div>', $this->_elementName);
     parent::accept($renderer);
     return str_replace('&nbsp;', '', $renderer->toHtml());
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:9,代码来源:timestamp.php

示例8: export_for_template

 public function export_for_template(renderer_base $output)
 {
     global $OUTPUT;
     $context = $this->export_for_template_base($output);
     $this->_renderedfromtemplate = true;
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $elements = [];
     $name = $this->getName();
     $i = 0;
     foreach ($this->_elements as $key => $element) {
         $elementname = '';
         if ($this->_appendName) {
             $elementname = $element->getName();
             if (isset($elementname)) {
                 $element->setName($name . '[' . (strlen($elementname) ? $elementname : $key) . ']');
             } else {
                 $element->setName($name);
             }
         }
         $element->_generateId();
         $out = $OUTPUT->mform_element($element, false, false, '', true);
         if (empty($out)) {
             $renderer = new HTML_QuickForm_Renderer_Default();
             $renderer->setElementTemplate('{element}');
             $element->accept($renderer);
             $out = $renderer->toHtml();
         }
         // Replicates the separator logic from 'pear/HTML/QuickForm/Renderer/Default.php'.
         $separator = '';
         if ($i > 0) {
             if (is_array($this->_separator)) {
                 $separator = $this->_separator[($i - 1) % count($this->_separator)];
             } else {
                 if ($this->_separator === null) {
                     $separator = '&nbsp;';
                 } else {
                     $separator = (string) $this->_separator;
                 }
             }
         }
         $elements[] = ['separator' => $separator, 'html' => $out];
         // Restore the element's name.
         if ($this->_appendName) {
             $element->setName($elementname);
         }
         $i++;
     }
     $context['elements'] = $elements;
     return $context;
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:50,代码来源:group.php

示例9: toHtml

 function toHtml()
 {
     $this->_js = '';
     if (!defined('HTML_QUICKFORM_ADVANDATE_EXISTS')) {
         $this->_js .= "\n\n\t\t\t    var advandate_Update = function(groupName) {\n\t\t\t\t\t  value=\$('select[name=\"'+groupName+'[firstselect]\"]').val();\n\t\t\t\t\t\tfirstD = \$('select[name^=\"'+groupName+'[firstdate]\"]');\n            \$(firstD).hide();\n\t\t\t\t\t\tsecD = \$('select[name^=\"'+groupName+'[seconddate]\"]');\n            \$(secD).hide();\n\t\t\t\t\t\tnbunits=\$('select[name=\"'+groupName+'[nbunits]\"]');\n            \$(nbunits).hide();\n\t\t\t\t\t\tunit=\$('select[name=\"'+groupName+'[unit]\"]');\n            \$(unit).hide();\n\t\t\t\t\t\tseparator=\$('#" . $this->_escapeString($this->getName()) . "_dates_separator');\n\t\t\t\t\t\tseparator.hide();\n\t\t\t\t  if( value=='is' && \$(\"input[name='created_at[firstselect]']\").val() != 'is' )\n\t\t\t\t  {\n            today = new Date();\n            \$(firstD[0]).val(today.getDate());\n            \$(firstD[1]).val(today.getMonth()+1);\n            \$(firstD[2]).val(today.getFullYear());\n\t\t\t\t  }\n\t\t\t\t\tif(value=='before' || value=='after' || value=='is') {\n            \$(firstD).show();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (value=='between'){\n              \$(firstD).show();\n              \$(secD).show();\n\t\t\t\t\t\t\tseparator.show();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (value=='inthelast'){\n                \$(nbunits).show();\n                \$(unit).show();\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (value=='lastmonth'){\n\t\t\t\t\t\t\t\t\t// Nothing to show\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}";
         define('HTML_QUICKFORM_ADVANDATE_EXISTS', TRUE);
     }
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     parent::accept($renderer);
     if (class_exists('Mtpl')) {
         $script = (empty($this->_js) ? '' : $this->_js) . "\n\$(function(){advandate_Update('" . $this->_escapeString($this->getName()) . "');\n            \$('select[name=\"" . $this->_escapeString($this->getName()) . "[firstselect]\"]').bind('change',function(){advandate_Update('" . $this->_escapeString($this->getName()) . "')});\n            });";
         Mtpl::addJSinline($script);
         return $renderer->toHtml();
     } else {
         return "<script type=\"text/javascript\">\n//<![CDATA[\n" . (empty($this->_js) ? '' : $this->_js) . "\n\$(function(){advandate_Update('" . $this->_escapeString($this->getName()) . "');\n            \$('select[name=\"" . $this->_escapeString($this->getName()) . "[firstselect]\"]').bind('change',function(){advandate_Update('" . $this->_escapeString($this->getName()) . "')});\n            });//]]>\n</script>" . $renderer->toHtml();
     }
 }
开发者ID:demental,项目名称:m,代码行数:19,代码来源:advandate.php

示例10: toHtml

 /**
  * Returns Html for the group
  *
  * @since       1.0
  * @access      public
  * @return string
  */
 public function toHtml()
 {
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     $this->accept($renderer);
     return $renderer->toHtml();
 }
开发者ID:YesWiki,项目名称:yeswiki-sandstorm,代码行数:15,代码来源:group.php

示例11: toHtml

 /**
  * Returns HTML for advchecbox form element.
  *
  * @return string
  */
 function toHtml()
 {
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     parent::accept($renderer);
     $html = $this->_wrap[0];
     if ($this->_usedcreateelement) {
         $html .= html_writer::tag('span', $renderer->toHtml(), array('class' => 'fdate_time_selector'));
     } else {
         $html .= $renderer->toHtml();
     }
     $html .= $this->_wrap[1];
     return $html;
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:20,代码来源:datetimeselector.php

示例12: toHtml

 /**
  * Returns Html for the group
  *
  * @since       1.0
  * @access      public
  * @return      string
  */
 public function toHtml()
 {
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     $this->accept($renderer);
     return $renderer->toHtml();
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:14,代码来源:group.php

示例13: toHtml

 function toHtml()
 {
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $renderer = new HTML_QuickForm_Renderer_Default();
     $renderer->setElementTemplate('{element}');
     parent::accept($renderer);
     return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1];
 }
开发者ID:cretzu89,项目名称:EPESI,代码行数:8,代码来源:date.php

示例14: export_for_template

 public function export_for_template(renderer_base $output)
 {
     global $OUTPUT;
     $context = $this->export_for_template_base($output);
     $this->_renderedfromtemplate = true;
     include_once 'HTML/QuickForm/Renderer/Default.php';
     $elements = [];
     $name = $this->getName();
     foreach ($this->_elements as $key => $element) {
         $elementname = '';
         if ($this->_appendName) {
             $elementname = $element->getName();
             if (isset($elementname)) {
                 $element->setName($name . '[' . (strlen($elementname) ? $elementname : $key) . ']');
             } else {
                 $element->setName($name);
             }
         }
         $element->_generateId();
         $out = $OUTPUT->mform_element($element, false, false, '', true);
         if (empty($out)) {
             $renderer = new HTML_QuickForm_Renderer_Default();
             $renderer->setElementTemplate('{element}');
             $element->accept($renderer);
             $out = $renderer->toHtml();
         }
         $elements[] = $out;
         // Restore the element's name.
         if ($this->_appendName) {
             $element->setName($elementname);
         }
     }
     $context['elements'] = $elements;
     return $context;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:35,代码来源:group.php

示例15: startForm

 /**
  * Called when visiting a form, before processing any form elements
  *
  * @param    object      An HTML_QuickForm object being visited
  * @access   public
  * @return   void
  */
 function startForm(&$form)
 {
     $this->_fieldsetsOpen = 0;
     parent::startForm($form);
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:12,代码来源:Tableless.php


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