예제 #1
0
    $str_USE_CAPTCHA = "N";
    $str_USE_DEFAULT_TEMPLATE = "N";
    $str_USE_RESTRICTIONS = "N";
    $str_RESTRICT_USER = 0;
    $str_RESTRICT_TIME = 0;
    $arRESTRICT_STATUS = array();
} else {
    if (strlen($strError) <= 0) {
        $z = CForm::GetMenuList(array("FORM_ID" => $ID), "N");
        while ($zr = $z->Fetch()) {
            ${"MENU_" . $zr["LID"]} = $zr["MENU"];
        }
        $arSITE = CForm::GetSiteArray($ID);
        $arMAIL_TEMPLATE = CForm::GetMailTemplateArray($ID);
        if (!is_set($str_FORM_TEMPLATE)) {
            $str_FORM_TEMPLATE = CForm::GetFormTemplateByID($ID);
        }
        $arRESTRICT_STATUS = explode(",", $str_RESTRICT_STATUS);
    }
}
if (strlen($strError) > 0) {
    $DB->InitTableVarsForEdit("b_form", "", "str_");
}
if ($ID > 0) {
    $sDocTitle = str_replace("#ID#", $ID, GetMessage("FORM_EDIT_RECORD"));
    $sDocTitle = str_replace("#NAME#", $str_NAME, $sDocTitle);
} else {
    $sDocTitle = GetMessage("FORM_NEW_RECORD");
}
$APPLICATION->SetTitle($sDocTitle);
if ($ID > 0) {
예제 #2
0
 function Copy($ID, $CHECK_RIGHTS = "Y")
 {
     global $DB, $APPLICATION, $strError;
     $err_mess = CAllForm::err_mess() . "<br>Function: Copy<br>Line: ";
     $ID = intval($ID);
     if ($CHECK_RIGHTS != "Y" || CForm::IsAdmin()) {
         $rsForm = CForm::GetByID($ID);
         $arForm = $rsForm->Fetch();
         if (!is_set($arForm, "FORM_TEMPLATE")) {
             $arForm["FORM_TEMPLATE"] = CForm::GetFormTemplateByID($ID);
         }
         // символьный код формы
         while (true) {
             $SID = $arForm["SID"];
             if (strlen($SID) > 25) {
                 $SID = substr($SID, 0, 25);
             }
             $SID .= "_" . RandString(5);
             $strSql = "SELECT 'x' FROM b_form WHERE SID='" . $DB->ForSql($SID, 50) . "'";
             $z = $DB->Query($strSql, false, $err_mess . __LINE__);
             if (!($zr = $z->Fetch())) {
                 break;
             }
         }
         $arFields = array("NAME" => $arForm["NAME"], "SID" => $SID, "C_SORT" => $arForm["C_SORT"], "FIRST_SITE_ID" => $arForm["FIRST_SITE_ID"], "BUTTON" => $arForm["BUTTON"], "USE_CAPTCHA" => $arForm["USE_CAPTCHA"], "DESCRIPTION" => $arForm["DESCRIPTION"], "DESCRIPTION_TYPE" => $arForm["DESCRIPTION_TYPE"], "SHOW_TEMPLATE" => $arForm["SHOW_TEMPLATE"], "FORM_TEMPLATE" => $arForm["FORM_TEMPLATE"], "USE_DEFAULT_TEMPLATE" => $arForm["USE_DEFAULT_TEMPLATE"], "SHOW_RESULT_TEMPLATE" => $arForm["SHOW_RESULT_TEMPLATE"], "PRINT_RESULT_TEMPLATE" => $arForm["PRINT_RESULT_TEMPLATE"], "EDIT_RESULT_TEMPLATE" => $arForm["EDIT_RESULT_TEMPLATE"], "FILTER_RESULT_TEMPLATE" => $arForm["FILTER_RESULT_TEMPLATE"], "TABLE_RESULT_TEMPLATE" => $arForm["TABLE_RESULT_TEMPLATE"], "STAT_EVENT1" => $arForm["STAT_EVENT1"], "STAT_EVENT2" => $SID, "STAT_EVENT3" => $arForm["STAT_EVENT3"], "arSITE" => CForm::GetSiteArray($ID));
         // пункты меню
         $z = CForm::GetMenuList(array("FORM_ID" => $ID), "N");
         while ($zr = $z->Fetch()) {
             $arFields["arMENU"][$zr["LID"]] = $zr["MENU"];
         }
         // права групп
         $w = CGroup::GetList($v1 = "dropdown", $v2 = "asc", array("ADMIN" => "N"), $v3);
         $arGroups = array();
         while ($wr = $w->Fetch()) {
             $arGroups[] = $wr["ID"];
         }
         if (is_array($arGroups)) {
             foreach ($arGroups as $gid) {
                 $arFields["arGROUP"][$gid] = CForm::GetPermission($ID, array($gid), "Y");
             }
         }
         // картинка
         if (intval($arForm["IMAGE_ID"]) > 0) {
             $arIMAGE = CFile::MakeFileArray(CFile::CopyFile($arForm["IMAGE_ID"]));
             $arIMAGE["MODULE_ID"] = "form";
             $arFields["arIMAGE"] = $arIMAGE;
         }
         $NEW_ID = CForm::Set($arFields, 0);
         if (intval($NEW_ID) > 0) {
             // статусы
             $rsStatus = CFormStatus::GetList($ID, $by, $order, array(), $is_filtered);
             while ($arStatus = $rsStatus->Fetch()) {
                 CFormStatus::Copy($arStatus["ID"], "N", $NEW_ID);
             }
             // вопросы/пол¤
             $rsField = CFormField::GetList($ID, "ALL", $by, $order, array(), $is_filtered);
             while ($arField = $rsField->Fetch()) {
                 CFormField::Copy($arField["ID"], "N", $NEW_ID);
             }
         }
         return $NEW_ID;
     } else {
         $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED") . "<br>";
     }
     return false;
 }
예제 #3
0
	$str_USE_DEFAULT_TEMPLATE = "N";
	$str_USE_RESTRICTIONS = "N";
	$str_RESTRICT_USER = 0;
	$str_RESTRICT_TIME = 0;
	$arRESTRICT_STATUS = array();
}
else
{
	if (strlen($strError)<=0)
	{
		$z = CForm::GetMenuList(array("FORM_ID"=>$ID), "N");
		while ($zr = $z->Fetch()) ${"MENU_".$zr["LID"]} = $zr["MENU"];

		$arSITE = CForm::GetSiteArray($ID);
		$arMAIL_TEMPLATE = CForm::GetMailTemplateArray($ID);
		if (!is_set($str_FORM_TEMPLATE)) $str_FORM_TEMPLATE = CForm::GetFormTemplateByID($ID);

		$arRESTRICT_STATUS = explode(",", $str_RESTRICT_STATUS);
	}
}

if (strlen($strError)>0) $DB->InitTableVarsForEdit("b_form", "", "str_");

if ($ID>0)
{
	$sDocTitle = str_replace("#ID#", $ID, GetMessage("FORM_EDIT_RECORD"));
	$sDocTitle = str_replace("#NAME#", $str_NAME, $sDocTitle);
}
else $sDocTitle = GetMessage("FORM_NEW_RECORD");

$APPLICATION->SetTitle($sDocTitle);