本文整理汇总了PHP中CForm::GetFileField方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::GetFileField方法的具体用法?PHP CForm::GetFileField怎么用?PHP CForm::GetFileField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::GetFileField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetMessage
if (intval($arFile["USER_FILE_ID"])>0)
{
$res .= "<a title=\"".GetMessage("FORM_VIEW_FILE")."\" target=\"_blank\" class=\"tablebodylink\" href=\"/freetrix/tools/form_show_file.php?rid=".$arParams["RESULT_ID"]."&hash=".$arFile["USER_FILE_HASH"]."&lang=".LANGUAGE_ID."\">".htmlspecialcharsbx($arFile["USER_FILE_NAME"])."</a> (";
$res .= CFile::FormatSize($arFile["USER_FILE_SIZE"]);
$res .= ") [ <a title=\"".str_replace("#FILE_NAME#", $arFile["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE"))."\" class=\"tablebodylink\" href=\"/freetrix/tools/form_show_file.php?rid=".$arParams["RESULT_ID"]."&hash=".$arFile["USER_FILE_HASH"]."&lang=".LANGUAGE_ID."&action=download\">".GetMessage("FORM_DOWNLOAD")."</a> ]<br />";
$res .= '<input type="checkbox" value="Y" name="form_file_'.$arAnswer['ID'].'_del" id="form_file_'.$arAnswer['ID'].'_del" /><label for="form_file_'.$arAnswer['ID'].'_del">'.GetMessage('FORM_DELETE_FILE').'</label><br />';
$res .= "<br />";
} //endif;
} //endif;
$res .= CForm::GetFileField(
$arAnswer["ID"],
$arAnswer["FIELD_WIDTH"],
"FILE",
0,
"",
$arAnswer["FIELD_PARAM"]);
$arResult["QUESTIONS"][$FIELD_SID]["HTML_CODE"][] = $res;
break;
} //endswitch;
} //endwhile;
} //endif(is_array($arAnswers[$FIELD_SID]));
elseif (is_array($arResult["arQuestions"][$FIELD_SID]) && $arResult["arQuestions"][$FIELD_SID]["ADDITIONAL"] == "Y")
{
示例2: ShowInput
//.........这里部分代码省略.........
case "password":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetPasswordValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetPasswordField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "email":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetEmailValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetEmailField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "url":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetUrlValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetUrlField($arAnswer["ID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "textarea":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
$value = CForm::GetTextAreaValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetTextAreaField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_HEIGHT"], $arAnswer["FIELD_PARAM"], $value);
break;
case "date":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . " (" . CSite::GetDateFormat("SHORT") . ")</span><br />";
}
$value = CForm::GetDateValue($arAnswer["ID"], $arAnswer, $arrVALUES);
$res .= CForm::GetDateField($arAnswer["ID"], $this->arForm["SID"], $value, $arAnswer["FIELD_WIDTH"], $arAnswer["FIELD_PARAM"]);
break;
case "image":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
if ($this->RESULT_ID) {
if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) {
if (intval($arFile["USER_FILE_ID"]) > 0) {
if ($arFile["USER_FILE_IS_IMAGE"] == "Y") {
$res .= CFile::ShowImage($arFile["USER_FILE_ID"], 0, 0, "border=0", "", true);
$res .= "<br />";
}
//endif;
}
//endif;
}
// endif
}
// endif
$res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "IMAGE", 0, "", $arAnswer["FIELD_PARAM"]);
break;
case "file":
if (strlen(trim($arAnswer["MESSAGE"])) > 0) {
$res .= "<span class=\"" . $caption_css_class . "\">" . $arAnswer["MESSAGE"] . "</span><br />";
}
if ($this->RESULT_ID) {
if ($arFile = CFormResult::GetFileByAnswerID($this->RESULT_ID, $arAnswer["ID"])) {
if (intval($arFile["USER_FILE_ID"]) > 0) {
$res .= "<a title=\"" . GetMessage("FORM_VIEW_FILE") . "\" target=\"_blank\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "\">" . htmlspecialcharsbx($arFile["USER_FILE_NAME"]) . "</a> (";
$res .= CFile::FormatSize($arFile["USER_FILE_SIZE"]);
$res .= ") [ <a title=\"" . str_replace("#FILE_NAME#", $arFile["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE")) . "\" class=\"tablebodylink\" href=\"/bitrix/tools/form_show_file.php?rid=" . $this->RESULT_ID . "&hash=" . $arFile["USER_FILE_HASH"] . "&lang=" . LANGUAGE_ID . "&action=download\">" . GetMessage("FORM_DOWNLOAD") . "</a> ]";
$res .= "<br /><br />";
}
//endif;
}
//endif;
}
$res .= CForm::GetFileField($arAnswer["ID"], $arAnswer["FIELD_WIDTH"], "FILE", 0, "", $arAnswer["FIELD_PARAM"]);
break;
}
//endswitch;
}
//endwhile;
return $res;
} elseif (is_array($this->arQuestions[$FIELD_SID]) && $this->arQuestions[$FIELD_SID]["ADDITIONAL"] == "Y") {
$res = "";
switch ($this->arQuestions[$FIELD_SID]["FIELD_TYPE"]) {
case "text":
$value = CForm::GetTextAreaValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
$res .= CForm::GetTextAreaField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], "60", "5", "", $value);
break;
case "integer":
$value = CForm::GetTextValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
$res .= CForm::GetTextField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $value);
break;
case "date":
$value = CForm::GetDateValue("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], array(), $this->arrVALUES);
$res .= CForm::GetDateField("ADDITIONAL_" . $this->arQuestions[$FIELD_SID]["ID"], $arForm["SID"], $value);
break;
}
//endswitch;
return $res;
} else {
return "";
}
}