- Модуль: form
- Путь к файлу: ~/bitrix/modules/form/classes/mysql/form_cformresult.php
- Класс: CFormResult
- Вызов: CFormResult::GetPermissions
static function GetPermissions($RESULT_ID, &$CURRENT_STATUS_ID = null)
{
$err_mess = (CFormResult::err_mess())."
Function: GetPermissions
Line: ";
global $DB, $USER, $strError;
$USER_ID = intval($USER->GetID());
$RESULT_ID = intval($RESULT_ID);
$arrReturn = array();
$arGroups = $USER->GetUserGroupArray();
if (!is_array($arGroups)) $arGroups[] = 2;
if (CForm::IsAdmin()) return CFormStatus::GetMaxPermissions();
else
{
$arr = array();
if (is_array($arGroups) && count($arGroups)>0) $groups = implode(",",$arGroups);
$strSql = "
SELECT
G.PERMISSION,
R.STATUS_ID
FROM
b_form_result R,
b_form_status_2_group G
WHERE
R.ID = $RESULT_ID
and R.STATUS_ID = G.STATUS_ID
and (
(G.GROUP_ID in ($groups) and ifnull(R.USER_ID,0) <> $USER_ID) or
(G.GROUP_ID in ($groups,0) and ifnull(R.USER_ID,0) = $USER_ID)
)
";
$z = $DB->Query($strSql, false, $err_mess.__LINE__);
while ($zr = $z->Fetch())
{
$arrReturn[] = $zr["PERMISSION"];
$CURRENT_STATUS_ID = $zr["STATUS_ID"];
}
}
return $arrReturn;
}