当前位置: 首页>>代码示例>>PHP>>正文


PHP CForm::SetMailTemplate方法代码示例

本文整理汇总了PHP中CForm::SetMailTemplate方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::SetMailTemplate方法的具体用法?PHP CForm::SetMailTemplate怎么用?PHP CForm::SetMailTemplate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CForm的用法示例。


在下文中一共展示了CForm::SetMailTemplate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CreateForm

function CreateForm($arForm, $arFormFields, $langFile)
{
    if (!CModule::IncludeModule("form")) {
        return false;
    }
    // set defaults
    $arFieldDefaults = array("ACTIVE" => "Y", "C_SORT" => 0, "ADDITIONAL" => "N", "TITLE_TYPE" => "text", "IN_RESULTS_TABLE" => "Y", "IN_EXCEL_TABLE" => "Y");
    foreach ($arFormFields as $key => $arField) {
        if ($arFormFields['ADDITIONAL'] == 'Y' && !is_set($arFormFields['C_SORT'])) {
            $arFormFields['C_SORT'] = 5000;
        }
        $arFieldDefaults["C_SORT"] += 100;
        $arFormFields[$key] = array_merge($arFieldDefaults, $arField);
        $arFormFields[$key]["TITLE"] = GetMessage($arField["SID"] . "_QUESTION");
    }
    $rsLanguage = CLanguage::GetList($by, $order, array());
    while ($arLanguage = $rsLanguage->Fetch()) {
        WizardServices::IncludeServiceLang($langFile, $arLanguage["LID"]);
        $arForm["arMENU"][$arLanguage["LID"]] = GetMessage(substr($arForm["SID"], 0, -3) . "_MENU_NAME");
    }
    $dbForm = CForm::GetBySID($arForm["SID"]);
    if ($dbForm->Fetch()) {
        return;
    }
    WizardServices::IncludeServiceLang("status.php");
    if ($formID = CForm::Set($arForm, false, "N")) {
        // setup form fields
        foreach ($arFormFields as $key => $arField) {
            $arField["FORM_ID"] = $formID;
            $fieldID = CFormField::Set($arField, false, "N");
        }
        if ($arTemplates = CForm::SetMailTemplate($formID)) {
            CForm::Set(array('SID' => $arForm['SID'], 'arMAIL_TEMPLATE' => $arTemplates), $formID, 'N');
        }
        $arStatuses = array(array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_NEW"), "C_SORT" => 100, "ACTIVE" => "Y", "DEFAULT_VALUE" => "Y", "CSS" => "statusgray", "arPERMISSION_VIEW" => array(0), "arPERMISSION_MOVE" => array(0), "arPERMISSION_EDIT" => array(0), "arPERMISSION_DELETE" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_RECEIVED"), "C_SORT" => 200, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusblue", "arPERMISSION_VIEW" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_DONE"), "C_SORT" => 300, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusgreen", "arPERMISSION_VIEW" => array(0)), array("FORM_ID" => $formID, "TITLE" => GetMessage("STATUS_REFUSE"), "C_SORT" => 400, "ACTIVE" => "Y", "DEFAULT_VALUE" => "N", "CSS" => "statusred", "arPERMISSION_VIEW" => array(0)));
        foreach ($arStatuses as $key => $arStatus) {
            if ($STATUS_ID = CFormStatus::Set($arStatus, false, "N")) {
                if ($arStatus['DEFAULT_VALUE'] == 'N' && ($arTemplates = CFormStatus::SetMailTemplate($formID, $STATUS_ID))) {
                    foreach ($arTemplates as $TEMPLATE_ID) {
                        if (null == $em) {
                            $em = new CEventMessage();
                        }
                        $em->Update($TEMPLATE_ID, array('MESSAGE' => GetMessage('STATUS_MESSAGE')));
                    }
                    CFormStatus::Set(array('FORM_ID' => $formID, 'arMAIL_TEMPLATE' => $arTemplates), $STATUS_ID, 'N');
                }
            }
        }
    }
    return $formID;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:51,代码来源:functions.php

示例2: Set


//.........这里部分代码省略.........
         //"'".$DB->ForSql($arFields["STAT_EVENT2"],255)."'";
         if (is_set($arFields, "STAT_EVENT3")) {
             $arFields_i["STAT_EVENT3"] = $arFields['STAT_EVENT3'];
         }
         //"'".$DB->ForSql($arFields["STAT_EVENT3"],255)."'";
         if (CForm::IsOldVersion() != "Y") {
             unset($arFields_i["SHOW_TEMPLATE"]);
             unset($arFields_i["SHOW_RESULT_TEMPLATE"]);
             unset($arFields_i["PRINT_RESULT_TEMPLATE"]);
             unset($arFields_i["EDIT_RESULT_TEMPLATE"]);
         }
         $z = $DB->Query("SELECT IMAGE_ID, SID, SID as VARNAME FROM b_form WHERE ID='" . $FORM_ID . "'", false, $err_mess . __LINE__);
         $zr = $z->Fetch();
         $oldSID = $zr["SID"];
         if (strlen($arFields["arIMAGE"]["name"]) > 0 || strlen($arFields["arIMAGE"]["del"]) > 0) {
             if (intval($zr["IMAGE_ID"]) > 0) {
                 $arFields["arIMAGE"]["old_file"] = $zr["IMAGE_ID"];
             }
             if (!array_key_exists("MODULE_ID", $arFields["arIMAGE"]) || strlen($arFields["arIMAGE"]["MODULE_ID"]) <= 0) {
                 $arFields["arIMAGE"]["MODULE_ID"] = "form";
             }
             $fid = CFile::SaveFile($arFields["arIMAGE"], "form");
             if (intval($fid) > 0) {
                 $arFields_i["IMAGE_ID"] = intval($fid);
             } else {
                 $arFields_i["IMAGE_ID"] = "null";
             }
         }
         if ($arFields['SID']) {
             $arFields_i["MAIL_EVENT_TYPE"] = "FORM_FILLING_" . $arFields["SID"];
         } else {
             $arFields_i["MAIL_EVENT_TYPE"] = "FORM_FILLING_" . $oldSID;
         }
         if ($FORM_ID > 0) {
             $strUpdate = $DB->PrepareUpdate('b_form', $arFields_i);
             if ($strUpdate != '') {
                 $query = 'UPDATE b_form SET ' . $strUpdate . " WHERE ID='" . $FORM_ID . "'";
                 $arBinds = array('FORM_TEMPLATE' => $arFields_i['FORM_TEMPLATE']);
                 $DB->QueryBind($query, $arBinds);
             }
             //$DB->Update("b_form", $arFields_i, "WHERE ID='".$FORM_ID."'", $err_mess.__LINE__);
             CForm::SetMailTemplate($FORM_ID, "N", $oldSID);
         } else {
             //$FORM_ID = $DB->Insert("b_form", $arFields_i, $err_mess.__LINE__);
             $FORM_ID = $DB->Add("b_form", $arFields_i, array('FORM_TEMPLATE'));
             CForm::SetMailTemplate($FORM_ID, "N");
         }
         $FORM_ID = intval($FORM_ID);
         if ($FORM_ID > 0) {
             // сайты
             if (is_set($arFields, "arSITE")) {
                 $DB->Query("DELETE FROM b_form_2_site WHERE FORM_ID='" . $FORM_ID . "'", false, $err_mess . __LINE__);
                 if (is_array($arFields["arSITE"])) {
                     reset($arFields["arSITE"]);
                     foreach ($arFields["arSITE"] as $sid) {
                         $strSql = "\n\t\t\t\t\t\t\t\tINSERT INTO b_form_2_site (FORM_ID, SITE_ID) VALUES (\n\t\t\t\t\t\t\t\t\t{$FORM_ID},\n\t\t\t\t\t\t\t\t\t'" . $DB->ForSql($sid, 2) . "'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t";
                         $DB->Query($strSql, false, $err_mess . __LINE__);
                     }
                 }
             }
             // меню
             if (is_set($arFields, "arMENU")) {
                 $DB->Query("DELETE FROM b_form_menu WHERE FORM_ID='" . $FORM_ID . "'", false, $err_mess . __LINE__);
                 if (is_array($arFields["arMENU"])) {
                     reset($arFields["arMENU"]);
                     while (list($lid, $menu) = each($arFields["arMENU"])) {
                         $arFields_i = array("FORM_ID" => $FORM_ID, "LID" => "'" . $DB->ForSql($lid, 2) . "'", "MENU" => "'" . $DB->ForSql($menu, 50) . "'");
                         $DB->Insert("b_form_menu", $arFields_i, $err_mess . __LINE__);
                     }
                 }
             }
             // почтовые шаблоны
             if (is_set($arFields, "arMAIL_TEMPLATE")) {
                 $DB->Query("DELETE FROM b_form_2_mail_template WHERE FORM_ID='" . $FORM_ID . "'", false, $err_mess . __LINE__);
                 if (is_array($arFields["arMAIL_TEMPLATE"])) {
                     reset($arFields["arMAIL_TEMPLATE"]);
                     foreach ($arFields["arMAIL_TEMPLATE"] as $mid) {
                         $strSql = "\n\t\t\t\t\t\t\t\tINSERT INTO b_form_2_mail_template (FORM_ID, MAIL_TEMPLATE_ID) VALUES (\n\t\t\t\t\t\t\t\t\t{$FORM_ID},\n\t\t\t\t\t\t\t\t\t'" . intval($mid) . "'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t";
                         $DB->Query($strSql, false, $err_mess . __LINE__);
                     }
                 }
             }
             // группы
             if (is_set($arFields, "arGROUP")) {
                 $DB->Query("DELETE FROM b_form_2_group WHERE FORM_ID='" . $FORM_ID . "'", false, $err_mess . __LINE__);
                 if (is_array($arFields["arGROUP"])) {
                     reset($arFields["arGROUP"]);
                     while (list($group_id, $perm) = each($arFields["arGROUP"])) {
                         if (intval($perm) > 0) {
                             $arFields_i = array("FORM_ID" => $FORM_ID, "GROUP_ID" => "'" . intval($group_id) . "'", "PERMISSION" => "'" . intval($perm) . "'");
                             $DB->Insert("b_form_2_group", $arFields_i, $err_mess . __LINE__);
                         }
                     }
                 }
             }
         }
         return $FORM_ID;
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:form_callform.php

示例3: GetMessage

		$DB->StartTransaction();
		if(!$emessage->Delete($ID))
		{
			$DB->Rollback();
		}
		else
			$DB->Commit();
	}
	
	die();
}

$q = CForm::GetByID($WEB_FORM_ID);
$arrForm = $q->Fetch();
$arTemplates = CForm::SetMailTemplate($WEB_FORM_ID, "Y", '', true);

IncludeModuleLangFile(__FILE__);
$strNote .= GetMessage("FORM_GENERATING_FINISHED")."<br>";

$arReturn = array(
	'NOTE' => $strNote,
	'TEMPLATES' => $arTemplates
);

/***************************************************************************
							   HTML form
****************************************************************************/

//$APPLICATION->SetTitle(GetMessage("FORM_PAGE_TITLE"));
//require($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/main/include/prolog_popup_admin.php")
开发者ID:ASDAFF,项目名称:open_bx,代码行数:30,代码来源:form_mail.php

示例4: array

                             }
                         }
                     }
                     $arAnswerFields = array("FIELD_ID" => $QID, "MESSAGE" => $arAnswer["MESSAGE"], "C_SORT" => $arAnswer["C_SORT"], "ACTIVE" => $arAnswer["ACTIVE"], "VALUE" => $arAnswer["VALUE"], "FIELD_TYPE" => $arAnswer["FIELD_TYPE"], "FIELD_WIDTH" => $arAnswer["FIELD_WIDTH"], "FIELD_HEIGHT" => $arAnswer["FIELD_HEIGHT"], "FIELD_PARAM" => $arAnswer["FIELD_PARAM"]);
                     $ANS_ID = $arAnswer["ANS_NEW"] == "Y" ? false : $arAnswer["ID"];
                     CFormAnswer::Set($arAnswerFields, $ANS_ID);
                 }
             }
         }
     }
 }
 if ($bSimple) {
     // mail template
     $arr = CForm::GetTemplateList("MAIL", "xxx", $res);
     if ($_REQUEST['USE_MAIL_TEMPLATE'] && count($arr['reference_id']) == 0) {
         CForm::SetMailTemplate($res, "Y");
     } elseif (!$_REQUEST['USE_MAIL_TEMPLATE'] && count($arr['reference_id']) > 0) {
         reset($arr['reference_id']);
         while (list($num, $tmp_id) = each($arr['reference_id'])) {
             CEventMessage::Delete($tmp_id);
         }
     }
     $arr = CForm::GetTemplateList("MAIL", "xxx", $res);
     $arFields['SID'] = "SIMPLE_FORM_{$res}";
     $arFields['arMAIL_TEMPLATE'] = $arr['reference_id'];
     CForm::Set($arFields, $res);
     // create default status
     if ($ID == 0) {
         $arFields_status = array("FORM_ID" => $res, "C_SORT" => 100, "ACTIVE" => "Y", "TITLE" => "DEFAULT", "DESCRIPTION" => "DEFAULT", "CSS" => "statusgreen", "DEFAULT_VALUE" => "Y", "arPERMISSION_VIEW" => array(0), "arPERMISSION_MOVE" => array(0), "arPERMISSION_EDIT" => array(0), "arPERMISSION_DELETE" => array(0));
         CFormStatus::Set($arFields_status, 0);
     }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:form_edit.php

示例5: Set


//.........这里部分代码省略.........
         }
         if (is_set($arFields, "ADDITIONAL")) {
             $arFields_i["ADDITIONAL"] = $arFields["ADDITIONAL"] == "Y" ? "'Y'" : "'N'";
         }
         if (is_set($arFields, "REQUIRED")) {
             $arFields_i["REQUIRED"] = $arFields["REQUIRED"] == "Y" ? "'Y'" : "'N'";
         }
         if (is_set($arFields, "IN_RESULTS_TABLE")) {
             $arFields_i["IN_RESULTS_TABLE"] = $arFields["IN_RESULTS_TABLE"] == "Y" ? "'Y'" : "'N'";
         }
         if (is_set($arFields, "IN_EXCEL_TABLE")) {
             $arFields_i["IN_EXCEL_TABLE"] = $arFields["IN_EXCEL_TABLE"] == "Y" ? "'Y'" : "'N'";
         }
         if (is_set($arFields, "FIELD_TYPE")) {
             $arFields_i["FIELD_TYPE"] = "'" . $DB->ForSql($arFields["FIELD_TYPE"], 50) . "'";
         }
         if (is_set($arFields, "COMMENTS")) {
             $arFields_i["COMMENTS"] = "'" . $DB->ForSql($arFields["COMMENTS"], 2000) . "'";
         }
         if (is_set($arFields, "FILTER_TITLE")) {
             $arFields_i["FILTER_TITLE"] = "'" . $DB->ForSql($arFields["FILTER_TITLE"], 2000) . "'";
         }
         if (is_set($arFields, "RESULTS_TABLE_TITLE")) {
             $arFields_i["RESULTS_TABLE_TITLE"] = "'" . $DB->ForSql($arFields["RESULTS_TABLE_TITLE"], 2000) . "'";
         }
         // fcuk knows why he wrote it. maybe for some checking. but it's absolutely useless.
         //$z = $DB->Query("SELECT IMAGE_ID FROM b_form_field WHERE ID='$FIELD_ID'", false, $err_mess.__LINE__);
         //$zr = $z->Fetch();
         if (strlen($arFields["arIMAGE"]["name"]) > 0 || strlen($arFields["arIMAGE"]["del"]) > 0) {
             if (!array_key_exists("MODULE_ID", $arFields["arIMAGE"]) || strlen($arFields["arIMAGE"]["MODULE_ID"]) <= 0) {
                 $arFields["arIMAGE"]["MODULE_ID"] = "form";
             }
             $fid = CFile::SaveFile($arFields["arIMAGE"], "form");
             if (intval($fid) > 0) {
                 $arFields_i["IMAGE_ID"] = intval($fid);
             } else {
                 $arFields_i["IMAGE_ID"] = "null";
             }
         }
         $FIELD_ID = intval($FIELD_ID);
         if ($FIELD_ID > 0) {
             $DB->Update("b_form_field", $arFields_i, "WHERE ID='" . $FIELD_ID . "'", $err_mess . __LINE__);
         } else {
             $arFields_i["FORM_ID"] = "'" . intval($arFields["FORM_ID"]) . "'";
             $FIELD_ID = $DB->Insert("b_form_field", $arFields_i, $err_mess . __LINE__);
         }
         if ($FIELD_ID > 0) {
             // ответы на вопрос
             if ($arFields["ADDITIONAL"] != "Y" && is_set($arFields, "arANSWER")) {
                 $arANSWER = $arFields["arANSWER"];
                 if (is_array($arANSWER) && count($arANSWER) > 0) {
                     $arrAnswers = array();
                     $rs = CFormAnswer::GetList($FIELD_ID, $by = 'ID', $order = 'ASC', array(), $is_filtered);
                     while ($ar = $rs->Fetch()) {
                         $arrAnswers[] = $ar["ID"];
                     }
                     foreach ($arANSWER as $arA) {
                         $answer_id = in_array($arA["ID"], $arrAnswers) ? intval($arA["ID"]) : 0;
                         if ($arA["DELETE"] == "Y" && $answer_id > 0) {
                             CFormAnswer::Delete($answer_id, $FIELD_ID);
                         } else {
                             if ($answer_id > 0 || $answer_id <= 0 && strlen($arA["MESSAGE"]) > 0) {
                                 $arFields_a = array("FIELD_ID" => $FIELD_ID, "MESSAGE" => $arA["MESSAGE"], "VALUE" => $arA["VALUE"], "C_SORT" => $arA["C_SORT"], "ACTIVE" => $arA["ACTIVE"], "FIELD_TYPE" => $arA["FIELD_TYPE"], "FIELD_WIDTH" => $arA["FIELD_WIDTH"], "FIELD_HEIGHT" => $arA["FIELD_HEIGHT"], "FIELD_PARAM" => $arA["FIELD_PARAM"]);
                                 //echo "<pre>"; print_r($arFields_a); echo "</pre>";
                                 CFormAnswer::Set($arFields_a, $answer_id, $FIELD_ID);
                             }
                         }
                     }
                 }
             }
             // тип почтового события
             CForm::SetMailTemplate(intval($arFields["FORM_ID"]), "N");
             if ($UPDATE_FILTER == 'Y') {
                 // фильтр
                 $in_filter = "N";
                 $DB->Query("UPDATE b_form_field SET IN_FILTER='N' WHERE ID='" . $FIELD_ID . "'", false, $err_mess . __LINE__);
                 $arrFilterType = array("arFILTER_USER" => "USER", "arFILTER_ANSWER_TEXT" => "ANSWER_TEXT", "arFILTER_ANSWER_VALUE" => "ANSWER_VALUE", "arFILTER_FIELD" => "USER");
                 foreach ($arrFilterType as $key => $value) {
                     if (is_set($arFields, $key)) {
                         $strSql = "DELETE FROM b_form_field_filter WHERE FIELD_ID='" . $FIELD_ID . "' and PARAMETER_NAME='" . $value . "'";
                         $DB->Query($strSql, false, $err_mess . __LINE__);
                         if (is_array($arFields[$key])) {
                             reset($arFields[$key]);
                             foreach ($arFields[$key] as $type) {
                                 $arFields_i = array("FIELD_ID" => "'" . intval($FIELD_ID) . "'", "FILTER_TYPE" => "'" . $DB->ForSql($type, 50) . "'", "PARAMETER_NAME" => "'" . $value . "'");
                                 $DB->Insert("b_form_field_filter", $arFields_i, $err_mess . __LINE__);
                                 $in_filter = "Y";
                             }
                         }
                     }
                 }
                 if ($in_filter == "Y") {
                     $DB->Query("UPDATE b_form_field SET IN_FILTER='Y' WHERE ID='" . $FIELD_ID . "'", false, $err_mess . __LINE__);
                 }
             }
         }
         return $FIELD_ID;
     }
     return false;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:form_callformfield.php


注:本文中的CForm::SetMailTemplate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。