本文整理汇总了PHP中HTML_QuickForm_group::accept方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm_group::accept方法的具体用法?PHP HTML_QuickForm_group::accept怎么用?PHP HTML_QuickForm_group::accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm_group
的用法示例。
在下文中一共展示了HTML_QuickForm_group::accept方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toHtml
/**
* HTML representation
*/
function toHtml()
{
include_once 'HTML/QuickForm/Renderer/Default.php';
$this->_separator = '<br/>';
$renderer =& new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
$select_boxes = $this->_elements[2];
$select_boxes->setElementTemplate('<div style="margin-left:20px;display:block;" id="receivers_' . $select_boxes->getName() . '">' . $select_boxes->_elementTemplate . '</div>');
parent::accept($renderer);
$js = $this->getElementJS();
return $renderer->toHtml() . $js;
}
示例2: 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];
}
示例3: _hs_findOptions
//.........这里部分代码省略.........
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();
}
示例4: toHtml
function toHtml()
{
include_once 'HTML/QuickForm/Renderer/Default.php';
$renderer =& new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate($this->_wrap[0] . '{element}' . $this->_wrap[1]);
// $renderer->setGroupElementTemplate('{element}', $this->getName());
parent::accept($renderer);
return $renderer->toHtml();
}
示例5: 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.form, \'' . $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[grpName+'['+i+']'];\n" . " if (!ctl) {\n" . " ctl = frm[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[grpName+'['+ n +']'];\n" . " if (!ctl) {\n" . " ctl = frm[grpName+'['+ n +'][]'];\n" . " }\n" . " ctl.style.display = 'inline';\n" . " for (var i in the_array) {\n" . " opt = new Option(the_array[i], i, false, false);\n" . " ctl.options[j++] = opt;\n" . " }\n" . " } else {\n" . " n = eleIndex + 1;\n" . " ctl = frm[grpName+'['+n+']'];\n" . " if (!ctl) {\n" . " ctl = frm[grpName+'['+ n +'][]'];\n" . " }\n" . " if (ctl) {\n" . " ctl.style.display = 'none';\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);
$result = null;
if (!empty($this->_js)) {
$result .= "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>";
}
return $result . $renderer->toHtml();
}
示例6: 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(' ', '', $renderer->toHtml());
}
示例7: toHtml
function toHtml()
{
$this->_js = '';
if (!defined('HTML_QUICKFORM_NUMRANGE_EXISTS')) {
$this->_js .= "function numrange_Update(form, groupName) {\n\t\t\t\t\tindex=form[groupName+'[firstselect]'].selectedIndex;\n\t\t\t\t\tvalue=form[groupName+'[firstselect]'][index].value;\n\t\t\t\t\t\tfirstd=form[groupName+'[firstval]'];\n\t\t\t\t\t\tfirstd.style.display='none';\n\t\t\t\t\t\tsecondd=form[groupName+'[secondval]'];\n\t\t\t\t\t\tsecondd.style.display='none';\n\t\t\t\t\t\tseparator=\$('#" . $this->_escapeString($this->getName()) . "_texts_separator');\n\t\t\t\t\t\tseparator.hide();\n\t\t\t\t\tif(value=='=' || value=='<' || value=='>' || value=='<=' || value=='>=' || value=='%-' || value=='-%') {\n\t\t\t\t\t\tfirstd.style.display='inline';\n\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfirstd.style.display='inline';\n\t\t\t\t\t\t\tsecondd.style.display='inline';\n\t\t\t\t\t\t\tseparator.show();\n\t\t\t\t\t}\t\t\t\t\n\t\t\t\t}\n\t\t\t\t";
define('HTML_QUICKFORM_NUMRANGE_EXISTS', TRUE);
}
include_once 'HTML/QuickForm/Renderer/Default.php';
$renderer =& new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
return (empty($this->_js) ? '' : "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . ";\t\t\t\t\$(function(){\$('#firstselect_" . $this->_escapeString($this->getName()) . "').trigger('change');});//]]>\n</script>") . $renderer->toHtml();
}
示例8: 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();
}
}