1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
form_cformoutput_old.php
См. документацию.
1<?
3{
11 function Init($arParams, $admin = false)
12 {
13 global $APPLICATION, $USER;
14
15 $this->bSimple = (COption::GetOptionString("form", "SIMPLE", "Y") == "Y") ? true : false;
16 $this->comp2 = !empty($arParams["COMPONENT"]);
17 $this->SHOW_INCLUDE_AREAS = $APPLICATION->GetShowIncludeAreas();
18
19 if ($admin)
20 {
21 $FORM_RIGHT = $APPLICATION->GetGroupRight("form");
22 if($FORM_RIGHT<="D") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
23
24 $this->__admin = true;
25 }
26
27 $this->arParams = $arParams;
28
29 $this->RESULT_ID = intval($arParams["RESULT_ID"] ?? 0);
30 if (intval($this->RESULT_ID)<=0) $this->RESULT_ID = intval($_REQUEST["RESULT_ID"] ?? 0);
31
32 // if there's result ID try to get form ID
33 if (intval($this->RESULT_ID) > 0)
34 {
35 $DBRes = CFormResult::GetByID($this->RESULT_ID);
36
37 if ($arrResult = $DBRes->Fetch())
38 {
39 $this->WEB_FORM_ID = intval($arrResult["FORM_ID"]);
40 }
41 }
42
43 if (intval($this->WEB_FORM_ID) <= 0)
44 $this->WEB_FORM_ID = intval($arParams["WEB_FORM_ID"]);
45
46 // if there's no WEB_FORM_ID, try to get it from $_REQUEST;
47 if (intval($this->WEB_FORM_ID) <= 0)
48 $this->WEB_FORM_ID = intval($_REQUEST["WEB_FORM_ID"]);
49
50 // check WEB_FORM_ID and get web form data
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');
52
53 $this->WEB_FORM_NAME = $this->arForm["SID"];
54
55 // if wrong WEB_FORM_ID return error;
56 if ($this->WEB_FORM_ID > 0)
57 {
58 // insert chain item
59 if (!empty($this->arParams["CHAIN_ITEM_TEXT"]))
60 {
61 $APPLICATION->AddChainItem($this->arParams["CHAIN_ITEM_TEXT"], $this->arParams["CHAIN_ITEM_LINK"]);
62 }
63
64 // check web form rights;
65 $this->F_RIGHT = intval(CForm::GetPermission($this->WEB_FORM_ID));
66
67 // in no form access - return error
68 if ($this->isAccessForm())
69 {
70 if (!empty($_REQUEST["strFormNote"])) $this->strFormNote = $_REQUEST["strFormNote"];
71
72 if (!$this->comp2 || $this->arParams["COMPONENT"]["componentName"] != "bitrix:form.result.list" || $this->isAccessFormResultList())
73 {
74 if ($this->RESULT_ID)
75 {
76 if ($this->isAccessFormResult($arrResult))
77 {
78 $this->arrRESULT_PERMISSION = CFormResult::GetPermissions($this->RESULT_ID);
79
80 // check result rights
81 if (
82 !$this->comp2 && !$this->isAccessFormResultEdit() // for components1 - check only editing right
83 ||
84 $this->comp2 && // for components2 - check whether there's editing or viewing and check rights for it
85 (
86 $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.edit" && !$this->isAccessFormResultEdit()
87 ||
88 $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.view" && !$this->isAccessFormResultView()
89 )
90 )
91 {
92 $this->__error_msg = "FORM_RESULT_ACCESS_DENIED";
93 }
94 else
95 {
96 if (!$arrResult)
97 {
98 $z = CFormResult::GetByID($this->RESULT_ID);
99 $this->arResult = $z->Fetch();
100 }
101 else
102 {
103 $this->arResult = $arrResult;
104 }
105
106 if ($this->arResult)
107 {
108 if ($this->comp2 && $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.view")
109 {
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];
112 }
113 else
114 {
115 $this->arrVALUES = CFormResult::GetDataByIDForHTML($this->RESULT_ID, $this->arParams["EDIT_ADDITIONAL"]);
116 }
117 }
118 else
119 {
120 $this->__error_msg = "FORM_RECORD_NOT_FOUND";
121 }
122 }
123 }
124 else
125 {
126 $this->__error_msg = "FORM_ACCESS_DENIED";
127 }
128
129 $this->arForm["USE_CAPTCHA"] = "N";
130 }
131 else
132 {
133 // if form uses CAPCHA initialize it
134 if ($this->arForm["USE_CAPTCHA"] == "Y") $this->CaptchaInitialize();
135 }
136 }
137 else
138 {
139 $this->__error_msg = "FORM_ACCESS_DENIED";
140 }
141 }
142 else
143 {
144 $this->__error_msg = "FORM_ACCESS_DENIED";
145 } // endif ($F_RIGHT>=10);
146 }
147 else
148 {
149 $this->__error_msg = "FORM_NOT_FOUND";
150
151 } // endif ($WEB_FORM_ID>0);
152
153 return empty($this->__error_msg);
154 }
155
156 function __checkFilter(&$str_error) // check of filter values
157 {
158 global $strError, $MESS, $arrFORM_FILTER;
159 global $find_date_create_1, $find_date_create_2;
160 $str = "";
161
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>";
166
167 if (is_array($arrFORM_FILTER))
168 {
169 reset($arrFORM_FILTER);
170 foreach ($arrFORM_FILTER as $arrF)
171 {
172 if (is_array($arrF))
173 {
174 foreach ($arrF as $arr)
175 {
176 $title = ($arr["TITLE_TYPE"]=="html") ? strip_tags(htmlspecialcharsback($arr["TITLE"])) : $arr["TITLE"];
177 if ($arr["FILTER_TYPE"]=="date")
178 {
179 $date1 = $_GET["find_".$arr["FID"]."_1"];
180 $date2 = $_GET["find_".$arr["FID"]."_2"];
181 CheckFilterDates($date1, $date2, $date1_wrong, $date2_wrong, $date2_less);
182 if ($date1_wrong=="Y")
183 $str .= str_replace("#TITLE#", $title, GetMessage("FORM_WRONG_DATE1"))."<br>";
184 if ($date2_wrong=="Y")
185 $str .= str_replace("#TITLE#", $title, GetMessage("FORM_WRONG_DATE2"))."<br>";
186 if ($date2_less=="Y")
187 $str .= str_replace("#TITLE#", $title, GetMessage("FORM_DATE2_LESS"))."<br>";
188 }
189 if ($arr["FILTER_TYPE"]=="integer")
190 {
191 $int1 = intval($_GET["find_".$arr["FID"]."_1"]);
192 $int2 = intval($_GET["find_".$arr["FID"]."_2"]);
193 if ($int1>0 && $int2>0 && $int2<$int1)
194 {
195 $str .= str_replace("#TITLE#", $title, GetMessage("FORM_INT2_LESS"))."<br>";
196 }
197 }
198 }
199 }
200 }
201 }
202 $strError .= $str;
203 $str_error .= $str;
204 if ($str <> '') return false; else return true;
205 }
206
208 {
209 $FilterArr = Array(
210 "find_id",
211 "find_id_exact_match",
212 "find_status",
213 "find_status_id",
214 "find_status_id_exact_match",
215 "find_timestamp_1",
216 "find_timestamp_2",
217 "find_date_create_2",
218 "find_date_create_1",
219 "find_date_create_2",
220 "find_registered",
221 "find_user_auth",
222 "find_user_id",
223 "find_user_id_exact_match",
224 "find_guest_id",
225 "find_guest_id_exact_match",
226 "find_session_id",
227 "find_session_id_exact_match"
228 );
229
230 $z = CFormField::GetFilterList($this->WEB_FORM_ID, array("ACTIVE" => "Y"));
231 while ($zr=$z->Fetch())
232 {
233 $FID = $this->WEB_FORM_NAME."_".$zr["SID"]."_".$zr["PARAMETER_NAME"]."_".$zr["FILTER_TYPE"];
234 $zr["FID"] = $FID;
235 $arrFORM_FILTER[$zr["SID"]][] = $zr;
236 $fname = "find_".$FID;
237 if ($zr["FILTER_TYPE"]=="date" || $zr["FILTER_TYPE"]=="integer")
238 {
239 $FilterArr[] = $fname."_1";
240 $FilterArr[] = $fname."_2";
241 $FilterArr[] = $fname."_0";
242 }
243 elseif ($zr["FILTER_TYPE"]=="text")
244 {
245 $FilterArr[] = $fname;
246 $FilterArr[] = $fname."_exact_match";
247 }
248 else $FilterArr[] = $fname;
249 }
250 $sess_filter = "FORM_RESULT_LIST_".$this->WEB_FORM_NAME;
251 if ($_REQUEST["set_filter"] <> '')
252 InitFilterEx($FilterArr,$sess_filter,"set");
253 else
254 InitFilterEx($FilterArr,$sess_filter,"get");
255 if ($_REQUEST["del_filter"] <> '')
256 {
257 DelFilterEx($FilterArr,$sess_filter);
258 }
259 else
260 {
261 InitBVar($find_id_exact_match);
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);
266 $str_error = "";
267 if ($this->__checkFilter($str_error))
268 {
269 $arFilter = Array(
270 "ID" => $find_id,
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
287 );
288
289 if (is_array($arrFORM_FILTER))
290 {
291 foreach ($arrFORM_FILTER as $arrF)
292 {
293 foreach ($arrF as $arr)
294 {
295 if ($arr["FILTER_TYPE"]=="date" || $arr["FILTER_TYPE"]=="integer")
296 {
297 $arFilter[$arr["FID"]."_1"] = ${"find_".$arr["FID"]."_1"};
298 $arFilter[$arr["FID"]."_2"] = ${"find_".$arr["FID"]."_2"};
299 $arFilter[$arr["FID"]."_0"] = ${"find_".$arr["FID"]."_0"};
300 }
301 elseif ($arr["FILTER_TYPE"]=="text")
302 {
303 $arFilter[$arr["FID"]] = ${"find_".$arr["FID"]};
304 $exact_match = (${"find_".$arr["FID"]."_exact_match"}=="Y") ? "Y" : "N";
305 $arFilter[$arr["FID"]."_exact_match"] = $exact_match;
306 }
307 else $arFilter[$arr["FID"]] = ${"find_".$arr["FID"]};
308 }
309 }
310 }
311 }
312 }
313 return $arFilter;
314 }
315
321 function Out()
322 {
323 global $APPLICATION, $USER;
324
325 $this->arParams['USE_EXTENDED_ERRORS'] = 'N';
326
327 if ($_REQUEST["web_form_submit"] <> '' || $_REQUEST["web_form_apply"] <> '')
328 {
329 $this->arrVALUES = $_REQUEST;
330
331 if ($this->RESULT_ID)
332 {
333 $this->__form_validate_errors = CForm::Check($this->WEB_FORM_ID, $this->arrVALUES, $this->RESULT_ID);
334 }
335 else
336 {
337 $this->__form_validate_errors = CForm::Check($this->WEB_FORM_ID, $this->arrVALUES);
338 }
339
340 if (!$this->isFormErrors())
341 {
343 {
344 $return = false;
345 if ($this->RESULT_ID)
346 {
347 CFormResult::Update($this->RESULT_ID, $this->arrVALUES, $this->arParams["EDIT_ADDITIONAL"]);
348
349 $this->strFormNote = GetMessage("FORM_DATA_SAVED");
350
351 if ($_REQUEST["web_form_submit"] <> '' && !(defined("ADMIN_SECTION") && ADMIN_SECTION===true))
352 {
353 LocalRedirect($this->arParams["LIST_URL"].(mb_strpos($this->arParams["LIST_URL"], "?") === false ? "?" : "&")."WEB_FORM_ID=".$this->WEB_FORM_ID."&strFormNote=".urlencode($this->strFormNote));
354 }
355
356 if (defined("ADMIN_SECTION") && ADMIN_SECTION === true)
357 {
358 if ($_REQUEST["web_form_submit"] <> '')
359 LocalRedirect(BX_ROOT."/admin/form_result_list.php?lang=".LANG."&WEB_FORM_ID=".$this->WEB_FORM_ID."&strFormNote=".urlencode($this->strFormNote));
360 elseif ($_REQUEST["web_form_apply"] <> '')
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));
362 die();
363 }
364 /*
365 else
366 {
367 $DBRes = CFormResult::GetByID($this->RESULT_ID);
368 $arrResult = $DBRes->Fetch();
369 }
370 */
371 }
372 else
373 {
374 if($this->RESULT_ID = CFormResult::Add($this->WEB_FORM_ID, $this->arrVALUES))
375 {
376 $this->strFormNote = GetMessage("FORM_DATA_SAVED1").$this->RESULT_ID.GetMessage("FORM_DATA_SAVED2");
377 CFormResult::SetEvent($this->RESULT_ID);
378 CFormResult::Mail($this->RESULT_ID);
379
380 if ($this->F_RIGHT >= 15)
381 {
382 if ($_REQUEST["web_form_submit"] <> '' && $this->arParams["LIST_URL"] <> '')
383 {
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));
385 }
386 elseif ($_REQUEST["web_form_apply"] <> '' && $this->arParams["EDIT_URL"] <> '')
387 {
388 LocalRedirect($this->arParams["EDIT_URL"].(mb_strpos($this->arParams["EDIT_URL"], "?") === false ? "?" : "&")."RESULT_ID=".$this->RESULT_ID."&strFormNote=".urlencode($this->strFormNote));
389 }
390
391 $return = true;
392 }
393 else
394 {
395 LocalRedirect($APPLICATION->GetCurPage()."?lang=".LANGUAGE_ID."&WEB_FORM_ID=".$this->WEB_FORM_ID."&strFormNote=".urlencode($this->strFormNote));
396 }
397 }
398 else
399 {
400 $this->__form_validate_errors = $GLOBALS["strError"];
401 }
402 }
403 }
404 }
405 }
406
407 $strReturn = $this->IncludeFormCustomTemplate();
408 if ($strReturn == '')
409 {
410 ob_start();
411 $GLOBALS["FORM"] =& $this; // create interface for template
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();
414 ob_end_clean();
415 }
416
417 $back_url = $_SERVER['REQUEST_URI'];
418
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)."'";
423
424 if(!file_exists($_SERVER["DOCUMENT_ROOT"].$path))
425 {
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)."'";
428 if(!file_exists($_SERVER["DOCUMENT_ROOT"].$path))
429 {
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)."'";
432 }
433 }
434
435 if ($USER->IsAdmin())
436 {
437 $APPLICATION->AddPanelButton(array(
438 "SORT" => 100,
439 "MAIN_SORT" => 1000,
440 "HREF" => "/bitrix/admin/form_edit.php?lang=".LANGUAGE_ID."&amp;ID=".$this->WEB_FORM_ID. "&amp;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")
443 ));
444
445 $APPLICATION->AddPanelButton(array(
446 "SORT" => 200,
447 "MAIN_SORT" => 1000,
448 "HREF" => $href,
449 "SRC" => "/bitrix/images/form/edit_default_templ.gif",
450 "ALT" => GetMessage("FORM_PUBLIC_ICON_EDIT_DEFAULT_TPL"),
451 ));
452
453 if($APPLICATION->GetShowIncludeAreas())
454 {
455 if ($this->arForm["USE_DEFAULT_TEMPLATE"] == "N")
456 {
457 $arIcons = Array();
458 $arIcons[] =
459 Array(
460 "URL" => "/bitrix/admin/form_edit.php?lang=".LANGUAGE_ID."&amp;ID=".$this->WEB_FORM_ID. "&amp;tabControl_active_tab=edit5&back_url=".urlencode($back_url),
461 "ICON" => 'form-edit-tpl',
462 "ALT" => GetMessage("FORM_PUBLIC_ICON_EDIT_TPL")
463 );
464 $strReturn = $APPLICATION->IncludeString($strReturn, $arIcons);
465 }
466 else
467 {
468 $arIcons = Array();
469 $arIcons[] =
470 Array(
471 "URL" => $href,
472 "SRC" => "/bitrix/images/form/edit_default_templ.gif",
473 "ICON" => 'form-edit-default-tpl',
474 "ALT" => GetMessage("FORM_PUBLIC_ICON_EDIT_DEFAULT_TPL"),
475 );
476 $strReturn = $APPLICATION->IncludeString($strReturn, $arIcons);
477 }
478 }
479
480 }
481
482 echo $strReturn;
483 }
484
486 {
487 global $APPLICATION, $USER;
488
489 //$arResult = $this->__prepareDataForTpl();
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;
493 $arResult["F_RIGHT"] = $this->F_RIGHT;
494
495 if ($_REQUEST["web_form_submit"] <> '' || $_REQUEST["web_form_apply"] <> '')
496 {
497 $this->arrVALUES = $_REQUEST;
498
499 if ($this->RESULT_ID)
500 {
501 $this->__form_validate_errors = CForm::Check($this->WEB_FORM_ID, $this->arrVALUES, $this->RESULT_ID);
502 }
503 else
504 {
505 $this->__form_validate_errors = CForm::Check($this->WEB_FORM_ID, $this->arrVALUES);
506 }
507
508 if (!$this->isFormErrors())
509 {
511 {
512 $return = false;
513
514 if ($this->RESULT_ID)
515 {
516 CFormResult::Update($this->RESULT_ID, $this->arrVALUES, $this->arParams["EDIT_ADDITIONAL"]);
517
518 $this->strFormNote = GetMessage("FORM_DATA_SAVED");
519
520 if ($_REQUEST["web_form_submit"] <> '' && !(defined("ADMIN_SECTION") && ADMIN_SECTION===true))
521 {
522 if ($this->arParams["SEF_MODE"] == "Y")
523 LocalRedirect($this->arParams["LIST_URL"]."?strFormNote=".urlencode($this->strFormNote));
524 else
525 LocalRedirect($this->arParams["LIST_URL"].(mb_strpos($this->arParams["LIST_URL"], "?") === false ? "?" : "&")."WEB_FORM_ID=".$this->WEB_FORM_ID."&strFormNote=".urlencode($this->strFormNote));
526
527 die();
528 }
529
530 if ($_REQUEST["web_form_apply"] <> '' && !(defined("ADMIN_SECTION") && ADMIN_SECTION===true) && $this->arParams["SEF_MODE"] == "Y")
531 {
532 LocalRedirect($this->arParams["EDIT_URL"].(mb_strpos($this->arParams["EDIT_URL"], "?") === false ? "?" : "&")."strFormNote=".urlencode($this->strFormNote));
533 die();
534 }
535
536 if (defined("ADMIN_SECTION") && ADMIN_SECTION === true)
537 {
538 if ($_REQUEST["web_form_submit"] <> '')
539 {
540 LocalRedirect(BX_ROOT."/admin/form_result_list.php?lang=".LANG."&WEB_FORM_ID=".$this->WEB_FORM_ID."&strFormNote=".urlencode($this->strFormNote));
541 }
542 elseif ($_REQUEST["web_form_apply"] <> '')
543 {
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));
545 }
546 die();
547 }
548
549 }
550 else
551 {
552 if($this->RESULT_ID = CFormResult::Add($this->WEB_FORM_ID, $this->arrVALUES))
553 {
554 $this->strFormNote = GetMessage("FORM_DATA_SAVED1").$this->RESULT_ID.GetMessage("FORM_DATA_SAVED2");
555
556 CFormResult::SetEvent($this->RESULT_ID);
557 CFormResult::Mail($this->RESULT_ID);
558
559 if ($this->F_RIGHT >= 15)
560 {
561 if ($_REQUEST["web_form_submit"] <> '' && $this->arParams["LIST_URL"] <> '')
562 {
563 if ($this->arParams["SEF_MODE"] == "Y")
564 LocalRedirect($this->arParams["LIST_URL"]."?strFormNote=".urlencode($this->strFormNote));
565 else
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));
567 die();
568 }
569 elseif ($_REQUEST["web_form_apply"] <> '' && $this->arParams["EDIT_URL"] <> '')
570 {
571 if ($this->arParams["SEF_MODE"] == "Y")
572 LocalRedirect(str_replace("#RESULT_ID#", $this->RESULT_ID. $this->arParams["EDIT_URL"])."?strFormNote=".urlencode($this->strFormNote));
573 else
574 LocalRedirect($this->arParams["EDIT_URL"].(mb_strpos($this->arParams["EDIT_URL"], "?") === false ? "?" : "&")."RESULT_ID=".$this->RESULT_ID."&strFormNote=".urlencode($this->strFormNote));
575 die();
576 }
577
578 $arResult["return"] = true;
579 }
580 else
581 {
582 LocalRedirect($APPLICATION->GetCurPage()."?WEB_FORM_ID=".$this->WEB_FORM_ID."&strFormNote=".urlencode($this->strFormNote));
583 die();
584 }
585 }
586 else
587 {
588 $this->__form_validate_errors = $GLOBALS["strError"];
589 }
590 }
591 }
592 }
593 }
594
595 return $arResult;
596 }
597
598 function getListData()
599 {
600 $arFilter = $this->__prepareFilter();
602 $arResult["arFilter"] = $arFilter;
603 return $arResult;
604 }
605
607 {
608 global $APPLICATION;
609
610 $arResult = array();
611
612 if ($this->arResult)
613 {
614 if (intval($this->arResult["USER_ID"])>0)
615 {
616 $rsUser = CUser::GetByID($this->arResult["USER_ID"]);
617 $arUser = $rsUser->Fetch();
618 $this->arResult["LOGIN"] = htmlspecialcharsbx($arUser["LOGIN"]);
619 $this->arResult["EMAIL"] = $arUser["USER_EMAIL"];
620 $this->arResult["FIRST_NAME"] = htmlspecialcharsbx($arUser["NAME"]);
621 $this->arResult["LAST_NAME"] = htmlspecialcharsbx($arUser["LAST_NAME"]);
622 }
623 }
624
625 $arResult["FORM"] =& $this;
626 return $arResult;
627 }
628
634 {
635 $this->CAPTCHACode = $GLOBALS["APPLICATION"]->CaptchaGetCode();
636 }
637
638 function ShowAnswer($FIELD_SID)
639 {
640 global $USER;
641
642 $out = "";
643
644 $arQuestion = $this->arQuestions[$FIELD_SID];
645 $arrResultAnswer = $this->arrVALUES[$arQuestion["ID"]];
646
647 if (is_array($arrResultAnswer))
648 {
649 reset($arrResultAnswer);
650 $count = count($arrResultAnswer);
651 $i=0;
652 foreach ($arrResultAnswer as $key => $arrA)
653 {
654 $i++;
655
656 if (trim($arrA["USER_TEXT"]) <> '')
657 {
658 if (intval($arrA["USER_FILE_ID"])>0)
659 {
660 if ($arrA["USER_FILE_IS_IMAGE"]=="Y" && $USER->IsAdmin())
661 $out .= htmlspecialcharsbx($arrA["USER_TEXT"])."<br />";
662 }
663 else $out .= TxtToHTML($arrA["USER_TEXT"],true,50)."<br />";
664 }
665
666 if (trim($arrA["ANSWER_TEXT"]) <> '')
667 {
668 $answer = "[<span class='form-anstext'>".TxtToHTML($arrA["ANSWER_TEXT"],true,50)."</span>]";
669 if (trim($arrA["ANSWER_VALUE"]) <> '') $answer .= "&nbsp;"; else $answer .= "<br />";
670 $out .= $answer;
671 }
672
673 if ($this->arParams["SHOW_ANSWER_VALUE"]=="Y")
674 {
675 if (trim($arrA["ANSWER_VALUE"]) <> '')
676 $out .= "(<span class='form-ansvalue'>".TxtToHTML($arrA["ANSWER_VALUE"],true,50)."</span>)<br />";
677 }
678
679 if (intval($arrA["USER_FILE_ID"])>0)
680 {
681 if ($arrA["USER_FILE_IS_IMAGE"]=="Y")
682 {
683 $out .= CFile::ShowImage($arrA["USER_FILE_ID"], 0, 0, "border=0", "", true);
684 }
685 else
686 {
687 $file_link = "/bitrix/tools/form_show_file.php?rid=".$this->RESULT_ID."&hash=".$arrA["USER_FILE_HASH"]."&lang=".LANGUAGE_ID;
688
689 $out .= "<a title=\"".GetMessage("FORM_VIEW_FILE")."\" target=\"_blank\" href=\"".$file_link."\">".htmlspecialcharsbx($arrA["USER_FILE_NAME"])."</a><br />(";
690
691 $out .= CFile::FormatSize($arrA["USER_FILE_SIZE"]);
692
693 $out .= ")<br />[&nbsp;<a title=\"".str_replace("#FILE_NAME#", $arrA["USER_FILE_NAME"], GetMessage("FORM_DOWNLOAD_FILE"))."\" href=\"".$file_link."&action=download\">".GetMessage("FORM_DOWNLOAD")."</a>&nbsp;]";
694 } //endif;
695 } //endif;
696 } //endforeach;
697 } //endif;
698
699 return $out;
700 }
701}
$arParams
Определения access_dialog.php:21
$path
Определения access_edit.php:21
$back_url
Определения access_edit.php:50
$count
Определения admin_tab.php:4
const BX_ROOT
Определения bx_root.php:3
global $APPLICATION
Определения include.php:80
$arResult
Определения generate_coupon.php:16
static GetFilterList($WEB_FORM_ID, $arFilter=Array())
Определения form_callformfield.php:397
static GetPermission($form_id, $arGroups=false, $get_from_database="")
Определения form_callform.php:254
static Check($WEB_FORM_ID, $arrVALUES=false, $RESULT_ID=false, $CHECK_RIGHTS="Y", $RETURN_ARRAY="N")
Определения form_callform.php:941
static GetResultAnswerArray($WEB_FORM_ID, &$arrColumns, &$arrAnswers, &$arrAnswersSID, $arFilter=Array())
Определения form_callform.php:17
static GetDataByID($WEB_FORM_ID, &$arForm, &$arQuestions, &$arAnswers, &$arDropDown, &$arMultiSelect, $additional="N", $active="N")
Определения form_callform.php:859
static GetDataByIDForHTML($RESULT_ID, $GET_ADDITIONAL="N")
Определения form_callformresult.php:174
static Update($RESULT_ID, $arrVALUES=false, $UPDATE_ADDITIONAL="N", $CHECK_RIGHTS="Y")
Определения form_callformresult.php:712
static SetEvent($RESULT_ID, $IN_EVENT1=false, $IN_EVENT2=false, $IN_EVENT3=false, $money="", $currency="", $goto="", $chargeback="N")
Определения form_callformresult.php:77
static Mail($RESULT_ID, $TEMPLATE_ID=false)
Определения form_callformresult.php:1694
static Add($WEB_FORM_ID, $arrVALUES=false, $CHECK_RIGHTS="Y", $USER_ID=false)
Определения form_callformresult.php:294
__prepareDataForTpl()
Определения form_cformoutput_old.php:606
__prepareFilter()
Определения form_cformoutput_old.php:207
ShowAnswer($FIELD_SID)
Определения form_cformoutput_old.php:638
CaptchaInitialize()
Определения form_cformoutput_old.php:633
getData(&$arResult)
Определения form_cformoutput_old.php:485
Init($arParams, $admin=false)
Определения form_cformoutput_old.php:11
__checkFilter(&$str_error)
Определения form_cformoutput_old.php:156
static GetPermissions($RESULT_ID, &$CURRENT_STATUS_ID=null)
Определения form_cformresult.php:419
static GetByID($ID)
Определения form_cformresult.php:391
$str
Определения commerceml2.php:63
$arr
Определения file_new.php:624
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
CheckFilterDates($date1, $date2, &$date1_wrong, &$date2_wrong, &$date2_less_date1)
Определения filter_tools.php:7
InitFilterEx($arName, $varName, $action="set", $session=true, $FilterLogic="FILTER_logic")
Определения filter_tools.php:20
DelFilterEx($arName, $varName, $session=true, $FilterLogic="FILTER_logic")
Определения filter_tools.php:93
$FORM_RIGHT
Определения form_validator_props.php:4
$zr
Определения options.php:5
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
global $MESS
Определения bill.php:2
$strError
Определения options_user_settings.php:4
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$z
Определения options.php:31
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
htmlspecialcharsback($str)
Определения tools.php:2693
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
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")
Определения tools.php:2442
GetMessage($name, $aReplace=null)
Определения tools.php:3397
InitBVar(&$var)
Определения tools.php:4433
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
die
Определения quickway.php:367
const ADMIN_SECTION
Определения rss.php:2
$i
Определения factura.php:643
</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."%"
Определения waybill.php:936
$title
Определения pdf.php:123
$GLOBALS['_____370096793']
Определения update_client.php:1
$arFilter
Определения user_search.php:106