本文整理汇总了PHP中CForm::GetDropDownField方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::GetDropDownField方法的具体用法?PHP CForm::GetDropDownField怎么用?PHP CForm::GetDropDownField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::GetDropDownField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowInput
/**
* <p>Вставка полей ответа на вопрос в шаблон. Параметры поля ввода задаются в настройках вопроса.</p>
*
*
* @param string $FIELD_SID Строковой идентификатор поля вопроса. Обязательный параметр.
*
* @param $string CSS-класс для подписи к полю ввода. Необязательный параметр.
*
* @param mixed $CSSClass = ""]
*
* @return string <p>Возвращается HTML-код для вставки полей формы</p> <a
* name="examples"></a><h4>Использование</h4> <pre class="syntax"> <?=$FORM->ShowInput('MYFIELD_5')?>
* </pre>
*
* <h4>See Also</h4>
* <menu> <li><a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/index.php">Класс CFormOutput</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaption.php">CFormOutput::ShowInputCaption</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaptionimage.php">CFormOutput::ShowInputCaptionImage</a></li>
* </menu></b<br><br>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinput.php
* @author Bitrix
*/
public function ShowInput($FIELD_SID, $caption_css_class = '')
{
$arrVALUES = $this->arrVALUES;
if (is_array($this->arAnswers[$FIELD_SID])) {
$res = "";
reset($this->arAnswers[$FIELD_SID]);
if (is_array($this->arDropDown[$FIELD_SID])) {
reset($this->arDropDown[$FIELD_SID]);
}
if (is_array($this->arMutiselect[$FIELD_SID])) {
reset($this->arMutiselect[$FIELD_SID]);
}
while (list($key, $arAnswer) = each($this->arAnswers[$FIELD_SID])) {
if ($arAnswer["FIELD_TYPE"] == "dropdown" && $show_dropdown == "Y") {
continue;
}
if ($arAnswer["FIELD_TYPE"] == "multiselect" && $show_multiselect == "Y") {
continue;
}
if ($key > 0) {
$res .= "<br />";
}
switch ($arAnswer["FIELD_TYPE"]) {
case "radio":
$ans_id = "form_checkbox_" . $FIELD_SID . "_" . $arAnswer['ID'];
$arAnswer['FIELD_PARAM'] .= ' id="' . $ans_id . '"';
$value = CForm::GetRadioValue($FIELD_SID, $arAnswer, $arrVALUES);
$input = CForm::GetRadioField($FIELD_SID, $arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]);
if (strlen($ans_id) > 0) {
$res .= $input;
$res .= "<label for=\"" . $ans_id . "\">";
$res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>";
} else {
$res .= "<label>";
$res .= $input;
$res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>";
}
break;
case "checkbox":
$ans_id = "form_checkbox_" . $FIELD_SID . "_" . $arAnswer['ID'];
$arAnswer['FIELD_PARAM'] .= ' id="' . $ans_id . '"';
$value = CForm::GetCheckBoxValue($FIELD_SID, $arAnswer, $arrVALUES);
$input = CForm::GetCheckBoxField($FIELD_SID, $arAnswer["ID"], $value, $arAnswer["FIELD_PARAM"]);
if (strlen($ans_id) > 0) {
$res .= $input;
$res .= "<label for=\"" . $ans_id . "\">";
$res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>";
} else {
$res .= "<label>";
$res .= $input;
$res .= "<span class=\"" . $caption_css_class . "\"> " . $arAnswer["MESSAGE"] . "</span></label>";
}
break;
case "dropdown":
if ($show_dropdown != "Y") {
$value = CForm::GetDropDownValue($FIELD_SID, $this->arDropDown, $arrVALUES);
$res .= CForm::GetDropDownField($FIELD_SID, $this->arDropDown[$FIELD_SID], $value, $arAnswer["FIELD_PARAM"]);
$show_dropdown = "Y";
}
break;
case "multiselect":
if ($show_multiselect != "Y") {
$value = CForm::GetMultiSelectValue($FIELD_SID, $this->arMultiSelect, $arrVALUES);
$res .= CForm::GetMultiSelectField($FIELD_SID, $this->arMultiSelect[$FIELD_SID], $value, $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"]);
$show_multiselect = "Y";
}
break;
case "text":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetTextValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetTextField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
//.........这里部分代码省略.........
示例2: count
if ($show_dropdown!="Y")
{
$value = CForm::GetDropDownValue($FIELD_SID, $arResult["arDropDown"], $arResult["arrVALUES"]);
if (strlen($arResult["FORM_ERROR"]) > 0)
{
$c = count($arDropDown[$FIELD_SID]["param"])-1;
for ($i=0;$i<=$c;$i++)
{
$arDropDown[$FIELD_SID]["param"][$i] = preg_replace("/checked|selected/i", "", $arDropDown[$FIELD_SID]["param"][$i]);
}
}
$res .= CForm::GetDropDownField(
$FIELD_SID,
$arResult["arDropDown"][$FIELD_SID],
$value,
$arAnswer["FIELD_PARAM"]);
$show_dropdown = "Y";
}
$arResult["QUESTIONS"][$FIELD_SID]["HTML_CODE"][] = $res;
break;
case "multiselect":
if ($show_multiselect!="Y")
{
$value = CForm::GetMultiSelectValue($FIELD_SID, $arResult["arMultiSelect"], $arResult["arrVALUES"]);
if (strlen($arResult["FORM_ERROR"]) > 0)
{
示例3: intval
}
if ($arResult["arForm"]["SID"] == "SERVICE_ORDER") {
$current_value = intval($_REQUEST['form_type']);
$question_sid = 'REQUEST_TYPE';
if ($GLOBALS['USER']->IsAdmin()) {
foreach ($arResult['arDropDown'][$question_sid]['reference'] as $key => $MESSAGE) {
$arResult['arDropDown'][$question_sid]['reference'][$key] = '[' . $arResult['arDropDown'][$question_sid]['reference_id'][$key] . '] ' . $MESSAGE;
}
}
$arResult['QUESTIONS'][$question_sid]['HTML_CODE'] = CForm::GetDropDownField($question_sid, $arResult["arDropDown"][$question_sid], $current_value);
}
if ($arResult["arForm"]["SID"] == "TROUBLESHOOTING") {
$current_value = intval($_REQUEST['form_type']);
$question_sid = 'REQUEST_TYPE';
if ($GLOBALS['USER']->IsAdmin()) {
foreach ($arResult['arDropDown'][$question_sid]['reference'] as $key => $MESSAGE) {
$arResult['arDropDown'][$question_sid]['reference'][$key] = '[' . $arResult['arDropDown'][$question_sid]['reference_id'][$key] . '] ' . $MESSAGE;
}
}
$arResult['QUESTIONS'][$question_sid]['HTML_CODE'] = CForm::GetDropDownField($question_sid, $arResult["arDropDown"][$question_sid], $current_value);
}
if ($arResult["arForm"]["SID"] == "DIRECTION") {
$current_value = intval($_REQUEST['form_type']);
$question_sid = 'REQUEST_TYPE';
if ($GLOBALS['USER']->IsAdmin()) {
foreach ($arResult['arDropDown'][$question_sid]['reference'] as $key => $MESSAGE) {
$arResult['arDropDown'][$question_sid]['reference'][$key] = '[' . $arResult['arDropDown'][$question_sid]['reference_id'][$key] . '] ' . $MESSAGE;
}
}
$arResult['QUESTIONS'][$question_sid]['HTML_CODE'] = CForm::GetDropDownField($question_sid, $arResult["arDropDown"][$question_sid], $current_value);
}