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


PHP CForm::GetPermission方法代码示例

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


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

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

示例2: executeProlog

 /**
  * @inheritdoc executeProlog
  */
 protected function executeProlog()
 {
     if (!$this->needCache()) {
         $this->arParams['CACHE_TYPE'] = 'N';
     }
     if (!empty($this->arParams['WEB_FORM_CODE'])) {
         $this->formId = $this->getFormId($this->arParams['WEB_FORM_CODE']);
     }
     if (!$this->formId) {
         throw new \Exception(sprintf('Web form doesn\'t exists with code %s', $this->arParams['WEB_FORM_CODE']));
     }
     $this->permissions = \CForm::GetPermission($this->formId);
     $this->handlePost();
     $this->isSuccess = $this->isSuccess();
     $this->addCacheAdditionalId(json_encode($this->arParams));
     $this->addCacheAdditionalId($this->permissions);
 }
开发者ID:notagency,项目名称:notagency.base,代码行数:20,代码来源:class.php

示例3: Init

 /**
  * Form initializing and checking. If form's wrong, returns false
  * Use ShowErrorMsg() to output error code
  *
  * @param array $arParams
  * @return bool
  */
 function Init($arParams, $admin = false)
 {
     global $APPLICATION, $USER;
     $this->bSimple = COption::GetOptionString("form", "SIMPLE", "Y") == "Y" ? true : false;
     $this->comp2 = !empty($arParams["COMPONENT"]);
     $this->SHOW_INCLUDE_AREAS = $APPLICATION->GetShowIncludeAreas();
     if ($admin) {
         $FORM_RIGHT = $APPLICATION->GetGroupRight("form");
         if ($FORM_RIGHT <= "D") {
             $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
         }
         $this->__admin = true;
     }
     $this->arParams = $arParams;
     $this->RESULT_ID = intval($arParams["RESULT_ID"]);
     if (intval($this->RESULT_ID) <= 0) {
         $this->RESULT_ID = intval($_REQUEST["RESULT_ID"]);
     }
     // if there's result ID try to get form ID
     if (intval($this->RESULT_ID) > 0) {
         $DBRes = CFormResult::GetByID($this->RESULT_ID);
         if ($arrResult = $DBRes->Fetch()) {
             $this->WEB_FORM_ID = intval($arrResult["FORM_ID"]);
         }
     }
     if (intval($this->WEB_FORM_ID) <= 0) {
         $this->WEB_FORM_ID = intval($arParams["WEB_FORM_ID"]);
     }
     // if there's no WEB_FORM_ID, try to get it from $_REQUEST;
     if (intval($this->WEB_FORM_ID) <= 0) {
         $this->WEB_FORM_ID = intval($_REQUEST["WEB_FORM_ID"]);
     }
     // check WEB_FORM_ID and get web form data
     $this->WEB_FORM_ID = CForm::GetDataByID($this->WEB_FORM_ID, $this->arForm, $this->arQuestions, $this->arAnswers, $this->arDropDown, $this->arMultiSelect, $this->__admin || $this->arParams["SHOW_ADDITIONAL"] == "Y" || $this->arParams["EDIT_ADDITIONAL"] == "Y" ? "ALL" : "N", $this->__admin ? 'Y' : 'N');
     $this->WEB_FORM_NAME = $this->arForm["SID"];
     // if wrong WEB_FORM_ID return error;
     if ($this->WEB_FORM_ID > 0) {
         //  insert chain item
         if (strlen($this->arParams["CHAIN_ITEM_TEXT"]) > 0) {
             $APPLICATION->AddChainItem($this->arParams["CHAIN_ITEM_TEXT"], $this->arParams["CHAIN_ITEM_LINK"]);
         }
         // check web form rights;
         $this->F_RIGHT = intval(CForm::GetPermission($this->WEB_FORM_ID));
         // in no form access - return error
         if ($this->isAccessForm()) {
             if (!empty($_REQUEST["strFormNote"])) {
                 $this->strFormNote = $_REQUEST["strFormNote"];
             }
             if (!$this->comp2 || $this->arParams["COMPONENT"]["componentName"] != "bitrix:form.result.list" || $this->isAccessFormResultList()) {
                 if ($this->RESULT_ID) {
                     if ($this->isAccessFormResult($arrResult)) {
                         $this->arrRESULT_PERMISSION = CFormResult::GetPermissions($this->RESULT_ID, $v);
                         // check result rights
                         if (!$this->comp2 && !$this->isAccessFormResultEdit() || $this->comp2 && ($this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.edit" && !$this->isAccessFormResultEdit() || $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.view" && !$this->isAccessFormResultView())) {
                             $this->__error_msg = "FORM_RESULT_ACCESS_DENIED";
                         } else {
                             if (!$arrResult) {
                                 $z = CFormResult::GetByID($this->RESULT_ID);
                                 $this->arResult = $z->Fetch();
                             } else {
                                 $this->arResult = $arrResult;
                             }
                             if ($this->arResult) {
                                 if ($this->comp2 && $this->arParams["COMPONENT"]["componentName"] == "bitrix:form.result.view") {
                                     CForm::GetResultAnswerArray($this->WEB_FORM_ID, $this->arrResultColumns, $this->arrVALUES, $this->arrResultAnswersSID, array("RESULT_ID" => $this->RESULT_ID));
                                     $this->arrVALUES = $this->arrVALUES[$this->RESULT_ID];
                                 } else {
                                     $this->arrVALUES = CFormResult::GetDataByIDForHTML($this->RESULT_ID, $this->arParams["EDIT_ADDITIONAL"]);
                                 }
                             } else {
                                 $this->__error_msg = "FORM_RECORD_NOT_FOUND";
                             }
                         }
                     } else {
                         $this->__error_msg = "FORM_ACCESS_DENIED";
                     }
                     $this->arForm["USE_CAPTCHA"] = "N";
                 } else {
                     // if form uses CAPCHA initialize it
                     if ($this->arForm["USE_CAPTCHA"] == "Y") {
                         $this->CaptchaInitialize();
                     }
                 }
             } else {
                 $this->__error_msg = "FORM_ACCESS_DENIED";
             }
         } else {
             $this->__error_msg = "FORM_ACCESS_DENIED";
         }
         // endif ($F_RIGHT>=10);
     } else {
         $this->__error_msg = "FORM_NOT_FOUND";
     }
//.........这里部分代码省略.........
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:101,代码来源:form_cformoutput_old.php

示例4: array

                $DB->StartTransaction();
                if (!CForm::Delete($ID)) {
                    $DB->Rollback();
                    $lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
                }
                $DB->Commit();
                break;
        }
    }
}
//////////////////////////////////////////////////////////////////////
// list initialization - get data
$rsData = CForm::GetList($by, $order, $arFilter, $is_filtered);
$arData = array();
while ($arForm = $rsData->Fetch()) {
    $F_RIGHT = CForm::GetPermission($arForm["ID"]);
    if ($F_RIGHT >= 20) {
        $arForm["F_RIGHT"] = $F_RIGHT;
        $arData[] = $arForm;
    }
}
$rsData->InitFromArray($arData);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
// set navigation bar
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("FORM_PAGES")));
$headers = array(array("id" => "ID", "content" => "ID", "sort" => "s_id", "default" => true), array("id" => "SITE", "content" => GetMessage("FORM_SITE"), "default" => true), array("id" => "C_SORT", "content" => GetMessage("FORM_C_SORT"), "sort" => "s_c_sort", "default" => true));
if (!$bSimple) {
    $headers[] = array("id" => "SID", "content" => GetMessage("FORM_SID"), "sort" => "s_sid", "default" => true);
}
$headers[] = array("id" => "NAME", "content" => GetMessage("FORM_NAME"), "sort" => "s_name", "default" => true);
开发者ID:spas-viktor,项目名称:books,代码行数:31,代码来源:form_list.php

示例5: Reset

 function Reset($ID, $CHECK_RIGHTS = "Y")
 {
     global $DB, $strError;
     $err_mess = CAllForm::err_mess() . "<br>Function: Reset<br>Line: ";
     $ID = intval($ID);
     $F_RIGHT = $CHECK_RIGHTS != "Y" ? 30 : CForm::GetPermission($ID);
     if ($F_RIGHT >= 30) {
         // обнул¤ем пол¤ формы
         $rsFields = CFormField::GetList($ID, "ALL", $by, $order, array(), $is_filtered);
         while ($arField = $rsFields->Fetch()) {
             CFormField::Reset($arField["ID"], "N");
         }
         // удал¤ем результаты данной формы
         $DB->Query("DELETE FROM b_form_result WHERE FORM_ID='{$ID}'", false, $err_mess . __LINE__);
         return true;
     } else {
         $strError .= GetMessage("FORM_ERROR_ACCESS_DENIED") . "<br>";
     }
     return false;
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:20,代码来源:form_callform.php

示例6: Show

 function Show($RESULT_ID, $TEMPLATE = "", $TEMPLATE_TYPE = "show", $SHOW_ADDITIONAL = "N", $SHOW_ANSWER_VALUE = "Y", $SHOW_STATUS = "N")
 {
     global $DB, $MESS, $APPLICATION, $USER, $HTTP_POST_VARS, $HTTP_GET_VARS, $arrRESULT_PERMISSION, $arrFIELDS;
     $err_mess = CAllFormResult::err_mess() . "<br>Function: Show<br>Line: ";
     $z = CFormResult::GetByID($RESULT_ID);
     if ($zr = $z->Fetch()) {
         $arrResult = $zr;
         InitBVar($SHOW_ADDITIONAL);
         $additional = $SHOW_ADDITIONAL == "Y" ? "ALL" : "N";
         $WEB_FORM_ID = $FORM_ID = CForm::GetDataByID($arrResult["FORM_ID"], $arForm, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $additional);
         CForm::GetResultAnswerArray($WEB_FORM_ID, $arrResultColumns, $arrResultAnswers, $arrResultAnswersVarname, array("RESULT_ID" => $RESULT_ID));
         $arrResultAnswers = $arrResultAnswers[$RESULT_ID];
         // проверим общие права на результат
         $F_RIGHT = CForm::GetPermission($WEB_FORM_ID);
         if (intval($F_RIGHT) >= 20 || $F_RIGHT >= 15 && $zr["USER_ID"] == $USER->GetID()) {
             // проверим права в зависимости от статуса результата
             $arrRESULT_PERMISSION = CFormResult::GetPermissions($RESULT_ID, $v);
             if (in_array("VIEW", $arrRESULT_PERMISSION)) {
                 if (strlen(trim($TEMPLATE)) > 0) {
                     $template = $TEMPLATE;
                 } else {
                     if ($TEMPLATE_TYPE == "show") {
                         if (strlen($arrResult["SHOW_RESULT_TEMPLATE"]) <= 0) {
                             $template = "default.php";
                         } else {
                             $template = $arrResult["SHOW_RESULT_TEMPLATE"];
                         }
                     } elseif ($TEMPLATE_TYPE == "print") {
                         if (strlen($arrResult["PRINT_RESULT_TEMPLATE"]) <= 0) {
                             $template = "default.php";
                         } else {
                             $template = $arrResult["PRINT_RESULT_TEMPLATE"];
                         }
                     }
                 }
                 require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/include.php";
                 if ($TEMPLATE_TYPE == "show") {
                     $path = COption::GetOptionString("form", "SHOW_RESULT_TEMPLATE_PATH");
                 } elseif ($TEMPLATE_TYPE == "print") {
                     $path = COption::GetOptionString("form", "PRINT_RESULT_TEMPLATE_PATH");
                 }
                 IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/form/include.php");
                 include GetLangFileName($_SERVER["DOCUMENT_ROOT"] . $path . "lang/", "/" . $template);
                 if ($APPLICATION->GetShowIncludeAreas()) {
                     $arIcons = array();
                     if (CModule::IncludeModule("fileman")) {
                         $arIcons[] = array("URL" => "/bitrix/admin/fileman_file_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&full_src=Y&path=" . urlencode($path . $template), "SRC" => "/bitrix/images/form/panel/edit_template.gif", "ALT" => GetMessage("FORM_PUBLIC_ICON_TEMPLATE"));
                         $arrUrl = parse_url($_SERVER["REQUEST_URI"]);
                         $arIcons[] = array("URL" => "/bitrix/admin/fileman_file_edit.php?lang=" . LANGUAGE_ID . "&site=" . SITE_ID . "&full_src=Y&path=" . urlencode($arrUrl["path"]), "SRC" => "/bitrix/images/form/panel/edit_file.gif", "ALT" => GetMessage("FORM_PUBLIC_ICON_HANDLER"));
                     }
                     $arIcons[] = array("URL" => "/bitrix/admin/form_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $WEB_FORM_ID, "SRC" => "/bitrix/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:DarneoStudio,项目名称:bitrix,代码行数:61,代码来源:form_cformresult_old.php

示例7: intval

		// 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)
		{
			//  insert chain item
			if (strlen($arParams["CHAIN_ITEM_TEXT"]) > 0)
			{
				$APPLICATION->AddChainItem($arParams["CHAIN_ITEM_TEXT"], $arParams["CHAIN_ITEM_LINK"]);
			}

			// check web form rights;
			$arResult["F_RIGHT"] = intval(CForm::GetPermission($arParams["WEB_FORM_ID"]));

			// in no form access - return error
			if ($arResult["F_RIGHT"] >= 15)
			{
				//if (!empty($_REQUEST["strFormNote"])) $arResult["FORM_NOTE"] = $_REQUEST["strFormNote"];
				if (!empty($_REQUEST["formresult"]))
				{
					$formResult = strtoupper($_REQUEST['formresult']);
					switch ($formResult)
					{
						case 'ADDOK':
							$arResult['FORM_NOTE'] = str_replace("#RESULT_ID#", $arParams["RESULT_ID"], GetMessage('FORM_NOTE_ADDOK'));
						break;
						default:
							$arResult['FORM_NOTE'] = str_replace("#RESULT_ID#", $arParams["RESULT_ID"], GetMessage('FORM_NOTE_EDITOK'));
开发者ID:ASDAFF,项目名称:open_bx,代码行数:31,代码来源:component.php

示例8: reset

        $arrSelect['reference_id'][] = $arr['reference_id'][$num];
        $arrSelect['reference'][] = $arr['reference'][$num];
    }
} else {
    $arrSelect = $arr;
}
reset($arGroups);
while (list(, $group) = each($arGroups)) {
    ?>
	<tr>
		<td width="40%"><?php 
    echo $group["NAME"] . ":";
    ?>
</td>
		<td width="60%"><?php 
    $perm = CForm::GetPermission($ID, array($group["ID"]), "Y");
    // for simple method: change 20 (work with other results) access mode to 15
    /*
    if ($bSimple)
    	$perm = $perm==20 ? 15 : $perm;
    */
    echo SelectBoxFromArray("PERMISSION_" . $group["ID"], $arrSelect, $perm, "", 'style="width: 80%;"');
    ?>
</td>
	</tr>
	<?php 
}
$tabControl->EndTab();
$tabControl->Buttons(array("disabled" => !($ID > 0 && $F_RIGHT >= 30 || CForm::IsAdmin()), "back_url" => strlen($back_url) > 0 ? $back_url : "form_list.php?lang=" . LANGUAGE_ID));
$tabControl->End();
?>
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:form_edit.php

示例9: Copy

	/**
	 * <p>Копирует <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статус</a>. Возвращает ID нового <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статуса</a> в случае положительного результата, в противном случае - "false".</p>
	 *
	 *
	 *
	 *
	 * @param int $status_id  ID <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статуса</a> который
	 * необходимо скопировать.
	 *
	 *
	 *
	 * @param string $check_rights = "Y" Флаг необходимости проверки <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#permissions">прав</a> текущего
	 * пользователя. Возможны следующие значения: <ul> <li> <b>Y</b> - права
	 * необходимо проверить; </li> <li> <b>N</b> - право не нужно проверять. </li>
	 * </ul> Для копирования <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статуса</a>
	 * необходимо обладать нижеследующими <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#permissions#module">правами</a>: <ol> <li> <b>[25]
	 * просмотр параметров веб-формы</b> на ту веб-форму, из которой идет
	 * копирование; </li> <li> <b>[30] полный доступ</b> на ту веб-форму, в которую
	 * копируется. </li> </ol> Параметр необязательный. По умолчанию - "Y"
	 * (права необходимо проверить).
	 *
	 *
	 *
	 * @param mixed $form_id = false ID <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#form">веб-формы</a> в который
	 * необходимо скопировать <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статус</a>.<br> Необязательный
	 * параметр. По умолчанию - "false" (текущая <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#form">веб-форма</a>).
	 *
	 *
	 *
	 * @return mixed 
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * &lt;?
	 * $status_id = 1; // ID статуса
	 * // скопируем статус
	 * if ($NEW_STATUS_ID = <b>CFormStatus::Copy</b>($status_id))
	 * {
	 *     echo "Статус #1 успешно скопирован в новый статус #".$NEW_STATUS_ID;
	 * }
	 * else
	 * {
	 *     // выведем текст ошибки
	 *     global $strError;
	 *     echo $strError;
	 * }
	 * ?&gt;
	 * </pre>
	 *
	 *
	 *
	 * <h4>See Also</h4> 
	 * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/form/classes/cform/copy.php">CForm::Copy</a> </li> <li> <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/classes/cformfield/copy.php">CFormField::Copy</a> </li> <li> <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/classes/cformanswer/copy.php">CFormAnswer::Copy</a> </li> </ul><a
	 * name="examples"></a>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/form/classes/cformstatus/copy.php
	 * @author Bitrix
	 */
	public static function Copy($ID, $CHECK_RIGHTS="Y", $NEW_FORM_ID=false)
	{
		global $DB, $APPLICATION, $strError;
		$err_mess = (CAllFormStatus::err_mess())."<br>Function: Copy<br>Line: ";
		$ID = intval($ID);
		$NEW_FORM_ID = intval($NEW_FORM_ID);
		$rsStatus = CFormStatus::GetByID($ID);
		if ($arStatus = $rsStatus->Fetch())
		{
			$RIGHT_OK = "N";
			if ($CHECK_RIGHTS!="Y" || CForm::IsAdmin()) $RIGHT_OK="Y";
			else
			{
				$F_RIGHT = CForm::GetPermission($arStatus["FORM_ID"]);
				// если имеем право на просмотр параметров формы
				if ($F_RIGHT>=25)
				{
					// если задана новая форма
					if ($NEW_FORM_ID>0)
					{
						$NEW_F_RIGHT = CForm::GetPermission($NEW_FORM_ID);
						// если имеем полный доступ на новую форму
						if ($NEW_F_RIGHT>=30) $RIGHT_OK = "Y";
					}
					elseif ($F_RIGHT>=30) // если имеем полный доступ на исходную форму
					{
						$RIGHT_OK = "Y";
					}
				}
			}

			// если права проверили то
			if ($RIGHT_OK=="Y")
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:form_callformstatus.php

示例10: CheckFields

 public static function CheckFields(&$arFields, $FIELD_ID, $CHECK_RIGHTS = "Y")
 {
     $err_mess = CAllFormField::err_mess() . "<br>Function: CheckFields<br>Line: ";
     global $DB, $strError;
     $str = "";
     $FIELD_ID = intval($FIELD_ID);
     $FORM_ID = intval($arFields["FORM_ID"]);
     if ($FORM_ID <= 0) {
         $str .= GetMessage("FORM_ERROR_FORM_ID_NOT_DEFINED") . "<br>";
     } else {
         $RIGHT_OK = "N";
         if ($CHECK_RIGHTS != "Y" || CForm::IsAdmin()) {
             $RIGHT_OK = "Y";
         } else {
             $F_RIGHT = CForm::GetPermission($FORM_ID);
             if ($F_RIGHT >= 30) {
                 $RIGHT_OK = "Y";
             }
         }
         if ($RIGHT_OK == "Y") {
             if (strlen(trim($arFields["SID"])) > 0) {
                 $arFields["VARNAME"] = $arFields["SID"];
             } elseif (strlen($arFields["VARNAME"]) > 0) {
                 $arFields["SID"] = $arFields["VARNAME"];
             }
             if ($FIELD_ID <= 0 && !is_set($arFields, 'ADDITIONAL')) {
                 $arFields['ADDITIONAL'] = 'N';
             }
             if ($FIELD_ID <= 0 || $FIELD_ID > 0 && is_set($arFields, "SID")) {
                 if (strlen(trim($arFields["SID"])) <= 0) {
                     $str .= GetMessage("FORM_ERROR_FORGOT_SID") . "<br>";
                 }
                 if (preg_match("/[^A-Za-z_01-9]/", $arFields["SID"])) {
                     $str .= GetMessage("FORM_ERROR_INCORRECT_SID") . "<br>";
                 } else {
                     $strSql = "SELECT ID, ADDITIONAL FROM b_form_field WHERE SID='" . $DB->ForSql(trim($arFields["SID"]), 50) . "' and ID<>'" . $FIELD_ID . "' AND FORM_ID='" . $DB->ForSql($arFields["FORM_ID"]) . "'";
                     $z = $DB->Query($strSql, false, $err_mess . __LINE__);
                     if ($zr = $z->Fetch()) {
                         $s = $zr["ADDITIONAL"] == "Y" ? str_replace("#TYPE#", GetMessage("FORM_TYPE_FIELD"), GetMessage("FORM_ERROR_WRONG_SID")) : str_replace("#TYPE#", GetMessage("FORM_TYPE_QUESTION"), GetMessage("FORM_ERROR_WRONG_SID"));
                         $s = str_replace("#ID#", $zr["ID"], $s);
                         $str .= $s . "<br>";
                     } else {
                         $strSql = "SELECT ID FROM b_form WHERE SID='" . $DB->ForSql(trim($arFields["SID"]), 50) . "'";
                         $z = $DB->Query($strSql, false, $err_mess . __LINE__);
                         if ($zr = $z->Fetch()) {
                             $s = str_replace("#TYPE#", GetMessage("FORM_TYPE_FORM"), GetMessage("FORM_ERROR_WRONG_SID"));
                             $s = str_replace("#ID#", $zr["ID"], $s);
                             $str .= $s . "<br>";
                         }
                     }
                 }
             }
             $str .= CFile::CheckImageFile($arFields["arIMAGE"]);
         } else {
             $str .= GetMessage("FORM_ERROR_ACCESS_DENIED");
         }
     }
     $strError .= $str;
     if (strlen($str) > 0) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:64,代码来源:form_callformfield.php

示例11: SetStatus

	/**
	 * <p>Устанавливает новый <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статус</a> для <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a>. Возвращает "true" в случае успеха, в противном случае - "false".</p>
	 *
	 *
	 *
	 *
	 * @param int $result_id  ID <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a>.
	 *
	 *
	 *
	 * @param int $status_id  ID нового <a href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статуса</a>.
	 *
	 *
	 *
	 * @param string $check_rights = "Y" Флаг необходимости проверки прав текущего пользователя.
	 * Возможны следующие значения: <ul> <li> <b>Y</b> - права необходимо
	 * проверить; </li> <li> <b>N</b> - права не нужно проверять. </li> </ul> Для
	 * успешной установки нового <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#status">статуса</a> для указанного <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/terms.php#result">результата</a> необходимо
	 * обладать следующими <a
	 * href="http://dev.1c-bitrix.ru/api_help/form/permissions.php">правами</a>: <ol> <li>На веб-форму к
	 * которой принадлежит редактируемый результат: <br><br><b>[20] Работа со
	 * всеми результатами в соответствии с их статусами</b> <br><br>или, в
	 * случае, если вы являетесь создателем удаляемого результата,
	 * достаточно права: <br><br><b>[15] Работа со своим результатом в
	 * соответствии с его статусом</b> <br> </li> <li>На статус, в котором
	 * находится редактируемый результат, необходимо иметь право:
	 * <br><br><b>[EDIT] редактирование</b> <br> </li> <li>На новый статус <i>status_id</i>
	 * необходимо иметь право: <br><br><b>[MOVE] перевод результатов в данный
	 * статус</b> </li> </ol> Параметр необязательный. По умолчанию - "Y" (права
	 * необходимо проверить).
	 *
	 *
	 *
	 * @return bool 
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * &lt;?
	 * $RESULT_ID = 189; // ID результата
	 * $STATUS_ID = 1; // ID статуса "Опубликовано"
	 * 
	 * // установим новый статус для результата
	 * // с проверкой прав текущего пользователя
	 * if (<b>CFormResult::SetStatus</b>($RESULT_ID, $STATUS_ID))
	 * {
	 *     echo "Статус #".$STATUS_ID." для результата #".$RESULT_ID." успешно установлен.";
	 * }
	 * else // ошибка
	 * {
	 *     global $strError;
	 *     echo $strError;
	 * }
	 * ?&gt;
	 * </pre>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/form/classes/cformresult/setstatus.php
	 * @author Bitrix
	 */
	public static function SetStatus($RESULT_ID, $NEW_STATUS_ID, $CHECK_RIGHTS="Y")
	{
		$err_mess = (CAllFormResult::err_mess())."<br>Function: SetStatus<br>Line: ";
		global $DB, $USER, $strError, $APPLICATION;
		$NEW_STATUS_ID = intval($NEW_STATUS_ID);
		$RESULT_ID = intval($RESULT_ID);

		if ($RESULT_ID <= 0 || $NEW_STATUS_ID <= 0)
			return false;

		$strSql = "SELECT USER_ID, FORM_ID FROM b_form_result WHERE ID='".$RESULT_ID."'";
		$z = $DB->Query($strSql, false, $err_mess.__LINE__);
		if ($zr = $z->Fetch())
		{
			$WEB_FORM_ID = intval($zr["FORM_ID"]);

			// rights check
			$RIGHT_OK = "N";
			if ($CHECK_RIGHTS!="Y")
			{
				$dbRes = CFormStatus::GetByID($NEW_STATUS_ID);
				if ($dbRes->Fetch())
				{
					$RIGHT_OK="Y";
				}
			}
			else
			{
				// form rights
				$F_RIGHT = CForm::GetPermission($WEB_FORM_ID);
				if ($F_RIGHT>=20 || ($F_RIGHT>=15 && $USER->GetID()==$zr["USER_ID"]))
				{
					// result rights
					$arrRESULT_PERMISSION = CFormResult::GetPermissions($RESULT_ID, $v);

					// new status rights
					$arrNEW_STATUS_PERMISSION = CFormStatus::GetPermissions($NEW_STATUS_ID);
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:101,代码来源:form_callformresult.php

示例12: 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;
//.........这里部分代码省略.........
开发者ID:ASDAFF,项目名称:open_bx,代码行数:101,代码来源:form_cformresult.php

示例13: strtoupper

     $APPLICATION->AddChainItem($arParams["CHAIN_ITEM_TEXT"], $arParams["CHAIN_ITEM_LINK"]);
 }
 // preparing additional parameters
 $arResult["FORM_ERROR"] = $_REQUEST["strError"];
 //$arResult["FORM_NOTE"] = $_REQUEST["strFormNote"];
 if (!empty($_REQUEST["formresult"]) && $_SERVER['REQUEST_METHOD'] != 'POST') {
     $formResult = strtoupper($_REQUEST['formresult']);
     switch ($formResult) {
         case 'ADDOK':
             $arResult['FORM_NOTE'] = str_replace("#RESULT_ID#", $arParams["RESULT_ID"], GetMessage('FORM_NOTE_ADDOK'));
             break;
         default:
             $arResult['FORM_NOTE'] = str_replace("#RESULT_ID#", $arParams["RESULT_ID"], GetMessage('FORM_NOTE_EDITOK'));
     }
 }
 $arParams["F_RIGHT"] = CForm::GetPermission($arParams["WEB_FORM_ID"]);
 if ($arParams["F_RIGHT"] < 15) {
     $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
 }
 $arParams["isStatisticIncluded"] = CModule::IncludeModule("statistic");
 if (is_array($arParams["NOT_SHOW_FILTER"])) {
     $arParams["arrNOT_SHOW_FILTER"] = $arParams["NOT_SHOW_FILTER"];
 } else {
     $arParams["arrNOT_SHOW_FILTER"] = explode(",", $arParams["NOT_SHOW_FILTER"]);
 }
 if (is_array($arParams["arrNOT_SHOW_FILTER"])) {
     //array_walk($arParams["arrNOT_SHOW_FILTER"], create_function("&\$item", "\$item=trim(\$item);"));
     TrimArr($arParams["arrNOT_SHOW_FILTER"]);
 } else {
     $arParams["arrNOT_SHOW_FILTER"] = array();
 }
开发者ID:Satariall,项目名称:izurit,代码行数:31,代码来源:component.php


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