15 $this->bSimple = (COption::GetOptionString(
"form",
"SIMPLE",
"Y") ==
"Y") ?
true :
false;
16 $this->comp2 = !empty(
$arParams[
"COMPONENT"]);
17 $this->SHOW_INCLUDE_AREAS =
$APPLICATION->GetShowIncludeAreas();
24 $this->__admin =
true;
29 $this->RESULT_ID = intval(
$arParams[
"RESULT_ID"] ?? 0);
30 if (intval($this->RESULT_ID)<=0) $this->RESULT_ID = intval(
$_REQUEST[
"RESULT_ID"] ?? 0);
33 if (intval($this->RESULT_ID) > 0)
37 if ($arrResult = $DBRes->Fetch())
39 $this->WEB_FORM_ID = intval($arrResult[
"FORM_ID"]);
43 if (intval($this->WEB_FORM_ID) <= 0)
44 $this->WEB_FORM_ID = intval(
$arParams[
"WEB_FORM_ID"]);
47 if (intval($this->WEB_FORM_ID) <= 0)
48 $this->WEB_FORM_ID = intval(
$_REQUEST[
"WEB_FORM_ID"]);
51 $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');
53 $this->WEB_FORM_NAME = $this->arForm[
"SID"];
56 if ($this->WEB_FORM_ID > 0)
59 if (!empty($this->arParams[
"CHAIN_ITEM_TEXT"]))
61 $APPLICATION->AddChainItem($this->arParams[
"CHAIN_ITEM_TEXT"], $this->arParams[
"CHAIN_ITEM_LINK"]);
68 if ($this->isAccessForm())
72 if (!$this->comp2 || $this->arParams[
"COMPONENT"][
"componentName"] !=
"bitrix:form.result.list" || $this->isAccessFormResultList())
76 if ($this->isAccessFormResult($arrResult))
82 !$this->comp2 && !$this->isAccessFormResultEdit()
86 $this->arParams[
"COMPONENT"][
"componentName"] ==
"bitrix:form.result.edit" && !$this->isAccessFormResultEdit()
88 $this->arParams[
"COMPONENT"][
"componentName"] ==
"bitrix:form.result.view" && !$this->isAccessFormResultView()
92 $this->__error_msg =
"FORM_RESULT_ACCESS_DENIED";
99 $this->arResult =
$z->Fetch();
103 $this->arResult = $arrResult;
108 if ($this->comp2 && $this->arParams[
"COMPONENT"][
"componentName"] ==
"bitrix:form.result.view")
110 CForm::GetResultAnswerArray($this->WEB_FORM_ID, $this->arrResultColumns, $this->arrVALUES, $this->arrResultAnswersSID,
array(
"RESULT_ID" => $this->RESULT_ID));
111 $this->arrVALUES = $this->arrVALUES[$this->RESULT_ID];
120 $this->__error_msg =
"FORM_RECORD_NOT_FOUND";
126 $this->__error_msg =
"FORM_ACCESS_DENIED";
129 $this->arForm[
"USE_CAPTCHA"] =
"N";
139 $this->__error_msg =
"FORM_ACCESS_DENIED";
144 $this->__error_msg =
"FORM_ACCESS_DENIED";
149 $this->__error_msg =
"FORM_NOT_FOUND";
153 return empty($this->__error_msg);
159 global $find_date_create_1, $find_date_create_2;
162 CheckFilterDates($find_date_create_1, $find_date_create_2, $date1_wrong, $date2_wrong, $date2_less);
163 if ($date1_wrong==
"Y")
$str.=
GetMessage(
"FORM_WRONG_DATE_CREATE_FROM").
"<br>";
164 if ($date2_wrong==
"Y")
$str.=
GetMessage(
"FORM_WRONG_DATE_CREATE_TO").
"<br>";
165 if ($date2_less==
"Y")
$str.=
GetMessage(
"FORM_FROM_TILL_DATE_CREATE").
"<br>";
167 if (is_array($arrFORM_FILTER))
169 reset($arrFORM_FILTER);
170 foreach ($arrFORM_FILTER as $arrF)
174 foreach ($arrF as
$arr)
177 if (
$arr[
"FILTER_TYPE"]==
"date")
179 $date1 = $_GET[
"find_".$arr[
"FID"].
"_1"];
180 $date2 = $_GET[
"find_".$arr[
"FID"].
"_2"];
182 if ($date1_wrong==
"Y")
184 if ($date2_wrong==
"Y")
186 if ($date2_less==
"Y")
189 if (
$arr[
"FILTER_TYPE"]==
"integer")
191 $int1 = intval($_GET[
"find_".
$arr[
"FID"].
"_1"]);
192 $int2 = intval($_GET[
"find_".
$arr[
"FID"].
"_2"]);
193 if ($int1>0 && $int2>0 && $int2<$int1)
204 if (
$str <> '')
return false;
else return true;
211 "find_id_exact_match",
214 "find_status_id_exact_match",
217 "find_date_create_2",
218 "find_date_create_1",
219 "find_date_create_2",
223 "find_user_id_exact_match",
225 "find_guest_id_exact_match",
227 "find_session_id_exact_match"
231 while (
$zr=
$z->Fetch())
233 $FID = $this->WEB_FORM_NAME.
"_".
$zr[
"SID"].
"_".
$zr[
"PARAMETER_NAME"].
"_".
$zr[
"FILTER_TYPE"];
235 $arrFORM_FILTER[
$zr[
"SID"]][] =
$zr;
236 $fname =
"find_".$FID;
237 if (
$zr[
"FILTER_TYPE"]==
"date" ||
$zr[
"FILTER_TYPE"]==
"integer")
239 $FilterArr[] = $fname.
"_1";
240 $FilterArr[] = $fname.
"_2";
241 $FilterArr[] = $fname.
"_0";
245 $FilterArr[] = $fname;
246 $FilterArr[] = $fname.
"_exact_match";
248 else $FilterArr[] = $fname;
250 $sess_filter =
"FORM_RESULT_LIST_".$this->WEB_FORM_NAME;
262 InitBVar($find_status_id_exact_match);
263 InitBVar($find_user_id_exact_match);
264 InitBVar($find_guest_id_exact_match);
265 InitBVar($find_session_id_exact_match);
271 "ID_EXACT_MATCH" => $find_id_exact_match,
272 "STATUS" => $find_status,
273 "STATUS_ID" => $find_status_id,
274 "STATUS_ID_EXACT_MATCH" => $find_status_id_exact_match,
275 "TIMESTAMP_1" => $find_timestamp_1,
276 "TIMESTAMP_2" => $find_timestamp_2,
277 "DATE_CREATE_1" => $find_date_create_1,
278 "DATE_CREATE_2" => $find_date_create_2,
279 "REGISTERED" => $find_registered,
280 "USER_AUTH" => $find_user_auth,
281 "USER_ID" => $find_user_id,
282 "USER_ID_EXACT_MATCH" => $find_user_id_exact_match,
283 "GUEST_ID" => $find_guest_id,
284 "GUEST_ID_EXACT_MATCH" => $find_guest_id_exact_match,
285 "SESSION_ID" => $find_session_id,
286 "SESSION_ID_EXACT_MATCH" => $find_session_id_exact_match
289 if (is_array($arrFORM_FILTER))
291 foreach ($arrFORM_FILTER as $arrF)
293 foreach ($arrF as
$arr)
295 if (
$arr[
"FILTER_TYPE"]==
"date" ||
$arr[
"FILTER_TYPE"]==
"integer")
304 $exact_match = (${
"find_".$arr[
"FID"].
"_exact_match"}==
"Y") ?
"Y" :
"N";
325 $this->arParams[
'USE_EXTENDED_ERRORS'] =
'N';
331 if ($this->RESULT_ID)
333 $this->__form_validate_errors =
CForm::Check($this->WEB_FORM_ID, $this->arrVALUES, $this->RESULT_ID);
337 $this->__form_validate_errors =
CForm::Check($this->WEB_FORM_ID, $this->arrVALUES);
340 if (!$this->isFormErrors())
345 if ($this->RESULT_ID)
347 CFormResult::Update($this->RESULT_ID, $this->arrVALUES, $this->arParams[
"EDIT_ADDITIONAL"]);
349 $this->strFormNote =
GetMessage(
"FORM_DATA_SAVED");
353 LocalRedirect($this->arParams[
"LIST_URL"].(mb_strpos($this->arParams[
"LIST_URL"],
"?") ===
false ?
"?" :
"&").
"WEB_FORM_ID=".$this->WEB_FORM_ID.
"&strFormNote=".urlencode($this->strFormNote));
359 LocalRedirect(
BX_ROOT.
"/admin/form_result_list.php?lang=".LANG.
"&WEB_FORM_ID=".$this->WEB_FORM_ID.
"&strFormNote=".urlencode($this->strFormNote));
361 LocalRedirect(
BX_ROOT.
"/admin/form_result_edit.php?lang=".LANG.
"&WEB_FORM_ID=".$this->WEB_FORM_ID.
"&RESULT_ID=".$this->RESULT_ID.
"&strFormNote=".urlencode($this->strFormNote));
374 if($this->RESULT_ID =
CFormResult::Add($this->WEB_FORM_ID, $this->arrVALUES))
376 $this->strFormNote =
GetMessage(
"FORM_DATA_SAVED1").$this->RESULT_ID.GetMessage(
"FORM_DATA_SAVED2");
380 if ($this->F_RIGHT >= 15)
382 if (
$_REQUEST[
"web_form_submit"] <>
'' && $this->arParams[
"LIST_URL"] <>
'')
384 LocalRedirect($this->arParams[
"LIST_URL"].(mb_strpos($this->arParams[
"LIST_URL"],
"?") ===
false ?
"?" :
"&").
"lang=".LANGUAGE_ID.
"&WEB_FORM_ID=".$this->WEB_FORM_ID.
"&RESULT_ID=".$this->RESULT_ID.
"&strFormNote=".urlencode($this->strFormNote));
386 elseif (
$_REQUEST[
"web_form_apply"] <>
'' && $this->arParams[
"EDIT_URL"] <>
'')
388 LocalRedirect($this->arParams[
"EDIT_URL"].(mb_strpos($this->arParams[
"EDIT_URL"],
"?") ===
false ?
"?" :
"&").
"RESULT_ID=".$this->RESULT_ID.
"&strFormNote=".urlencode($this->strFormNote));
395 LocalRedirect(
$APPLICATION->GetCurPage().
"?lang=".LANGUAGE_ID.
"&WEB_FORM_ID=".$this->WEB_FORM_ID.
"&strFormNote=".urlencode($this->strFormNote));
400 $this->__form_validate_errors =
$GLOBALS[
"strError"];
407 $strReturn = $this->IncludeFormCustomTemplate();
408 if ($strReturn ==
'')
412 $APPLICATION->IncludeFile(
"form/".(empty($this->RESULT_ID) || $return ?
"result_new" :
"result_edit").
"/form.php", $this->arParams,
array(
"SHOW_BORDER" =>
false));
413 $strReturn = ob_get_contents();
419 $editor =
"/bitrix/admin/fileman_file_edit.php?full_src=Y&site=".SITE_ID.
"&";
420 $rel_path =
"form/".(empty($this->RESULT_ID) ?
"result_new" :
"result_edit").
"/form.php";
421 $path = BX_PERSONAL_ROOT.
"/templates/".SITE_TEMPLATE_ID.
"/".$rel_path;
422 $href =
"javascript:window.location='".$editor.
"path=".urlencode(
$path).
"&lang=".LANGUAGE_ID.
"&back_url=".urlencode(
$back_url).
"'";
426 $path = BX_PERSONAL_ROOT.
"/templates/.default/".$rel_path;
427 $href =
"javascript:window.location='".$editor.
"path=".urlencode(
$path).
"&lang=".LANGUAGE_ID.
"&back_url=".urlencode(
$back_url).
"'";
430 $path =
"/bitrix/modules/form/install/templates/".$rel_path;
431 $href =
"javascript:if(confirm('".GetMessage(
"MAIN_INC_BLOCK_COMMON").
"')) window.location='".$editor.
"path=".urlencode(BX_PERSONAL_ROOT.
'/templates/'.SITE_TEMPLATE_ID.
'/'.$rel_path).
"&template=".urlencode(
$path).
"&lang=".LANGUAGE_ID.
"&back_url=".urlencode(
$back_url).
"'";
435 if (
$USER->IsAdmin())
440 "HREF" =>
"/bitrix/admin/form_edit.php?lang=".LANGUAGE_ID.
"&ID=".$this->WEB_FORM_ID.
"&tabControl_active_tab=edit5&back_url=".urlencode(
$back_url),
441 "SRC" =>
"/bitrix/images/form/edit_templ.gif",
442 "ALT" =>
GetMessage(
"FORM_PUBLIC_ICON_EDIT_TPL")
449 "SRC" =>
"/bitrix/images/form/edit_default_templ.gif",
450 "ALT" =>
GetMessage(
"FORM_PUBLIC_ICON_EDIT_DEFAULT_TPL"),
455 if ($this->arForm[
"USE_DEFAULT_TEMPLATE"] ==
"N")
460 "URL" =>
"/bitrix/admin/form_edit.php?lang=".LANGUAGE_ID.
"&ID=".$this->WEB_FORM_ID.
"&tabControl_active_tab=edit5&back_url=".urlencode(
$back_url),
461 "ICON" =>
'form-edit-tpl',
462 "ALT" =>
GetMessage(
"FORM_PUBLIC_ICON_EDIT_TPL")
464 $strReturn =
$APPLICATION->IncludeString($strReturn, $arIcons);
472 "SRC" =>
"/bitrix/images/form/edit_default_templ.gif",
473 "ICON" =>
'form-edit-default-tpl',
474 "ALT" =>
GetMessage(
"FORM_PUBLIC_ICON_EDIT_DEFAULT_TPL"),
476 $strReturn =
$APPLICATION->IncludeString($strReturn, $arIcons);
490 $arResult[
"WEB_FORM_ID"] = $this->WEB_FORM_ID;
491 $arResult[
"WEB_FORM_NAME"] = $this->WEB_FORM_NAME;
492 if ($this->RESULT_ID > 0)
$arResult[
"RESULT_ID"] = $this->RESULT_ID;
499 if ($this->RESULT_ID)
501 $this->__form_validate_errors =
CForm::Check($this->WEB_FORM_ID, $this->arrVALUES, $this->RESULT_ID);
505 $this->__form_validate_errors =
CForm::Check($this->WEB_FORM_ID, $this->arrVALUES);
508 if (!$this->isFormErrors())
514 if ($this->RESULT_ID)
516 CFormResult::Update($this->RESULT_ID, $this->arrVALUES, $this->arParams[
"EDIT_ADDITIONAL"]);
518 $this->strFormNote =
GetMessage(
"FORM_DATA_SAVED");
522 if ($this->arParams[
"SEF_MODE"] ==
"Y")
523 LocalRedirect($this->arParams[
"LIST_URL"].
"?strFormNote=".urlencode($this->strFormNote));
525 LocalRedirect($this->arParams[
"LIST_URL"].(mb_strpos($this->arParams[
"LIST_URL"],
"?") ===
false ?
"?" :
"&").
"WEB_FORM_ID=".$this->WEB_FORM_ID.
"&strFormNote=".urlencode($this->strFormNote));
530 if (
$_REQUEST[
"web_form_apply"] <>
'' && !(defined(
"ADMIN_SECTION") &&
ADMIN_SECTION===
true) && $this->arParams[
"SEF_MODE"] ==
"Y")
532 LocalRedirect($this->arParams[
"EDIT_URL"].(mb_strpos($this->arParams[
"EDIT_URL"],
"?") ===
false ?
"?" :
"&").
"strFormNote=".urlencode($this->strFormNote));
540 LocalRedirect(
BX_ROOT.
"/admin/form_result_list.php?lang=".LANG.
"&WEB_FORM_ID=".$this->WEB_FORM_ID.
"&strFormNote=".urlencode($this->strFormNote));
544 LocalRedirect(
BX_ROOT.
"/admin/form_result_edit.php?lang=".LANG.
"&WEB_FORM_ID=".$this->WEB_FORM_ID.
"&RESULT_ID=".$this->RESULT_ID.
"&strFormNote=".urlencode($this->strFormNote));
552 if($this->RESULT_ID =
CFormResult::Add($this->WEB_FORM_ID, $this->arrVALUES))
554 $this->strFormNote =
GetMessage(
"FORM_DATA_SAVED1").$this->RESULT_ID.GetMessage(
"FORM_DATA_SAVED2");
559 if ($this->F_RIGHT >= 15)
561 if (
$_REQUEST[
"web_form_submit"] <>
'' && $this->arParams[
"LIST_URL"] <>
'')
563 if ($this->arParams[
"SEF_MODE"] ==
"Y")
564 LocalRedirect($this->arParams[
"LIST_URL"].
"?strFormNote=".urlencode($this->strFormNote));
566 LocalRedirect($this->arParams[
"LIST_URL"].(mb_strpos($this->arParams[
"LIST_URL"],
"?") ===
false ?
"?" :
"&").
"WEB_FORM_ID=".$this->WEB_FORM_ID.
"&RESULT_ID=".$this->RESULT_ID.
"&strFormNote=".urlencode($this->strFormNote));
569 elseif (
$_REQUEST[
"web_form_apply"] <>
'' && $this->arParams[
"EDIT_URL"] <>
'')
571 if ($this->arParams[
"SEF_MODE"] ==
"Y")
572 LocalRedirect(str_replace(
"#RESULT_ID#", $this->RESULT_ID. $this->arParams[
"EDIT_URL"]).
"?strFormNote=".urlencode($this->strFormNote));
574 LocalRedirect($this->arParams[
"EDIT_URL"].(mb_strpos($this->arParams[
"EDIT_URL"],
"?") ===
false ?
"?" :
"&").
"RESULT_ID=".$this->RESULT_ID.
"&strFormNote=".urlencode($this->strFormNote));
582 LocalRedirect(
$APPLICATION->GetCurPage().
"?WEB_FORM_ID=".$this->WEB_FORM_ID.
"&strFormNote=".urlencode($this->strFormNote));
588 $this->__form_validate_errors =
$GLOBALS[
"strError"];
614 if (intval($this->arResult[
"USER_ID"])>0)
616 $rsUser = CUser::GetByID($this->arResult[
"USER_ID"]);
617 $arUser = $rsUser->Fetch();
619 $this->arResult[
"EMAIL"] = $arUser[
"USER_EMAIL"];
635 $this->CAPTCHACode =
$GLOBALS[
"APPLICATION"]->CaptchaGetCode();
644 $arQuestion = $this->arQuestions[$FIELD_SID];
645 $arrResultAnswer = $this->arrVALUES[$arQuestion[
"ID"]];
647 if (is_array($arrResultAnswer))
649 reset($arrResultAnswer);
652 foreach ($arrResultAnswer as
$key => $arrA)
656 if (trim($arrA[
"USER_TEXT"]) <>
'')
658 if (intval($arrA[
"USER_FILE_ID"])>0)
660 if ($arrA[
"USER_FILE_IS_IMAGE"]==
"Y" &&
$USER->IsAdmin())
663 else $out .=
TxtToHTML($arrA[
"USER_TEXT"],
true,50).
"<br />";
666 if (trim($arrA[
"ANSWER_TEXT"]) <>
'')
668 $answer =
"[<span class='form-anstext'>".TxtToHTML($arrA[
"ANSWER_TEXT"],
true,50).
"</span>]";
669 if (trim($arrA[
"ANSWER_VALUE"]) <>
'') $answer .=
" ";
else $answer .=
"<br />";
673 if ($this->arParams[
"SHOW_ANSWER_VALUE"]==
"Y")
675 if (trim($arrA[
"ANSWER_VALUE"]) <>
'')
676 $out .=
"(<span class='form-ansvalue'>".TxtToHTML($arrA[
"ANSWER_VALUE"],
true,50).
"</span>)<br />";
679 if (intval($arrA[
"USER_FILE_ID"])>0)
681 if ($arrA[
"USER_FILE_IS_IMAGE"]==
"Y")
683 $out .= CFile::ShowImage($arrA[
"USER_FILE_ID"], 0, 0,
"border=0",
"",
true);
687 $file_link =
"/bitrix/tools/form_show_file.php?rid=".$this->RESULT_ID.
"&hash=".$arrA[
"USER_FILE_HASH"].
"&lang=".LANGUAGE_ID;
689 $out .=
"<a title=\"".GetMessage(
"FORM_VIEW_FILE").
"\" target=\"_blank\" href=\"".$file_link.
"\">".
htmlspecialcharsbx($arrA[
"USER_FILE_NAME"]).
"</a><br />(";
691 $out .= CFile::FormatSize($arrA[
"USER_FILE_SIZE"]);
693 $out .=
")<br />[ <a title=\"".str_replace(
"#FILE_NAME#", $arrA[
"USER_FILE_NAME"],
GetMessage(
"FORM_DOWNLOAD_FILE")).
"\" href=\"".$file_link.
"&action=download\">".
GetMessage(
"FORM_DOWNLOAD").
"</a> ]";
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
check_bitrix_sessid($varname='sessid')
htmlspecialcharsback($str)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
TxtToHTML( $str, $bMakeUrls=true, $iMaxStringLen=0, $QUOTE_ENABLED="N", $NOT_CONVERT_AMPERSAND="Y", $CODE_ENABLED="N", $BIU_ENABLED="N", $quote_table_class="quotetable", $quote_head_class="tdquotehead", $quote_body_class="tdquote", $code_table_class="codetable", $code_head_class="tdcodehead", $code_body_class="tdcodebody", $code_textarea_class="codetextarea", $link_class="txttohtmllink", $arUrlEvent=[], $link_target="_self")
GetMessage($name, $aReplace=null)
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
$GLOBALS['_____370096793']