/*
##############################################
# Bitrix: SiteManager #
# Copyright (c) 2004 Bitrix #
# http://www.bitrix.ru #
# mailto:admin@bitrix.ru #
##############################################
*/
ob_start();
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php");
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/form/prolog.php");
define("HELP_FILE","form_result_list.php");
$FORM_RIGHT = $APPLICATION->GetGroupRight("form");
if($FORM_RIGHT<="D") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
CModule::IncludeModule("form");
ClearVars();
$strError = '';
$strNote = '';
$aMenu = array();
IncludeModuleLangFile(__FILE__);
$err_mess = "File: ".__FILE__."
Line: ";
$old_module_version = CForm::IsOldVersion();
$bSimple = (COption::GetOptionString("form", "SIMPLE", "Y") == "Y") ? true : false;
/***************************************************************************
GET | POST processing
****************************************************************************/
// Wow.... It was funny....
// if (intval($WEB_FORM_ID)>0 && intval($WEB_FORM_ID)<=0) $WEB_FORM_ID = intval($WEB_FORM_ID);
$WEB_FORM_ID = intval($WEB_FORM_ID);
$RESULT_ID = intval($RESULT_ID);
if ($RESULT_ID > 0)
{
$q = CFormResult::GetByID($RESULT_ID);
if (!($arrResult=$q->Fetch()))
{
// result not found
$title = str_replace("#FORM_ID#","$WEB_FORM_ID",GetMessage("FORM_RESULT_LIST"));
require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
echo "
".$title."
";
ShowError(GetMessage("FORM_RESULT_NOT_FOUND"));
require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
die();
}
$WEB_FORM_ID = intval($arrResult["FORM_ID"]);
}
else
{
$arrResult = array();
}
if($WEB_FORM_ID <= 0)
{
require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
ShowError(GetMessage("FORM_NOT_FOUND"));
require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
die();
}
$F_RIGHT = intval(CForm::GetPermission($WEB_FORM_ID)); // form rights
if ($RESULT_ID > 0)
$arrRESULT_PERMISSION = CFormResult::GetPermissions($RESULT_ID); // result rights array
else
{
$arrRESULT_PERMISSION = array();
if ($F_RIGHT >= 20)
$arrRESULT_PERMISSION[] = 'EDIT';
}
$EDIT_ADDITIONAL = "Y"; // whether to edit additional fields
$EDIT_STATUS = "Y"; // whether to edit status
if ($bSimple)
{
$EDIT_ADDITIONAL = "N"; // whether to edit additional fields
$EDIT_STATUS = "N"; // whether to edit status
}
// get access rights
$can_edit = false;
$can_view = false;
$can_delete = false;
$can_add = false;
if ($F_RIGHT>=20 || ($RESULT_ID > 0 && $F_RIGHT>=15 && $USER->GetID()==$arrResult["USER_ID"]))
{
if (in_array("DELETE",$arrRESULT_PERMISSION)) $can_delete = true;
if (in_array("EDIT",$arrRESULT_PERMISSION)) $can_edit = true;
if (in_array("VIEW",$arrRESULT_PERMISSION)) $can_view = true;
}
if ($old_module_version!="Y" && $F_RIGHT>=10)
{
$can_add = true;
}
// ============================ oldies and not goldies ========================
if ($old_module_version=="Y")
{
// save chosen template
if ($F_RIGHT>=30 && $_SERVER['REQUEST_METHOD']=="GET" && $_REQUEST['save'] <> '' && check_bitrix_sessid())
{
$DB->PrepareFields("b_form");
$arFields = array(
"TIMESTAMP_X" => $DB->GetNowFunction(),
"EDIT_RESULT_TEMPLATE" => "'".$DB->ForSql($str_EDIT_RESULT_TEMPLATE)."'"
);
$DB->Update("b_form",$arFields,"WHERE ID='".$WEB_FORM_ID."'",$err_mess.__LINE__);
}
if ($can_edit)
{
if ($_SERVER['REQUEST_METHOD']=="POST" && intval($WEB_FORM_ID)>0 && ($_REQUEST['web_form_submit'] <> '' || $_REQUEST['web_form_apply'] <> '') || $_REQUEST['apply'] <> '')
{
$arrVALUES = $_REQUEST;
$error = CForm::Check($WEB_FORM_ID, $arrVALUES, $RESULT_ID);
if ($error == '')
{
CFormResult::Update($RESULT_ID, $arrVALUES, $EDIT_ADDITIONAL);
if ($_REQUEST['web_form_submit'] <> '') LocalRedirect("form_result_list.php?lang=".LANGUAGE_ID."&WEB_FORM_ID=".$WEB_FORM_ID);
}
else $strError .= $error;
}
else $arrVALUES = CFormResult::GetDataByIDForHTML($RESULT_ID, $EDIT_ADDITIONAL);
}
}
// ============================ oldies finish ========================
$WEB_FORM_ID = intval($WEB_FORM_ID);
$arForm = CForm::GetByID_admin($WEB_FORM_ID);
// result changes saving
if ($old_module_version != 'Y' && $_SERVER['REQUEST_METHOD'] == "POST" && intval($WEB_FORM_ID)>0 && ($_REQUEST['save'] <> '' || $_REQUEST['apply'] <> '') && check_bitrix_sessid())
{
$arrVALUES = $_REQUEST;
$error = CForm::Check($WEB_FORM_ID, $arrVALUES, $RESULT_ID);
if ($error == '')
{
$bUpdate = true;
if (!$RESULT_ID)
{
$default_status = CFormStatus::GetDefault($WEB_FORM_ID);
$status_tmp = $arrVALUES['status_'.$arForm['SID']];
$arrVALUES['status_'.$arForm['SID']] = $default_status;
$RESULT_ID = CFormResult::Add($WEB_FORM_ID, $arrVALUES, 'Y', intval($arrVALUES['USER_ID']) > 0 ? intval($arrVALUES['USER_ID']) : false);
$arrVALUES['status_'.$arForm['SID']] = $status_tmp == $default_status ? 'NOT_REF' : $status_tmp;
$bUpdate = $RESULT_ID > 0 && $EDIT_ADDITIONAL == 'Y';
// little hack to prevent doubling of status notification message
}
// second update needed to set additional fields
if ($bUpdate && $strError == '')
CFormResult::Update($RESULT_ID, $arrVALUES, $EDIT_ADDITIONAL);
if ($strError == '')
{
if ($_REQUEST['apply'] <> '') LocalRedirect("/bitrix/admin/form_result_edit.php?lang=".LANGUAGE_ID."&WEB_FORM_ID=".$WEB_FORM_ID."&RESULT_ID=".$RESULT_ID);
else LocalRedirect("/bitrix/admin/form_result_list.php?lang=".LANGUAGE_ID."&WEB_FORM_ID=".$WEB_FORM_ID);
}
}
else $strError .= $error;
}
if ($EDIT_RESULT_TEMPLATE=="") $EDIT_RESULT_TEMPLATE=$arForm["EDIT_RESULT_TEMPLATE"];
$APPLICATION->SetTitle($RESULT_ID > 0 ? str_replace("#RESULT_ID#", $RESULT_ID, GetMessage("FORM_PAGE_TITLE")) : GetMessage('FORM_PAGE_TITLE_ADD'));
CJSCore::Init(array('date'));
$arTabs = array(array("DIV" => "edit1", "TAB" => GetMessage('FORM_RESULT_EDIT_TAB_TITLE'), "ICON" => "form_edit", "TITLE" => GetMessage('FORM_RESULT_EDIT_TAB_DESCRIPTION'.($RESULT_ID > 0 ? '' : '_ADD'))));
require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
/***************************************************************************
HTML form
****************************************************************************/
$context = new CAdminContextMenuList($arForm['ADMIN_MENU']);
$context->Show();
echo BeginNote('width="100%"');
?>
Fatal error: Uncaught Error: Call to undefined function GetMessage() in D:\ktt\ttepla.com\public_html\bitrix\modules\form\admin\form_result_edit.php:203
Stack trace:
#0 {main}
thrown in D:\ktt\ttepla.com\public_html\bitrix\modules\form\admin\form_result_edit.php on line 203