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


PHP CForm::GetBySID方法代码示例

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


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

示例1: __form_CreateForm

function __form_CreateForm($SID, $__current_dir)
{
    // check collisions
    $dbTmpForm = CForm::GetBySID($SID);
    if ($arTmpForm = $dbTmpForm->Fetch()) {
        return false;
    }
    //$dirName = ToLower($SID);
    $formConfigFile = $__current_dir . '/form.php';
    $fieldsConfigFile = $__current_dir . '/fields.php';
    // check config existence
    if (!file_exists($formConfigFile) || !file_exists($fieldsConfigFile)) {
        return false;
    }
    // load form config
    $arForm = array();
    require $formConfigFile;
    // setup form
    if ($FORM_ID = CForm::Set($arForm, false, 'N')) {
        // load fields config
        $arFormFields = array();
        require $fieldsConfigFile;
        // setup form fields
        foreach ($arFormFields as $key => $arField) {
            CFormField::Set($arField, false, 'N');
        }
        $arStatus = array('FORM_ID' => $FORM_ID, 'TITLE' => 'DEFAULT', 'CSORT' => 100, 'ACTIVE' => 'Y', 'DEFAULT_VALUE' => 'Y', 'arPERMISSION_MOVE' => array(0));
        CFormStatus::Set($arStatus, false, 'N');
    }
    return $FORM_ID;
}
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:lib.php

示例2: Show

	function Show($WEB_FORM_VARNAME, $arrVALUES=false, $SHOW_TEMPLATE=false, $PREVIEW="N")
	{
		global $DB, $MESS, $APPLICATION, $USER, $_REQUEST, $HTTP_POST_VARS, $HTTP_GET_VARS, $arrFIELDS;
		$err_mess = (CAllForm::err_mess())."<br>Function: Show<br>Line: ";
		if ($arrVALUES===false) $arrVALUES = $_REQUEST;

		$z = CForm::GetBySID($WEB_FORM_VARNAME);
		$zr = $z->Fetch();
		$WEB_FORM_ID = $FORM_ID = intval($zr["ID"]);
		$WEB_FORM_ID = CForm::GetDataByID($WEB_FORM_ID, $arForm, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect);
		if (intval($WEB_FORM_ID)>0)
		{
			$F_RIGHT = CForm::GetPermission($WEB_FORM_ID);
			if (intval($F_RIGHT)>=10)
			{
				if (strlen(trim($SHOW_TEMPLATE))>0) $template = $SHOW_TEMPLATE;
				else
				{
					if (strlen(trim($arForm["SHOW_TEMPLATE"]))<=0) $template = "default.php";
					else $template = $arForm["SHOW_TEMPLATE"];
				}
				$path = COption::GetOptionString("form","SHOW_TEMPLATE_PATH");
				IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/freetrix/modules/form/include.php");
				include(GetLangFileName($_SERVER["DOCUMENT_ROOT"].$path."lang/", "/".$template));
				if ($APPLICATION->GetShowIncludeAreas())
				{
					$arIcons = Array();
					if (CModule::IncludeModule("fileman"))
					{
						$arIcons[] =
								Array(
									"URL" => "/freetrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($path.$template),
									"SRC" => "/freetrix/images/form/panel/edit_template.gif",
									"ALT" => GetMessage("FORM_PUBLIC_ICON_TEMPLATE")
								);
						$arrUrl = parse_url($_SERVER["REQUEST_URI"]);
						$arIcons[] =
								Array(
									"URL" => "/freetrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($arrUrl["path"]),
									"SRC" => "/freetrix/images/form/panel/edit_file.gif",
									"ALT" => GetMessage("FORM_PUBLIC_ICON_HANDLER")
								);
					}
					$arIcons[] =
							Array(
								"URL" => "/freetrix/admin/form_edit.php?lang=".LANGUAGE_ID."&ID=".$WEB_FORM_ID,
								"SRC" => "/freetrix/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();
				}
			}
		}
	}
开发者ID:ASDAFF,项目名称:open_bx,代码行数:59,代码来源:form_cform_old.php

示例3: 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

示例4: defined

/*************************************************************************************************/
		$bVarsFromCache = false;

		$arResult["bSimple"] = COption::GetOptionString("form", "SIMPLE", "Y") == "N" ? "N" : "Y";
		$arResult["bAdmin"] = defined("ADMIN_SECTION") && ADMIN_SECTION===true ? "Y" : "N";

		// if form taken from admin interface - check rights to form module
		if ($arResult["bAdmin"] == "Y")
		{
			$FORM_RIGHT = $APPLICATION->GetGroupRight("form");
			if($FORM_RIGHT<="D") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
		}

		if (intval($arParams['WEB_FORM_ID']) <= 0 && strlen($arParams['WEB_FORM_ID']) > 0)
		{
			$obForm = CForm::GetBySID($arParams['WEB_FORM_ID']);
			if ($arForm = $obForm->Fetch())
			{
				$arParams['WEB_FORM_ID'] = $arForm['ID'];
			}
		}

		// check WEB_FORM_ID and get web form data
		$arParams["WEB_FORM_ID"] = CForm::GetDataByID($arParams["WEB_FORM_ID"], $arResult["arForm"], $arResult["arQuestions"], $arResult["arAnswers"], $arResult["arDropDown"], $arResult["arMultiSelect"], $arResult["bAdmin"] == "Y" || $arParams["SHOW_ADDITIONAL"] == "Y" || $arParams["EDIT_ADDITIONAL"] == "Y" ? "ALL" : "N");

		$arResult["WEB_FORM_NAME"] = $arResult["arForm"]["SID"];

		// if wrong WEB_FORM_ID return error;
		if ($arParams["WEB_FORM_ID"] > 0)
		{
			// check web form rights;
开发者ID:CheBurashka334,项目名称:zakrepi,代码行数:31,代码来源:component.php

示例5: LocalRedirect

             }
             // rights check inside
         }
         if (strlen($GLOBALS['strError']) <= 0) {
             LocalRedirect($APPLICATION->GetCurPageParam("", array("delete", "sessid", 'formresult')));
             exit;
         }
     }
 }
 if (strlen($GLOBALS['strError']) > 0) {
     $arResult["FORM_ERROR"] .= $GLOBALS['strError'];
 }
 if (intval($arParams["WEB_FORM_ID"]) > 0) {
     $dbres = CForm::GetByID($arParams["WEB_FORM_ID"]);
 } else {
     $dbres = CForm::GetBySID($arParams["WEB_FORM_NAME"]);
 }
 // get form info
 if ($arParams["arFormInfo"] = $dbres->Fetch()) {
     $GLOBALS["WEB_FORM_ID"] = $arParams["WEB_FORM_ID"] = $arParams["arFormInfo"]["ID"];
     $GLOBALS["WEB_FORM_NAME"] = $arParams["WEB_FORM_NAME"] = $arParams["arFormInfo"]["SID"];
     // check form params
     $arParams["USER_ID"] = $USER->GetID();
     // prepare filter
     $FilterArr = array("find_id", "find_id_exact_match", "find_status", "find_status_id", "find_status_id_exact_match", "find_timestamp_1", "find_timestamp_2", "find_date_create_2", "find_date_create_1", "find_date_create_2", "find_registered", "find_user_auth", "find_user_id", "find_user_id_exact_match", "find_guest_id", "find_guest_id_exact_match", "find_session_id", "find_session_id_exact_match");
     $arResult["arrFORM_FILTER"] = array();
     $arListFilter = array("ACTIVE" => "Y");
     if (count($arParams["arrNOT_SHOW_FILTER"]) > 0) {
         $arListFilter["FIELD_SID"] = "~'" . implode("' & ~'", $arParams["arrNOT_SHOW_FILTER"]) . "'";
     }
     $z = CFormField::GetFilterList($arParams["WEB_FORM_ID"], $arListFilter);
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php

示例6: getFormId

 /**
  * Возвращает ID формы по символьному коду
  * @param $code
  * @return int|false
  */
 protected function getFormId($code)
 {
     if ($form = \CForm::GetBySID($code)->Fetch()) {
         return $form['ID'];
     } else {
         return false;
     }
 }
开发者ID:notagency,项目名称:notagency.base,代码行数:13,代码来源:class.php


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