本文整理汇总了PHP中CForm::GetResultAnswerArray方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::GetResultAnswerArray方法的具体用法?PHP CForm::GetResultAnswerArray怎么用?PHP CForm::GetResultAnswerArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::GetResultAnswerArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Show
function Show($RESULT_ID, $TEMPLATE = "", $TEMPLATE_TYPE = "show", $SHOW_ADDITIONAL = "N", $SHOW_ANSWER_VALUE = "Y", $SHOW_STATUS = "N")
{
global $DB, $MESS, $APPLICATION, $USER, $HTTP_POST_VARS, $HTTP_GET_VARS, $arrRESULT_PERMISSION, $arrFIELDS;
$err_mess = CAllFormResult::err_mess() . "<br>Function: Show<br>Line: ";
$z = CFormResult::GetByID($RESULT_ID);
if ($zr = $z->Fetch()) {
$arrResult = $zr;
InitBVar($SHOW_ADDITIONAL);
$additional = $SHOW_ADDITIONAL == "Y" ? "ALL" : "N";
$WEB_FORM_ID = $FORM_ID = CForm::GetDataByID($arrResult["FORM_ID"], $arForm, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $additional);
CForm::GetResultAnswerArray($WEB_FORM_ID, $arrResultColumns, $arrResultAnswers, $arrResultAnswersVarname, array("RESULT_ID" => $RESULT_ID));
$arrResultAnswers = $arrResultAnswers[$RESULT_ID];
// проверим общие права на результат
$F_RIGHT = CForm::GetPermission($WEB_FORM_ID);
if (intval($F_RIGHT) >= 20 || $F_RIGHT >= 15 && $zr["USER_ID"] == $USER->GetID()) {
// проверим права в зависимости от статуса результата
$arrRESULT_PERMISSION = CFormResult::GetPermissions($RESULT_ID, $v);
if (in_array("VIEW", $arrRESULT_PERMISSION)) {
if (strlen(trim($TEMPLATE)) > 0) {
$template = $TEMPLATE;
} else {
if ($TEMPLATE_TYPE == "show") {
if (strlen($arrResult["SHOW_RESULT_TEMPLATE"]) <= 0) {
$template = "default.php";
} else {
$template = $arrResult["SHOW_RESULT_TEMPLATE"];
}
} elseif ($TEMPLATE_TYPE == "print") {
if (strlen($arrResult["PRINT_RESULT_TEMPLATE"]) <= 0) {
$template = "default.php";
} else {
$template = $arrResult["PRINT_RESULT_TEMPLATE"];
}
}
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/include.php";
if ($TEMPLATE_TYPE == "show") {
$path = COption::GetOptionString("form", "SHOW_RESULT_TEMPLATE_PATH");
} elseif ($TEMPLATE_TYPE == "print") {
$path = COption::GetOptionString("form", "PRINT_RESULT_TEMPLATE_PATH");
}
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/include.php");
include GetLangFileName($_SERVER["DOCUMENT_ROOT"] . $path . "lang/", "/" . $template);
if ($APPLICATION->GetShowIncludeAreas()) {
$arIcons = array();
if (CModule::IncludeModule("fileman")) {
$arIcons[] = array("URL" => "/bitrix/admin/fileman_file_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&full_src=Y&path=" . urlencode($path . $template), "SRC" => "/bitrix/images/form/panel/edit_template.gif", "ALT" => GetMessage("FORM_PUBLIC_ICON_TEMPLATE"));
$arrUrl = parse_url($_SERVER["REQUEST_URI"]);
$arIcons[] = array("URL" => "/bitrix/admin/fileman_file_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&full_src=Y&path=" . urlencode($arrUrl["path"]), "SRC" => "/bitrix/images/form/panel/edit_file.gif", "ALT" => GetMessage("FORM_PUBLIC_ICON_HANDLER"));
}
$arIcons[] = array("URL" => "/bitrix/admin/form_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $WEB_FORM_ID, "SRC" => "/bitrix/images/form/panel/edit_form.gif", "ALT" => GetMessage("FORM_PUBLIC_ICON_SETTINGS"));
echo $APPLICATION->IncludeStringBefore($arIcons);
}
include $_SERVER["DOCUMENT_ROOT"] . $path . $template;
if ($APPLICATION->GetShowIncludeAreas()) {
echo $APPLICATION->IncludeStringAfter();
}
}
}
}
}
示例2: Init
/**
* Form initializing and checking. If form's wrong, returns false
* Use ShowErrorMsg() to output error code
*
* @param array $arParams
* @return bool
*/
function Init($arParams, $admin = false)
{
global $APPLICATION, $USER;
$this->bSimple = COption::GetOptionString("form", "SIMPLE", "Y") == "Y" ? true : false;
$this->comp2 = !empty($arParams["COMPONENT"]);
$this->SHOW_INCLUDE_AREAS = $APPLICATION->GetShowIncludeAreas();
if ($admin) {
$FORM_RIGHT = $APPLICATION->GetGroupRight("form");
if ($FORM_RIGHT <= "D") {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$this->__admin = true;
}
$this->arParams = $arParams;
$this->RESULT_ID = intval($arParams["RESULT_ID"]);
if (intval($this->RESULT_ID) <= 0) {
$this->RESULT_ID = intval($_REQUEST["RESULT_ID"]);
}
// if there's result ID try to get form ID
if (intval($this->RESULT_ID) > 0) {
$DBRes = CFormResult::GetByID($this->RESULT_ID);
if ($arrResult = $DBRes->Fetch()) {
$this->WEB_FORM_ID = intval($arrResult["FORM_ID"]);
}
}
if (intval($this->WEB_FORM_ID) <= 0) {
$this->WEB_FORM_ID = intval($arParams["WEB_FORM_ID"]);
}
// if there's no WEB_FORM_ID, try to get it from $_REQUEST;
if (intval($this->WEB_FORM_ID) <= 0) {
$this->WEB_FORM_ID = intval($_REQUEST["WEB_FORM_ID"]);
}
// check WEB_FORM_ID and get web form data
$this->WEB_FORM_ID = CForm::GetDataByID($this->WEB_FORM_ID, $this->arForm, $this->arQuestions, $this->arAnswers, $this->arDropDown, $this->arMultiSelect, $this->__admin || $this->arParams["SHOW_ADDITIONAL"] == "Y" || $this->arParams["EDIT_ADDITIONAL"] == "Y" ? "ALL" : "N", $this->__admin ? 'Y' : 'N');
$this->WEB_FORM_NAME = $this->arForm["SID"];
// if wrong WEB_FORM_ID return error;
if ($this->WEB_FORM_ID > 0) {
// insert chain item
if (strlen($this->arParams["CHAIN_ITEM_TEXT"]) > 0) {
$APPLICATION->AddChainItem($this->arParams["CHAIN_ITEM_TEXT"], $this->arParams["CHAIN_ITEM_LINK"]);
}
// check web form rights;
$this->F_RIGHT = intval(CForm::GetPermission($this->WEB_FORM_ID));
// in no form access - return error
if ($this->isAccessForm()) {
if (!empty($_REQUEST["strFormNote"])) {
$this->strFormNote = $_REQUEST["strFormNote"];
}
if (!$this->comp2 || $this->arParams["COMPONENT"]["componentName"] != "bitrix:form.result.list" || $this->isAccessFormResultList()) {
if ($this->RESULT_ID) {
if ($this->isAccessFormResult($arrResult)) {
$this->arrRESULT_PERMISSION = CFormResult::GetPermissions($this->RESULT_ID, $v);
// check result rights
if (!$this->comp2 && !$this->isAccessFormResultEdit() || $this->comp2 && ($this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.edit" && !$this->isAccessFormResultEdit() || $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.view" && !$this->isAccessFormResultView())) {
$this->__error_msg = "FORM_RESULT_ACCESS_DENIED";
} else {
if (!$arrResult) {
$z = CFormResult::GetByID($this->RESULT_ID);
$this->arResult = $z->Fetch();
} else {
$this->arResult = $arrResult;
}
if ($this->arResult) {
if ($this->comp2 && $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.view") {
CForm::GetResultAnswerArray($this->WEB_FORM_ID, $this->arrResultColumns, $this->arrVALUES, $this->arrResultAnswersSID, array("RESULT_ID" => $this->RESULT_ID));
$this->arrVALUES = $this->arrVALUES[$this->RESULT_ID];
} else {
$this->arrVALUES = CFormResult::GetDataByIDForHTML($this->RESULT_ID, $this->arParams["EDIT_ADDITIONAL"]);
}
} else {
$this->__error_msg = "FORM_RECORD_NOT_FOUND";
}
}
} else {
$this->__error_msg = "FORM_ACCESS_DENIED";
}
$this->arForm["USE_CAPTCHA"] = "N";
} else {
// if form uses CAPCHA initialize it
if ($this->arForm["USE_CAPTCHA"] == "Y") {
$this->CaptchaInitialize();
}
}
} else {
$this->__error_msg = "FORM_ACCESS_DENIED";
}
} else {
$this->__error_msg = "FORM_ACCESS_DENIED";
}
// endif ($F_RIGHT>=10);
} else {
$this->__error_msg = "FORM_NOT_FOUND";
}
//.........这里部分代码省略.........
示例3: GetDataByIDForHTML
//.........这里部分代码省略.........
* // выведем фотографию загруженную в качестве ответа на вопрос "Фотография"
* CFile::ShowImage($arValues["form_image_607"], 200, 200, "border=0", "", true);
*
* // выведем значение поля веб-формы "Рассчитанная стоимость"
* echo $arValues["form_textarea_ADDITIONAL_149"]; // 134 руб.
* ?>
* </pre>
*
*
*
* <h4>See Also</h4>
* <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/form/htmlnames.php">Имена HTML полей</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/add.php">CFormResult::Add</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/update.php">CFormResult::Update</a> </li> <li> <a
* href="http://dev.1c-bitrix.ru/api_help/form/classes/cform/check.php">CForm::Check</a> </li> </ul><a name="examples"></a>
*
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/getdatabyidforhtml.php
* @author Bitrix
*/
public static function GetDataByIDForHTML($RESULT_ID, $GET_ADDITIONAL="N")
{
$err_mess = (CAllFormResult::err_mess())."<br>Function: GetDataByIDForHTML<br>Line: ";
global $DB, $strError;
$z = CFormResult::GetByID($RESULT_ID);
if ($zr=$z->Fetch())
{
$arrResult = $zr;
$additional = ($GET_ADDITIONAL=="Y") ? "ALL" : "N";
$WEB_FORM_ID = CForm::GetDataByID($arrResult["FORM_ID"], $arForm, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $additional);
CForm::GetResultAnswerArray($WEB_FORM_ID, $arrResultColumns, $arrResultAnswers, $arrResultAnswersSID, array("RESULT_ID" => $RESULT_ID));
$arrResultAnswers = $arrResultAnswers[$RESULT_ID];
$DB_VARS = array();
foreach ($arQuestions as $key => $arQuestion)
{
if ($arQuestion["ADDITIONAL"]!="Y")
{
$FIELD_SID = $arQuestion["SID"];
if (is_array($arAnswers[$FIELD_SID]))
{
foreach ($arAnswers[$FIELD_SID] as $key => $arAnswer)
{
$arrResultAnswer = $arrResultAnswers[$arQuestion["ID"]][$arAnswer["ID"]];
$FIELD_TYPE = $arAnswer["FIELD_TYPE"];
switch ($FIELD_TYPE) :
case "radio":
case "dropdown":
if (intval($arrResultAnswer["ANSWER_ID"])>0)
{
$fname = "form_".strtolower($FIELD_TYPE)."_".$FIELD_SID;
$DB_VARS[$fname] = $arrResultAnswer["ANSWER_ID"];
}
break;
case "checkbox":
case "multiselect":
if (intval($arrResultAnswer["ANSWER_ID"])>0)
{
$fname = "form_".strtolower($FIELD_TYPE)."_".$FIELD_SID;
$DB_VARS[$fname][] = $arrResultAnswer["ANSWER_ID"];
}
示例4: array
if ($arResult["F_RIGHT"] >= 15) {
if ($arParams["RESULT_ID"]) {
if ($arResult["F_RIGHT"] >= 20 || $arResult["F_RIGHT"] >= 15 && $USER->GetID() == $arResultData["USER_ID"]) {
$arResult["arrRESULT_PERMISSION"] = CFormResult::GetPermissions($arParams["RESULT_ID"], $v);
// check result rights
if (!in_array("VIEW", $arResult["arrRESULT_PERMISSION"])) {
$arResult["ERROR"] = "FORM_RESULT_ACCESS_DENIED";
} else {
if (!$arResultData) {
$z = CFormResult::GetByID($arParams["RESULT_ID"]);
$arResult["arResultData"] = $z->Fetch();
} else {
$arResult["arResultData"] = $arResultData;
}
if ($arResult["arResultData"]) {
CForm::GetResultAnswerArray($arParams["WEB_FORM_ID"], $arResult["arrResultColumns"], $arResult["arrVALUES"], $arResult["arrResultAnswersSID"], array("RESULT_ID" => $arParams["RESULT_ID"]));
$arResult["arrVALUES"] = $arResult["arrVALUES"][$arParams["RESULT_ID"]];
} else {
$arResult["arrVALUES"] = CFormResult::GetDataByIDForHTML($arResult["RESULT_ID"], $arParams["SHOW_ADDITIONAL"]);
}
}
} else {
$arResult["ERROR"] = "FORM_ACCESS_DENIED";
}
} else {
$arResult["ERROR"] = "FORM_RECORD_NOT_FOUND";
}
} else {
$arResult["ERROR"] = "FORM_ACCESS_DENIED";
}
} else {
示例5: GetMessage
<td valign="top"><?php
echo GetMessage("FORM_GUEST_ID");
?>
</td>
<td valign="top"><?php
echo GetMessage("FORM_SESSION_ID");
?>
</td>
<?php
}
?>
<?php
}
?>
<?php
CForm::GetResultAnswerArray($WEB_FORM_ID, $arrColumns, $arrAnswers, $arrAnswersSID, array("IN_EXCEL_TABLE" => "Y"));
$colspan = 5;
reset($arrColumns);
while (list($key, $arrCol) = each($arrColumns)) {
if (!is_array($arrNOT_SHOW_TABLE) || !in_array($arrCol["SID"], $arrNOT_SHOW_TABLE)) {
if ($arrCol["ADDITIONAL"] == "Y" && $SHOW_ADDITIONAL == "Y" || $arrCol["ADDITIONAL"] != "Y") {
$colspan++;
if (strlen($arrCol["RESULTS_TABLE_TITLE"]) <= 0) {
$title = $arrCol["TITLE_TYPE"] == "html" ? strip_tags($arrCol["TITLE"]) : htmlspecialcharsbx($arrCol["TITLE"]);
} else {
$title = htmlspecialcharsbx($arrCol["RESULTS_TABLE_TITLE"]);
}
?>
<td valign="top"><?php
if ($F_RIGHT >= 25) {
?>