本文整理汇总了PHP中CForm::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::GetByID方法的具体用法?PHP CForm::GetByID怎么用?PHP CForm::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::GetByID方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendOnAfterResultStatusChange
function sendOnAfterResultStatusChange($WEB_FORM_ID, $RESULT_ID, $NEW_STATUS_ID = false, $CHECK_RIGHTS = 'Y')
{
$NEW_STATUS_ID = intval($NEW_STATUS_ID);
$dbRes = CForm::GetByID($WEB_FORM_ID);
if (!($arForm = $dbRes->Fetch())) {
return;
}
CTimeZone::Disable();
$dbRes = CFormResult::GetByID($RESULT_ID);
CTimeZone::Enable();
if (!($arResult = $dbRes->Fetch()) || !$arResult['USER_ID']) {
return;
}
$dbRes = CUser::GetByID($arResult['USER_ID']);
if (!($arUser = $dbRes->Fetch())) {
return;
}
if (!$NEW_STATUS_ID) {
$NEW_STATUS_ID = CFormStatus::GetDefault($WEB_FORM_ID);
}
$dbRes = CFormStatus::GetByID($NEW_STATUS_ID);
if (!($arStatus = $dbRes->Fetch()) || strlen($arStatus['MAIL_EVENT_TYPE']) <= 0) {
return;
}
$arTemplates = CFormStatus::GetMailTemplateArray($NEW_STATUS_ID);
if (!is_array($arTemplates) || count($arTemplates) <= 0) {
return;
}
$arEventFields = array("EMAIL_TO" => $arUser['EMAIL'], "RS_FORM_ID" => $arForm["ID"], "RS_FORM_NAME" => $arForm["NAME"], "RS_FORM_VARNAME" => $arForm["SID"], "RS_FORM_SID" => $arForm["SID"], "RS_RESULT_ID" => $arResult["ID"], "RS_DATE_CREATE" => $arResult["DATE_CREATE"], "RS_USER_ID" => $arResult['USER_ID'], "RS_USER_EMAIL" => $arUser['EMAIL'], "RS_USER_NAME" => $arUser["NAME"] . " " . $arUser["LAST_NAME"], "RS_STATUS_ID" => $arStatus["ID"], "RS_STATUS_NAME" => $arStatus["TITLE"]);
$dbRes = CEventMessage::GetList($by = "id", $order = "asc", array('ID' => implode('|', $arTemplates), "ACTIVE" => "Y", "EVENT_NAME" => $arStatus["MAIL_EVENT_TYPE"]));
while ($arTemplate = $dbRes->Fetch()) {
CEvent::Send($arTemplate["EVENT_NAME"], $arTemplate["SITE_ID"], $arEventFields, "Y", $arTemplate["ID"]);
}
}
示例2: GetByID_admin
function GetByID_admin($WEB_FORM_ID, $current_section = false)
{
$WEB_FORM_ID = intval($WEB_FORM_ID);
if ($WEB_FORM_ID <= 0) {
return false;
}
$dbForm = CForm::GetByID($WEB_FORM_ID);
if ($arForm = $dbForm->Fetch()) {
if (!$current_section) {
$current_script = basename($GLOBALS['APPLICATION']->GetCurPage());
switch ($current_script) {
case 'form_edit.php':
$current_section = 'form';
break;
case 'form_field_edit.php':
case 'form_field_edit_simple.php':
case 'form_field_list.php':
if (!$bSimple && $_GET['additional'] == 'Y') {
$current_section = 'field';
} else {
$current_section = 'question';
}
break;
case 'form_result_edit.php':
case 'form_result_list.php':
case 'form_result_view.php':
case 'form_view.php':
$current_section = 'result';
break;
case 'form_status_edit.php':
case 'form_status_list.php':
$current_section = 'status';
break;
}
}
$bSimple = COption::GetOptionString("form", "SIMPLE", "Y") == "Y";
$arForm['ADMIN_MENU'] = array();
$arForm['ADMIN_MENU'][] = array("ICON" => $current_section == 'form' ? 'btn_active' : '', "TEXT" => GetMessage("FORM_MENU_EDIT"), "LINK" => "/bitrix/admin/form_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $WEB_FORM_ID, "TITLE" => htmlspecialcharsbx(str_replace("#NAME#", $arForm["NAME"], GetMessage("FORM_MENU_EDIT_TITLE"))));
$arForm['ADMIN_MENU'][] = array("ICON" => $current_section == 'result' ? 'btn_active' : '', "TEXT" => GetMessage("FORM_MENU_RESULTS") . " (" . CFormResult::GetCount($WEB_FORM_ID) . ")", "LINK" => "/bitrix/admin/form_result_list.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID=" . $WEB_FORM_ID, "TITLE" => htmlspecialcharsbx(str_replace("#NAME#", $arForm["NAME"], GetMessage("FORM_MENU_RESULTS_TITLE"))));
$arForm['ADMIN_MENU'][] = array("ICON" => $current_section == 'question' ? 'btn_active' : '', "TEXT" => GetMessage("FORM_MENU_QUESTIONS") . " (" . ($bSimple ? $arForm["QUESTIONS"] + $arForm["C_FIELDS"] : $arForm["QUESTIONS"]) . ")", "LINK" => "/bitrix/admin/form_field_list.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID=" . $WEB_FORM_ID, "TITLE" => htmlspecialcharsbx(str_replace("#NAME#", $arForm["NAME"], GetMessage("FORM_MENU_QUESTIONS_TITLE"))));
if (!$bSimple) {
$arForm['ADMIN_MENU'][] = array("ICON" => $current_section == 'field' ? 'btn_active' : '', "TEXT" => GetMessage("FORM_MENU_FIELDS") . " (" . $arForm["C_FIELDS"] . ")", "LINK" => "/bitrix/admin/form_field_list.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID=" . $WEB_FORM_ID . "&additional=Y", "TITLE" => htmlspecialcharsbx(str_replace("#NAME#", $arForm["NAME"], GetMessage("FORM_MENU_FIELDS_TITLE"))));
$arForm['ADMIN_MENU'][] = array("ICON" => $current_section == 'status' ? 'btn_active' : '', "TEXT" => GetMessage("FORM_MENU_STATUSES") . " (" . $arForm["STATUSES"] . ")", "LINK" => "/bitrix/admin/form_status_list.php?lang=" . LANGUAGE_ID . "&WEB_FORM_ID=" . $WEB_FORM_ID, "TITLE" => htmlspecialcharsbx(str_replace("#NAME#", $arForm["NAME"], GetMessage("FORM_MENU_STATUSES_TITLE"))));
}
return $arForm;
}
return false;
}
示例3: Copyright
# Bitrix: SiteManager #
# Copyright (c) 2004 Bitrix #
# http://www.bitrix.ru #
# mailto:admin@bitrix.ru #
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/prolog.php";
CModule::IncludeModule("form");
ClearVars();
$FORM_RIGHT = $APPLICATION->GetGroupRight("form");
if ($FORM_RIGHT <= "D") {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
//require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/form/include.php");
$WEB_FORM_ID = intval($WEB_FORM_ID);
$z = CForm::GetByID($WEB_FORM_ID);
if ($form = $z->Fetch()) {
$SHOW_ADDITIONAL = "Y";
$SHOW_ANSWER_VALUE = "Y";
$SHOW_STATUS = "Y";
$WEB_FORM_NAME = $form["SID"];
IncludeModuleLangFile(__FILE__);
$s = dirname($APPLICATION->GetCurPage()) . "/" . basename($APPLICATION->GetCurPage(), "_xls.php") . ".php";
InitSorting($s);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/admin/body/form_result_list_handler.php";
header("Content-Type: application/vnd.ms-excel");
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_excel_after.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/admin/body/form_result_list_table_excel.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_excel.php";
}
示例4: SetMailTemplate
public static function SetMailTemplate($WEB_FORM_ID, $STATUS_ID, $ADD_NEW_TEMPLATE="Y", $old_SID="", $bReturnFullInfo = false)
{
global $DB, $MESS, $strError;
$err_mess = (CAllForm::err_mess())."<br>Function: SetMailTemplate<br>Line: ";
$arrReturn = array();
$WEB_FORM_ID = intval($WEB_FORM_ID);
$q = CForm::GetByID($WEB_FORM_ID);
if ($arrForm = $q->Fetch())
{
$dbRes = CFormStatus::GetByID($STATUS_ID);
if ($arrStatus = $dbRes->Fetch())
{
$MAIL_EVENT_TYPE = "FORM_STATUS_CHANGE_".$arrForm["SID"]."_".$arrStatus['ID'];
if (strlen($old_SID)>0)
$old_MAIL_EVENT_TYPE = "FORM_STATUS_CHANGE_".$old_SID."_".$arrStatus['ID'];
$et = new CEventType;
$em = new CEventMessage;
if (strlen($MAIL_EVENT_TYPE)>0)
$et->Delete($MAIL_EVENT_TYPE);
$z = CLanguage::GetList($v1, $v2);
$OLD_MESS = $MESS;
$MESS = array();
while ($arLang = $z->Fetch())
{
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/form/admin/form_status_mail.php", $arLang["LID"]);
$str = "";
$str .= "#EMAIL_TO# - ".GetMessage("FORM_L_EMAIL_TO")."\n";
$str .= "#RS_FORM_ID# - ".GetMessage("FORM_L_FORM_ID")."\n";
$str .= "#RS_FORM_NAME# - ".GetMessage("FORM_L_NAME")."\n";
$str .= "#RS_FORM_SID# - ".GetMessage("FORM_L_SID")."\n";
$str .= "#RS_RESULT_ID# - ".GetMessage("FORM_L_RESULT_ID")."\n";
$str .= "#RS_DATE_CREATE# - ".GetMessage("FORM_L_DATE_CREATE")."\n";
$str .= "#RS_USER_ID# - ".GetMessage("FORM_L_USER_ID")."\n";
$str .= "#RS_USER_EMAIL# - ".GetMessage("FORM_L_USER_EMAIL")."\n";
$str .= "#RS_USER_NAME# - ".GetMessage("FORM_L_USER_NAME")."\n";
$str .= "#RS_STATUS_ID# - ".GetMessage("FORM_L_STATUS_ID")."\n";
$str .= "#RS_STATUS_NAME# - ".GetMessage("FORM_L_STATUS_NAME")."\n";
$et->Add(
Array(
"LID" => $arLang["LID"],
"EVENT_NAME" => $MAIL_EVENT_TYPE,
"NAME" => str_replace(array('#FORM_SID#', '#STATUS_NAME#'), array($arrForm['SID'], $arrStatus['TITLE']), GetMessage("FORM_CHANGE_STATUS")),
"DESCRIPTION" => $str
)
);
}
// create new event type for old templates
if (strlen($old_MAIL_EVENT_TYPE)>0 && $old_MAIL_EVENT_TYPE!=$MAIL_EVENT_TYPE)
{
$e = $em->GetList($by="id",$order="desc",array("EVENT_NAME"=>$old_MAIL_EVENT_TYPE));
while ($er=$e->Fetch())
{
$em->Update($er["ID"],array("EVENT_NAME"=>$MAIL_EVENT_TYPE));
}
if (strlen($old_MAIL_EVENT_TYPE)>0)
$et->Delete($old_MAIL_EVENT_TYPE);
}
if ($ADD_NEW_TEMPLATE=="Y")
{
$z = CSite::GetList($v1, $v2);
while ($arSite = $z->Fetch()) $arrSiteLang[$arSite["ID"]] = $arSite["LANGUAGE_ID"];
$arrFormSite = CForm::GetSiteArray($WEB_FORM_ID);
if (is_array($arrFormSite) && count($arrFormSite)>0)
{
foreach($arrFormSite as $sid)
{
IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/form/admin/form_status_mail.php", $arrSiteLang[$sid]);
$SUBJECT = GetMessage("FORM_CHANGE_STATUS_S");
$MESSAGE = GetMessage("FORM_CHANGE_STATUS_B");
// добавляем новый шаблон
$arFields = Array(
"ACTIVE" => "Y",
"EVENT_NAME" => $MAIL_EVENT_TYPE,
"LID" => $sid,
"EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#",
"EMAIL_TO" => "#EMAIL_TO#",
"SUBJECT" => $SUBJECT,
"MESSAGE" => $MESSAGE,
"BODY_TYPE" => "text"
);
//echo '<pre>'; print_r($arFields); echo '</pre>';
$TEMPLATE_ID = $em->Add($arFields);
if ($bReturnFullInfo)
$arrReturn[] = array(
'ID' => $TEMPLATE_ID,
'FIELDS' => $arFields,
);
else
$arrReturn[] = $TEMPLATE_ID;
}
//.........这里部分代码省略.........
示例5: PrepareFilter
public static function PrepareFilter($WEB_FORM_ID, $arFilter)
{
$err_mess = (CAllFormResult::err_mess())."<br>Function: PrepareFilter<br>Line: ";
global $DB, $strError;
$arrFilterReturn = $arFilter;
if (array_key_exists("FIELDS", $arFilter))
{
$arFilterFields = $arFilter["FIELDS"];
$rsForm = CForm::GetByID($WEB_FORM_ID);
$arForm = $rsForm->Fetch();
$WEB_FORM_NAME = $arForm["SID"];
if (is_array($arFilterFields) && count($arFilterFields) > 0)
{
foreach ($arFilterFields as $arr)
{
if (strlen($arr["SID"]) > 0)
$arr["CODE"] = $arr["SID"];
else
$arr["SID"] = $arr["CODE"];
$FIELD_SID = $arr["SID"];
$FILTER_TYPE = (strlen($arr["FILTER_TYPE"]) > 0) ? $arr["FILTER_TYPE"] : "text";
if (strtoupper($FILTER_TYPE) == "ANSWER_ID") $FILTER_TYPE = "dropdown";
$PARAMETER_NAME = (strlen($arr["PARAMETER_NAME"]) > 0) ? $arr["PARAMETER_NAME"] : "USER";
$PART = $arr["PART"];
$FILTER_KEY = $arForm["SID"]."_".$FIELD_SID."_".$PARAMETER_NAME."_".$FILTER_TYPE;
if (strlen($PART) > 0) $FILTER_KEY .= "_".intval($PART);
$arrFilterReturn[$FILTER_KEY] = $arr["VALUE"];
if ($FILTER_TYPE=="text")
{
$EXACT_MATCH = ($arr["EXACT_MATCH"]=="Y") ? "Y" : "N";
$arrFilterReturn[$FILTER_KEY."_exact_match"] = $EXACT_MATCH;
}
}
}
unset($arrFilterReturn["FIELDS"]);
}
return $arrFilterReturn;
}
示例6: GetList
function GetList($WEB_FORM_ID, &$by, &$order, $arFilter=Array(), &$is_filtered, $CHECK_RIGHTS="Y", $records_limit=false)
{
$err_mess = (CFormResult::err_mess())."<br>Function: GetList<br>Line: ";
global $DB, $USER, $strError;
$CHECK_RIGHTS = ($CHECK_RIGHTS=="Y") ? "Y" : "N";
$WEB_FORM_ID = intval($WEB_FORM_ID);
$F_RIGHT = CForm::GetPermission($WEB_FORM_ID);
$USER_ID = intval($USER->GetID());
$arSqlSearch = array();
$arr["FIELDS"] = array();
$strSqlSearch = "";
if (is_array($arFilter))
{
$arFilter = CFormResult::PrepareFilter($WEB_FORM_ID, $arFilter);
$z = CForm::GetByID($WEB_FORM_ID);
$form = $z->Fetch();
/***********************/
$z = CFormField::GetList($WEB_FORM_ID, "", $v1, $v2, array(), $v3);
while ($zr=$z->Fetch())
{
$arPARAMETER_NAME = array("ANSWER_TEXT", "ANSWER_VALUE", "USER");
CFormField::GetFilterTypeList($arrUSER, $arrANSWER_TEXT, $arrANSWER_VALUE, $arrFIELD);
foreach ($arPARAMETER_NAME as $PARAMETER_NAME)
{
switch ($PARAMETER_NAME)
{
case "ANSWER_TEXT":
$arFILTER_TYPE = $arrANSWER_TEXT["reference_id"];
break;
case "ANSWER_VALUE":
$arFILTER_TYPE = $arrANSWER_VALUE["reference_id"];
break;
case "USER":
$arFILTER_TYPE = $arrUSER["reference_id"];
break;
}
foreach ($arFILTER_TYPE as $FILTER_TYPE)
{
$arrUF = array();
$arrUF["ID"] = $zr["ID"];
$arrUF["PARAMETER_NAME"] = $PARAMETER_NAME;
$arrUF["FILTER_TYPE"] = $FILTER_TYPE;
$FID = $form["SID"]."_".$zr["SID"]."_".$PARAMETER_NAME."_".$FILTER_TYPE;
if ($FILTER_TYPE=="date" || $FILTER_TYPE=="integer")
{
$arrUF["SIDE"] = "1";
$arrFORM_FILTER[$FID."_1"] = $arrUF;
$arrUF["SIDE"] = "2";
$arrFORM_FILTER[$FID."_2"] = $arrUF;
$arrUF["SIDE"] = "0";
$arrFORM_FILTER[$FID."_0"] = $arrUF;
}
else $arrFORM_FILTER[$FID] = $arrUF;
}
}
}
if (is_array($arrFORM_FILTER)) $arrFORM_FILTER_KEYS = array_keys($arrFORM_FILTER);
//echo "arFilter:<pre>"; print_r($arFilter); echo "</pre>";
//echo "arrFORM_FILTER:<pre>"; print_r($arrFORM_FILTER); echo "</pre>";
//echo "arrFORM_FILTER_KEYS:<pre>"; print_r($arrFORM_FILTER_KEYS); echo "</pre>";
$t = 0;
$filter_keys = array_keys($arFilter);
for ($i=0; $i<count($filter_keys); $i++)
{
$key = $filter_keys[$i];
$val = $arFilter[$filter_keys[$i]];
if(is_array($val))
{
if(count($val) <= 0)
continue;
}
else
{
if( (strlen($val) <= 0) || ($val === "NOT_REF") )
continue;
}
$match_value_set = (in_array($key."_EXACT_MATCH", $filter_keys)) ? true : false;
$key = strtoupper($key);
switch($key)
{
case "ID":
$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("R.ID", $val, $match);
break;
case "STATUS":
$arSqlSearch[] = "R.STATUS_ID='".intval($val)."'";
break;
case "STATUS_ID":
$match = ($arFilter[$key."_EXACT_MATCH"]=="N" && $match_value_set) ? "Y" : "N";
$arSqlSearch[] = GetFilterQuery("R.STATUS_ID", $val, $match);
break;
//.........这里部分代码省略.........
示例7: TrimArr
TrimArr($arParams['FORMS']);
}
$arResult['FORMS'] = array();
$arResult['RESULTS'] = array();
if (count($arParams['FORMS']) <= 0) {
$dbRes = CForm::GetList($by = 'sort', $order = 'asc', array('SITE' => SITE_ID), $is_filtered);
while ($arRes = $dbRes->GetNext()) {
$arParams['FORMS'][] = $arRes['ID'];
$arResult['FORMS'][$arRes['ID']] = $arRes;
}
}
foreach ($arParams['FORMS'] as $FORM_ID) {
if (is_array($arResult['FORMS'][$FORM_ID])) {
$arForm = $arResult['FORMS'][$FORM_ID];
} else {
$dbRes = CForm::GetByID($FORM_ID);
$arForm = $dbRes->GetNext();
}
if ($arForm) {
if ($arParams['LIST_URL']) {
$arForm['__LINK'] = str_replace('#FORM_ID#', $FORM_ID, $arParams['LIST_URL']);
}
$arResult['FORMS'][$FORM_ID] = $arForm;
$arResult['RESULTS'][$FORM_ID] = array();
$dbRes = CFormResult::GetList($FORM_ID, $by = 's_timestamp', $order = 'desc', array('USER_ID' => $USER->GetID()), $is_filtered, 'Y', $arParams['NUM_RESULTS']);
$bFirst = true;
while ($arRes = $dbRes->GetNext()) {
//if ($FORM_ID == 6) print_r($arRes);
if ($bFirst) {
$arResult['FORMS'][$FORM_ID]['__LAST_TS'] = MakeTimeStamp($arRes['TIMESTAMP_X']);
$bFirst = false;
示例8: LocalRedirect
if ($del_id > 0) {
CFormResult::Delete($del_id);
}
// 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"]) . "'";