コード例 #1
0
 function getData(&$arResult)
 {
     global $APPLICATION, $USER;
     //$arResult = $this->__prepareDataForTpl();
     $arResult["WEB_FORM_ID"] = $this->WEB_FORM_ID;
     $arResult["WEB_FORM_NAME"] = $this->WEB_FORM_NAME;
     if ($this->RESULT_ID > 0) {
         $arResult["RESULT_ID"] = $this->RESULT_ID;
     }
     $arResult["F_RIGHT"] = $this->F_RIGHT;
     if (strlen($_REQUEST["web_form_submit"]) > 0 || strlen($_REQUEST["web_form_apply"]) > 0) {
         $this->arrVALUES = $_REQUEST;
         if ($this->RESULT_ID) {
             $this->__form_validate_errors = CForm::Check($this->WEB_FORM_ID, $this->arrVALUES, $this->RESULT_ID);
         } else {
             $this->__form_validate_errors = CForm::Check($this->WEB_FORM_ID, $this->arrVALUES);
         }
         if (!$this->isFormErrors()) {
             if (check_bitrix_sessid()) {
                 $return = false;
                 if ($this->RESULT_ID) {
                     CFormResult::Update($this->RESULT_ID, $this->arrVALUES, $this->arParams["EDIT_ADDITIONAL"]);
                     $this->strFormNote = GetMessage("FORM_DATA_SAVED");
                     if (strlen($_REQUEST["web_form_submit"]) > 0 && !(defined("ADMIN_SECTION") && ADMIN_SECTION === true)) {
                         if ($this->arParams["SEF_MODE"] == "Y") {
                             LocalRedirect($this->arParams["LIST_URL"] . "?strFormNote=" . urlencode($this->strFormNote));
                         } else {
                             LocalRedirect($this->arParams["LIST_URL"] . (strpos($this->arParams["LIST_URL"], "?") === false ? "?" : "&") . "WEB_FORM_ID=" . $this->WEB_FORM_ID . "&strFormNote=" . urlencode($this->strFormNote));
                         }
                         die;
                     }
                     if (strlen($_REQUEST["web_form_apply"]) > 0 && !(defined("ADMIN_SECTION") && ADMIN_SECTION === true) && $this->arParams["SEF_MODE"] == "Y") {
                         // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                         LocalRedirect($this->arParams["EDIT_URL"] . (strpos($this->arParams["EDIT_URL"], "?") === false ? "?" : "&") . "strFormNote=" . urlencode($this->strFormNote));
                         die;
                     }
                     if (defined("ADMIN_SECTION") && ADMIN_SECTION === true) {
                         if (strlen($_REQUEST["web_form_submit"]) > 0) {
                             LocalRedirect(BX_ROOT . "/admin/form_result_list.php?lang=" . LANG . "&WEB_FORM_ID=" . $this->WEB_FORM_ID . "&strFormNote=" . urlencode($this->strFormNote));
                         } elseif (strlen($_REQUEST["web_form_apply"]) > 0) {
                             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));
                         }
                         die;
                     }
                 } else {
                     if ($this->RESULT_ID = CFormResult::Add($this->WEB_FORM_ID, $this->arrVALUES)) {
                         $this->strFormNote = GetMessage("FORM_DATA_SAVED1") . $this->RESULT_ID . GetMessage("FORM_DATA_SAVED2");
                         CFormResult::SetEvent($this->RESULT_ID);
                         CFormResult::Mail($this->RESULT_ID);
                         if ($this->F_RIGHT >= 15) {
                             if (strlen($_REQUEST["web_form_submit"]) > 0 && strlen($this->arParams["LIST_URL"]) > 0) {
                                 if ($this->arParams["SEF_MODE"] == "Y") {
                                     LocalRedirect($this->arParams["LIST_URL"] . "?strFormNote=" . urlencode($this->strFormNote));
                                 } else {
                                     LocalRedirect($this->arParams["LIST_URL"] . (strpos($this->arParams["LIST_URL"], "?") === false ? "?" : "&") . "WEB_FORM_ID=" . $this->WEB_FORM_ID . "&RESULT_ID=" . $this->RESULT_ID . "&strFormNote=" . urlencode($this->strFormNote));
                                 }
                                 die;
                             } elseif (strlen($_REQUEST["web_form_apply"]) > 0 && strlen($this->arParams["EDIT_URL"]) > 0) {
                                 if ($this->arParams["SEF_MODE"] == "Y") {
                                     LocalRedirect(str_replace("#RESULT_ID#", $this->RESULT_ID . $this->arParams["EDIT_URL"]) . "?strFormNote=" . urlencode($this->strFormNote));
                                 } else {
                                     LocalRedirect($this->arParams["EDIT_URL"] . (strpos($this->arParams["EDIT_URL"], "?") === false ? "?" : "&") . "RESULT_ID=" . $this->RESULT_ID . "&strFormNote=" . urlencode($this->strFormNote));
                                 }
                                 die;
                             }
                             $arResult["return"] = true;
                         } else {
                             LocalRedirect($APPLICATION->GetCurPage() . "?WEB_FORM_ID=" . $this->WEB_FORM_ID . "&strFormNote=" . urlencode($this->strFormNote));
                             die;
                         }
                     } else {
                         $this->__form_validate_errors = $GLOBALS["strError"];
                     }
                 }
             }
         }
     }
     return $arResult;
 }
コード例 #2
0
 function Mail($RESULT_ID, $TEMPLATE_ID = "")
 {
     return CFormResult::Mail($RESULT_ID, $TEMPLATE_ID);
 }
コード例 #3
0
ファイル: component.php プロジェクト: CheBurashka334/zakrepi
			{
				// check user session
				if (check_bitrix_sessid())
				{
					$return = false;

					// add result
					if($RESULT_ID = CFormResult::Add($arParams["WEB_FORM_ID"], $arResult["arrVALUES"]))
					{
						//$arResult["FORM_NOTE"] = GetMessage("FORM_DATA_SAVED1").$RESULT_ID.GetMessage("FORM_DATA_SAVED2");
						$arResult["FORM_RESULT"] = 'addok';

						// send email notifications
						CFormCRM::onResultAdded($arParams["WEB_FORM_ID"], $RESULT_ID);
						CFormResult::SetEvent($RESULT_ID);
						CFormResult::Mail($RESULT_ID);

						// choose type of user redirect and do it

						if ($arResult["F_RIGHT"] >= 15)
						{
							if (strlen($_REQUEST["web_form_submit"])>0 && strlen($arParams["LIST_URL"]) > 0)
							{
								if ($arParams["SEF_MODE"] == "Y")
								{
									//LocalRedirect($arParams["LIST_URL"]."?strFormNote=".urlencode($arResult["FORM_NOTE"]));
									LocalRedirect(
										str_replace(
											array('#WEB_FORM_ID#', '#RESULT_ID#'),
											array($arParams['WEB_FORM_ID'], $RESULT_ID),
											$arParams["LIST_URL"]
コード例 #4
0
ファイル: class.php プロジェクト: notagency/notagency.base
 /**
  * Отправляет почтовые уведомления
  */
 protected function sendEmails($resultId)
 {
     \CFormResult::Mail($resultId);
 }