本文整理汇总了PHP中XoopsFormSelect::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsFormSelect::getName方法的具体用法?PHP XoopsFormSelect::getName怎么用?PHP XoopsFormSelect::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsFormSelect
的用法示例。
在下文中一共展示了XoopsFormSelect::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
//.........这里部分代码省略.........
$allgroupsq = q("SELECT groupid FROM " . $xoopsDB->prefix("groups"));
// . " WHERE groupid != " . XOOPS_GROUP_USERS); // removed exclusion of registered users group March 18 2009, since it doesn't make sense in this situation. All groups should mean everyone, period.
foreach ($allgroupsq as $thisgid) {
$groups[] = $thisgid['groupid'];
}
}
}
}
$namelist = gatherNames($groups, $nametype, $ele_value[6], $ele_value[5]);
foreach ($namelist as $auid => $aname) {
$options[$auid] = $aname;
}
} elseif ($i['key'] === "{SELECTEDNAMES}") {
// loadValue in formDisplay will create a second option with this key that contains an array of the selected values
$selected = $i['value'];
} elseif ($i['key'] === "{OWNERGROUPS}") {
// do nothing with this piece of metadata that gets set in loadValue, since it's used above
} else {
// regular selection list....
$options[$opt_count] = $myts->stripSlashesGPC($i['key']);
if (strstr($i['key'], _formulize_OUTOFRANGE_DATA)) {
$hiddenOutOfRangeValuesToWrite[$opt_count] = str_replace(_formulize_OUTOFRANGE_DATA, "", $i['key']);
// if this is an out of range value, grab the actual value so we can stick it in a hidden element later
}
if ($i['value'] > 0) {
$selected[] = $opt_count;
}
$opt_count++;
}
}
$count = count($options);
$size = $ele_value[0];
$final_size = $count < $size ? $count : $size;
$form_ele1 = new XoopsFormSelect($caption, $markupName, $selected, $final_size, $ele_value[1]);
$form_ele1->setExtra("onchange=\"javascript:formulizechanged=1;\" jquerytag='{$markupName}'");
// must check the options for uitext before adding to the element -- aug 25, 2007
foreach ($options as $okey => $ovalue) {
$options[$okey] = formulize_swapUIText($ovalue, $element->getVar('ele_uitext'));
}
$form_ele1->addOptionArray($options);
if ($selected) {
if (is_array($selected)) {
$hiddenElementName = $ele_value[1] ? $form_ele1->getName() . "[]" : $form_ele1->getName();
foreach ($selected as $thisSelected) {
$disabledOutputText[] = $options[$thisSelected];
$disabledHiddenValue[] = "<input type=hidden name=\"{$hiddenElementName}\" value=\"{$thisSelected}\">";
}
} elseif ($ele_value[1]) {
// need to keep [] in the hidden element name if multiple values are expected, even if only one is chosen
$disabledOutputText[] = $options[$selected];
$disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "[]\" value=\"{$selected}\">";
} else {
$disabledOutputText[] = $options[$selected];
$disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "\" value=\"{$selected}\">";
}
}
$renderedHoorvs = "";
if (count($hiddenOutOfRangeValuesToWrite) > 0) {
foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
$thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
$renderedHoorvs .= $thisHoorv->render() . "\n";
unset($thisHoorv);
}
}
if ($isDisabled) {
$disabledHiddenValues = implode("\n", $disabledHiddenValue);
// glue the individual value elements together into a set of values
$renderedElement = implode(", ", $disabledOutputText);
} elseif ($ele_value[8] == 1) {
// autocomplete construction: make sure that $renderedElement is the final output of this chunk of code
// write the possible values to a cached file so we can look them up easily when we need them, don't want to actually send them to the browser, since it could be huge, but don't want to replicate all the logic that has already gathered the values for us, each time there's an ajax request
$cachedOptionsFileName = "formulize_Options_" . str_replace(".", "", microtime(true));
formulize_scandirAndClean(XOOPS_ROOT_PATH . "/cache/", "formulize_Options_");
$cachedOptions = fopen(XOOPS_ROOT_PATH . "/cache/{$cachedOptionsFileName}", "w");
fwrite($cachedOptions, "<?php\n\r");
$maxLength = 0;
foreach ($options as $id => $text) {
$thisTextLength = strlen($text);
$maxLength = $thisTextLength > $maxLength ? $thisTextLength : $maxLength;
//$quotedText = "\"".str_replace("\"", "\\\"", trim($text))."\"";
$quotedText = "\"" . str_replace("\"", "\\\"", $text) . "\"";
fwrite($cachedOptions, "if(stristr({$quotedText}, \$term)){ \$found[]='[{$quotedText},{$id}]'; }\n\r");
}
fwrite($cachedOptions, "?>");
fclose($cachedOptions);
//print_r($selected); print_r($options);
$defaultSelected = is_array($selected) ? $selected[0] : $selected;
$renderedComboBox = $renderer->formulize_renderQuickSelect($markupName, $cachedOptionsFileName, $defaultSelected, $options[$defaultSelected], $maxLength);
$form_ele2 = new xoopsFormLabel($caption, $renderedComboBox);
$renderedElement = $form_ele2->render();
} else {
// normal element
$renderedElement = $form_ele1->render();
}
$form_ele = new XoopsFormLabel($caption, "<nobr>{$renderedElement}</nobr>\n{$renderedHoorvs}\n{$disabledHiddenValues}\n");
$form_ele->setDescription(html_entity_decode($ele_desc, ENT_QUOTES));
}
// end of if we have a link on our hands. -- jwe 7/29/04
return $form_ele;
}
示例2: constructElement
//.........这里部分代码省略.........
foreach ($namelist as $auid => $aname) {
$options[$auid] = $aname;
}
} elseif ($i['key'] === "{SELECTEDNAMES}") {
// loadValue in formDisplay will create a second option with this key that contains an array of the selected values
$selected = $i['value'];
} elseif ($i['key'] === "{OWNERGROUPS}") {
// do nothing with this piece of metadata that gets set in loadValue, since it's used above
} else {
// regular selection list....
$options[$opt_count] = $myts->stripSlashesGPC($i['key']);
if (strstr($i['key'], _formulize_OUTOFRANGE_DATA)) {
$hiddenOutOfRangeValuesToWrite[$opt_count] = str_replace(_formulize_OUTOFRANGE_DATA, "", $i['key']);
// if this is an out of range value, grab the actual value so we can stick it in a hidden element later
}
if ($i['value'] > 0) {
$selected[] = $opt_count;
}
$opt_count++;
}
}
$count = count($options);
$size = $ele_value[0];
$final_size = $count < $size ? $count : $size;
$form_ele1 = new XoopsFormSelect($ele_caption, $form_ele_id, $selected, $final_size, $ele_value[1]);
$form_ele1->setExtra("onchange=\"javascript:formulizechanged=1;\" jquerytag='{$form_ele_id}'");
// must check the options for uitext before adding to the element -- aug 25, 2007
foreach ($options as $okey => $ovalue) {
$options[$okey] = formulize_swapUIText($ovalue, $this->_ele->getVar('ele_uitext'));
}
$form_ele1->addOptionArray($options);
if ($selected) {
if (is_array($selected)) {
$hiddenElementName = $ele_value[1] ? $form_ele1->getName() . "[]" : $form_ele1->getName();
foreach ($selected as $thisSelected) {
$disabledOutputText[] = $options[$thisSelected];
$disabledHiddenValue[] = "<input type=hidden name=\"{$hiddenElementName}\" value=\"{$thisSelected}\">";
}
} elseif ($ele_value[1]) {
// need to keep [] in the hidden element name if multiple values are expected, even if only one is chosen
$disabledOutputText[] = $options[$selected];
$disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "[]\" value=\"{$selected}\">";
} else {
$disabledOutputText[] = $options[$selected];
$disabledHiddenValue[] = "<input type=hidden name=\"" . $form_ele1->getName() . "\" value=\"{$selected}\">";
}
}
$renderedHoorvs = "";
if (count($hiddenOutOfRangeValuesToWrite) > 0) {
foreach ($hiddenOutOfRangeValuesToWrite as $hoorKey => $hoorValue) {
$thisHoorv = new xoopsFormHidden('formulize_hoorv_' . $true_ele_id . '_' . $hoorKey, $hoorValue);
$renderedHoorvs .= $thisHoorv->render() . "\n";
unset($thisHoorv);
}
}
if ($isDisabled) {
$disabledHiddenValues = implode("\n", $disabledHiddenValue);
// glue the individual value elements together into a set of values
$renderedElement = implode(", ", $disabledOutputText);
} elseif ($ele_value[8] == 1) {
// autocomplete construction: make sure that $renderedElement is the final output of this chunk of code
// write the possible values to a cached file so we can look them up easily when we need them,
//don't want to actually send them to the browser, since it could be huge,
//but don't want to replicate all the logic that has already gathered the values for us, each time there's an ajax request
$cachedLinkedOptionsFileName = "formulize_Options_" . str_replace(".", "", microtime(true));
formulize_scandirAndClean(XOOPS_ROOT_PATH . "/cache/", "formulize_Options_");