本文整理汇总了PHP中CForm::ShowRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::ShowRequired方法的具体用法?PHP CForm::ShowRequired怎么用?PHP CForm::ShowRequired使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::ShowRequired方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
$arResult["arForm"]["SID"], POST_FORM_ACTION_URI, "POST"
),
"FORM_TITLE" => trim(htmlspecialcharsbx($arResult["arForm"]["NAME"])), // form title
"FORM_DESCRIPTION" => // form description
$arResult["arForm"]["DESCRIPTION_TYPE"] == "html" ?
trim($arResult["arForm"]["DESCRIPTION"]) :
nl2br(htmlspecialcharsbx(trim($arResult["arForm"]["DESCRIPTION"]))),
"isFormTitle" => strlen($arResult["arForm"]["NAME"]) > 0 ? "Y" : "N", // flag "does form have title"
"isFormDescription" => strlen($arResult["arForm"]["DESCRIPTION"]) > 0 ? "Y" : "N", // flag "does form have description"
"isFormImage" => intval($arResult["arForm"]["IMAGE_ID"]) > 0 ? "Y" : "N", // flag "does form have image"
"isUseCaptcha" => $arResult["arForm"]["USE_CAPTCHA"] == "Y", // flag "does form use captcha"
"DATE_FORMAT" => CLang::GetDateFormat("SHORT"), // current site date format
"REQUIRED_SIGN" => CForm::ShowRequired("Y"), // "required" sign
"FORM_FOOTER" => "</form>", // form footer (close <form> tag)
)
);
// get template vars for form image
if ($arResult["isFormImage"] == "Y")
{
$arResult["FORM_IMAGE"]["ID"] = $arResult["arForm"]["IMAGE_ID"];
// assign form image url
$arImage = CFile::GetFileArray($arResult["arForm"]["IMAGE_ID"]);
$arResult["FORM_IMAGE"]["URL"] = $arImage["SRC"];
// check image file existance and assign image data
if (substr($arImage["SRC"], 0, 1) == "/")
{
示例2: ShowRequired
/**
* <p>Вывод пометки "обязательное поле" - <span style="font-family: Verdana, Arial, Helvetica, sans-serif; color:red; font-size:12px; ">*</span>. При выводе подписи к полю посредством <a href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaption.php">CFormOutput::ShowInputCaption</a> пометка вставаляется автоматически.</p>
*
*
* @return string <p>Возвращается HTML-код пометки</p> <a name="examples"></a><h4>Использование</h4>
* <pre class="syntax"> Первый обязательный вопрос
* <?=$FORM->ShowRequired()?>:<?=$FORM->ShowInput('REQ_FIELD_1')?><br />
* <?=$FORM->ShowInputCaption('REQ_FIELD_2'):<?=$FORM->ShowInput('REQ_FIELD_2')?><br /> </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/showinput.php">CFormOutput::ShowInput</a></li>
* <li><a
* href="http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showinputcaption.php">CFormOutput::ShowInputCaption</a></li>
* </menu></b<br><br>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/form/classes/cformoutput/showrequired.php
* @author Bitrix
*/
public static function ShowRequired()
{
return CForm::ShowRequired("Y");
}
示例3: ShowRequired
/**
* Public method used to show "required" label (red '*')
* Use: <?=$FORM->ShowRequired()?>
*
* @return string
*/
function ShowRequired()
{
return CForm::ShowRequired("Y");
}
示例4: array_merge
$arResult["ERROR"] = "FORM_ACCESS_DENIED";
}
} else {
$arResult["ERROR"] = "FORM_RECORD_NOT_FOUND";
}
} else {
$arResult["ERROR"] = "FORM_ACCESS_DENIED";
}
} else {
$arResult["ERROR"] = "FORM_NOT_FOUND";
}
// endif ($WEB_FORM_ID>0);
if (strlen($arResult["ERROR"]) <= 0) {
$arParams["SHOW_STATUS"] = $arParams["SHOW_STATUS"] == "Y" && !$arResult["FORM_SIMPLE"] == "Y" ? "Y" : "N";
// append view data to arResult
$arResult = array_merge($arResult, array("RESULT_ID" => $arParams["RESULT_ID"], "WEB_FORM_ID" => $arParams["WEB_FORM_ID"], "isAccessFormParams" => $arResult["F_RIGHT"] >= 25 ? "Y" : "N", "isAccessFormResultEdit" => in_array("EDIT", $arResult["arrRESULT_PERMISSION"]) ? "Y" : "N", "isStatisticIncluded" => CModule::IncludeModule("statistic") ? "Y" : "N", "FORM_TITLE" => trim(htmlspecialcharsbx($arResult["arForm"]["NAME"])), "FORM_DESCRIPTION" => $arResult["arForm"]["DESCRIPTION_TYPE"] == "html" ? trim($arParams["arForm"]["DESCRIPTION"]) : nl2br(htmlspecialcharsbx(trim($arParams["arForm"]["DESCRIPTION"]))), "isFormImage" => intval($arResult["arForm"]["IMAGE_ID"]) > 0 ? "Y" : "N", "REQUIRED_SIGN" => CForm::ShowRequired("Y"), "RESULT_STATUS" => "<span class='" . $arResult["arResultData"]["STATUS_CSS"] . "'>" . $arResult["arResultData"]["STATUS_TITLE"] . "</span>", "RESULT_STATUS_CSS" => $arResult["arResultData"]["STATUS_CSS"], "RESULT_STATUS_TITLE" => $arResult["arResultData"]["STATUS_TITLE"], "RESULT_USER_AUTH" => $arResult["arResultData"]["USER_AUTH"] == "Y" ? "Y" : "N", "RESULT_DATE_CREATE" => $arResult["arResultData"]["DATE_CREATE"], "RESULT_TIMESTAMP_X" => $arResult["arResultData"]["TIMESTAMP_X"], "RESULT_STAT_GUEST_ID" => $arResult["arResultData"]["STAT_GUEST_ID"], "RESULT_STAT_SESSION_ID" => $arResult["arResultData"]["STAT_SESSION_ID"]));
$arResult["isFormTitle"] = strlen($arResult["FORM_TITLE"]) > 0 ? "Y" : "N";
$arResult["isFormDescription"] = strlen($arResult["FORM_DESCRIPTION"]) > 0 ? "Y" : "N";
//append user data to arResult
if (intval($arResult["arResultData"]["USER_ID"]) > 0) {
$rsUser = CUser::GetByID($arResult["arResultData"]["USER_ID"]);
$arUser = $rsUser->Fetch();
$arResult["RESULT_USER_ID"] = $arResult["arResultData"]["USER_ID"];
$arResult["RESULT_USER_LOGIN"] = $arUser["LOGIN"];
$arResult["RESULT_USER_EMAIL"] = $arUser["USER_EMAIL"];
$arResult["RESULT_USER_FIRST_NAME"] = $arUser["NAME"];
$arResult["RESULT_USER_LAST_NAME"] = $arUser["LAST_NAME"];
$arResult["RESULT_USER_SECOND_NAME"] = $arUser["SECOND_NAME"];
}
// append result data to arResult
$arResult["RESULT"] = array();
示例5: in_array
}
}
if (intval($arResult["arResultData"]["USER_ID"]) > 0) {
$rsUser = CUser::GetByID($arResult["arResultData"]["USER_ID"]);
$arUser = $rsUser->Fetch();
$arResult["RESULT_USER_ID"] = $arResult["arResultData"]["USER_ID"];
$arResult["RESULT_USER_LOGIN"] = $arUser["LOGIN"];
$arResult["RESULT_USER_EMAIL"] = $arUser["USER_EMAIL"];
$arResult["RESULT_USER_FIRST_NAME"] = $arUser["NAME"];
$arResult["RESULT_USER_LAST_NAME"] = $arUser["LAST_NAME"];
$arResult["RESULT_USER_SECOND_NAME"] = $arUser["SECOND_NAME"];
}
$arResult["isResultStatusChangeAccess"] = in_array("EDIT", $arResult["arrRESULT_PERMISSION"]) ? "Y" : "N";
$arResult["RESULT_STATUS_FORM"] = $arResult["isResultStatusChangeAccess"] == "Y" ? SelectBox("status_" . $arResult["WEB_FORM_NAME"], CFormStatus::GetDropdown($arParams["WEB_FORM_ID"], array("MOVE"), $arResult["RESULT_USER_ID"]), " ", "", "") : "";
// define variables to assign
$arResult = array_merge($arResult, array("RESULT_ID" => $arParams["RESULT_ID"], "WEB_FORM_ID" => $arParams["WEB_FORM_ID"], "RESULT_STATUS" => "<span class='" . $arResult["arResultData"]["STATUS_CSS"] . "'>" . $arResult["arResultData"]["STATUS_TITLE"] . "</span>", "RESULT_USER_AUTH" => $arResult["arResultData"]["USER_AUTH"] == "Y" ? "Y" : "N", "RESULT_DATE_CREATE" => $arResult["arResultData"]["DATE_CREATE"], "RESULT_TIMESTAMP_X" => $arResult["arResultData"]["TIMESTAMP_X"], "RESULT_STAT_GUEST_ID" => $arResult["arResultData"]["STAT_GUEST_ID"], "RESULT_STAT_SESSION_ID" => $arResult["arResultData"]["STAT_SESSION_ID"], "isFormNote" => strlen($arResult["FORM_NOTE"]) ? "Y" : "N", "isAccessFormParams" => $arResult["F_RIGHT"] >= 25 ? "Y" : "N", "isStatisticIncluded" => CModule::IncludeModule('statistic') ? "Y" : "N", "FORM_HEADER" => sprintf("<form name=\"%s\" action=\"%s\" method=\"%s\" enctype=\"multipart/form-data\">", $arResult["arForm"]["SID"], POST_FORM_ACTION_URI, "POST"), "FORM_TITLE" => trim(htmlspecialcharsbx($arResult["arForm"]["NAME"])), "FORM_DESCRIPTION" => $arResult["arForm"]["DESCRIPTION_TYPE"] == "html" ? trim($arResult["arForm"]["DESCRIPTION"]) : nl2br(htmlspecialcharsbx(trim($arResult["arForm"]["DESCRIPTION"]))), "isFormTitle" => strlen($arResult["arForm"]["NAME"]) > 0 ? "Y" : "N", "isFormDescription" => strlen($arResult["arForm"]["DESCRIPTION"]) > 0 ? "Y" : "N", "isFormImage" => intval($arResult["arForm"]["IMAGE_ID"]) > 0 ? "Y" : "N", "isUseCaptcha" => $arResult["arForm"]["USE_CAPTCHA"] == "Y", "DATE_FORMAT" => CLang::GetDateFormat("SHORT"), "REQUIRED_SIGN" => CForm::ShowRequired("Y"), "FORM_FOOTER" => "</form>"));
// get template vars for form image
if ($arResult["isFormImage"] == "Y") {
$arResult["FORM_IMAGE"]["ID"] = $arResult["arForm"]["IMAGE_ID"];
// assign form image url
$arImage = CFile::GetFileArray($arResult["arForm"]["IMAGE_ID"]);
$arResult["FORM_IMAGE"]["URL"] = $arImage["SRC"];
// check image file existance and assign image data
if (substr($arImage["SRC"], 0, 1) == "/") {
$arSize = CFile::GetImageSize($_SERVER["DOCUMENT_ROOT"] . $arImage["SRC"]);
if (is_array($arSize)) {
list($arResult["FORM_IMAGE"]["WIDTH"], $arResult["FORM_IMAGE"]["HEIGHT"], $arResult["FORM_IMAGE"]["TYPE"], $arResult["FORM_IMAGE"]["ATTR"]) = $arSize;
}
} else {
$arResult["FORM_IMAGE"]["WIDTH"] = $arImage["WIDTH"];
$arResult["FORM_IMAGE"]["HEIGHT"] = $arImage["HEIGHT"];
示例6: array
echo $strReturn;
return;
}
}
if ($arResult["arForm"]["USE_CAPTCHA"] == "Y") {
$arResult["CAPTCHACode"] = $APPLICATION->CaptchaGetCode();
}
// include CSS with additional icons for Site Edit mode
if ($APPLICATION->GetShowIncludeAreas() && $USER->IsAdmin()) {
// define additional icons for Site Edit mode
$arIcons = array(array('URL' => "javascript:" . $APPLICATION->GetPopupLink(array('URL' => "/bitrix/admin/form_edit.php?bxpublic=Y&from_module=form&lang=" . LANGUAGE_ID . "&ID=" . $arParams["WEB_FORM_ID"] . "&back_url=" . urlencode($_SERVER["REQUEST_URI"]), 'PARAMS' => array('width' => 700, 'height' => 500, 'resize' => false))), 'ICON' => 'bx-context-toolbar-edit-icon', 'TITLE' => GetMessage("FORM_PUBLIC_ICON_EDIT")));
// append icons
$this->AddIncludeAreaIcons($arIcons);
}
// define variables to assign
$arResult = array_merge($arResult, array("isFormNote" => strlen($arResult["FORM_NOTE"]) ? "Y" : "N", "isAccessFormParams" => $arResult["F_RIGHT"] >= 25 ? "Y" : "N", "isStatisticIncluded" => CModule::IncludeModule('statistic') ? "Y" : "N", "FORM_HEADER" => sprintf("<form name=\"%s\" action=\"%s\" method=\"%s\" enctype=\"multipart/form-data\">", $arResult["arForm"]["SID"], POST_FORM_ACTION_URI, "POST") . ($res .= bitrix_sessid_post() . '<input type="hidden" name="WEB_FORM_ID" value="' . $arParams['WEB_FORM_ID'] . '" />'), "FORM_TITLE" => trim(htmlspecialcharsbx($arResult["arForm"]["NAME"])), "FORM_DESCRIPTION" => $arResult["arForm"]["DESCRIPTION_TYPE"] == "html" ? trim($arResult["arForm"]["DESCRIPTION"]) : nl2br(htmlspecialcharsbx(trim($arResult["arForm"]["DESCRIPTION"]))), "isFormTitle" => strlen($arResult["arForm"]["NAME"]) > 0 ? "Y" : "N", "isFormDescription" => strlen($arResult["arForm"]["DESCRIPTION"]) > 0 ? "Y" : "N", "isFormImage" => intval($arResult["arForm"]["IMAGE_ID"]) > 0 ? "Y" : "N", "isUseCaptcha" => $arResult["arForm"]["USE_CAPTCHA"] == "Y", "DATE_FORMAT" => CLang::GetDateFormat("SHORT"), "REQUIRED_SIGN" => CForm::ShowRequired("Y"), "FORM_FOOTER" => "</form>"));
/*
if ($arResult["isFormNote"] == "Y")
{
ob_start();
ShowMessage($arResult["FORM_NOTE"]);
$arResult["FORM_NOTE"] = ob_get_contents();
ob_end_clean();
}
*/
// get template vars for form image
if ($arResult["isFormImage"] == "Y") {
$arResult["FORM_IMAGE"]["ID"] = $arResult["arForm"]["IMAGE_ID"];
// assign form image url
$arImage = CFile::GetFileArray($arResult["arForm"]["IMAGE_ID"]);
$arResult["FORM_IMAGE"]["URL"] = $arImage["SRC"];
示例7: array_merge
// append view data to arResult
$arResult = array_merge(
$arResult,
array(
"RESULT_ID" => $arParams["RESULT_ID"], // web form id
"WEB_FORM_ID" => $arParams["WEB_FORM_ID"], // web form id
"isAccessFormParams" => $arResult["F_RIGHT"] >= 25 ? "Y" : "N",
"isAccessFormResultEdit" => in_array("EDIT", $arResult["arrRESULT_PERMISSION"]) ? "Y" : "N",
"isStatisticIncluded" => CModule::IncludeModule("statistic") ? "Y" : "N",
"FORM_TITLE" => trim(htmlspecialcharsbx($arResult["arForm"]["NAME"])),
"FORM_DESCRIPTION" => $arResult["arForm"]["DESCRIPTION_TYPE"] == "html" ? trim($arParams["arForm"]["DESCRIPTION"]) : nl2br(htmlspecialcharsbx(trim($arParams["arForm"]["DESCRIPTION"]))),
"isFormImage" => intval($arResult["arForm"]["IMAGE_ID"]) > 0 ? "Y" : "N",
"REQUIRED_SIGN" => CForm::ShowRequired("Y"), // "required" sign - for manual template customization
"RESULT_STATUS" => "<span class='".$arResult["arResultData"]["STATUS_CSS"]."'>".$arResult["arResultData"]["STATUS_TITLE"]."</span>", // formatted result status
"RESULT_STATUS_CSS" => $arResult["arResultData"]["STATUS_CSS"],
"RESULT_STATUS_TITLE" => $arResult["arResultData"]["STATUS_TITLE"],
"RESULT_USER_AUTH" => $arResult["arResultData"]["USER_AUTH"] == "Y" ? "Y" : "N",
"RESULT_DATE_CREATE" => $arResult["arResultData"]["DATE_CREATE"],
"RESULT_TIMESTAMP_X" => $arResult["arResultData"]["TIMESTAMP_X"],
"RESULT_STAT_GUEST_ID" => $arResult["arResultData"]["STAT_GUEST_ID"],
"RESULT_STAT_SESSION_ID" => $arResult["arResultData"]["STAT_SESSION_ID"],
)
);