當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CCrmPerms::GetEntityRelations方法代碼示例

本文整理匯總了PHP中CCrmPerms::GetEntityRelations方法的典型用法代碼示例。如果您正苦於以下問題:PHP CCrmPerms::GetEntityRelations方法的具體用法?PHP CCrmPerms::GetEntityRelations怎麽用?PHP CCrmPerms::GetEntityRelations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CCrmPerms的用法示例。


在下文中一共展示了CCrmPerms::GetEntityRelations方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GetAllowableUserGroups

 public static function GetAllowableUserGroups($documentType)
 {
     $documentType = trim($documentType);
     if (strlen($documentType) <= 0) {
         return false;
     }
     $arDocumentID = self::GetDocumentInfo($documentType);
     if ($arDocumentID !== false) {
         $documentType = $arDocumentID['TYPE'];
     }
     $arResult = array('author' => GetMessage('CRM_DOCUMENT_AUTHOR'));
     $arGroupsID = array(1);
     $arUsersID = array();
     $arRelations = CCrmPerms::GetEntityRelations($documentType, BX_CRM_PERM_SELF);
     foreach ($arRelations as $relation) {
         $preffix = substr($relation, 0, 1);
         if ($preffix === 'G') {
             $arGroupsID[] = intval(substr($relation, 1));
         } elseif ($preffix === 'U') {
             $arUsersID[] = substr($relation, 1);
         }
     }
     //Crutch for Bitrix24 context (user group management is not suppotted)
     if (IsModuleInstalled('bitrix24')) {
         $siteID = CAllSite::GetDefSite();
         $dbResult = CGroup::GetList($by = '', $order = '', array('STRING_ID' => 'EMPLOYEES_' . $siteID, 'STRING_ID_EXACT_MATCH' => 'Y'));
         if ($arEmloyeeGroup = $dbResult->Fetch()) {
             $employeeGroupID = intval($arEmloyeeGroup['ID']);
             if (!in_array($employeeGroupID, $arGroupsID, true)) {
                 $arGroupsID[] = $employeeGroupID;
             }
         }
     }
     if (!empty($arGroupsID)) {
         $dbGroupList = CGroup::GetListEx(array('NAME' => 'ASC'), array('ID' => $arGroupsID));
         while ($arGroup = $dbGroupList->Fetch()) {
             $arResult[$arGroup['ID']] = $arGroup['NAME'];
         }
     }
     if (isset(self::$UNGROUPED_USERS[$documentType])) {
         unset(self::$UNGROUPED_USERS[$documentType]);
     }
     self::$UNGROUPED_USERS[$documentType] = $arUsersID;
     if (!empty($arUsersID)) {
         //Group with empty name will be hidden in group list
         $arResult['ungrouped'] = '';
         //$arResult['ungrouped'] = GetMessage('CRM_DOCUMENT_UNGROUPED_USERS');
     }
     return $arResult;
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:50,代碼來源:crm_document.php


注:本文中的CCrmPerms::GetEntityRelations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。