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


PHP CGroup::getListEx方法代码示例

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


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

示例1: GetAllowableUserGroups

 /**
  * @param $documentType
  * @param bool $withExtended
  * @return array|bool
  */
 public function GetAllowableUserGroups($documentType, $withExtended = false)
 {
     $documentType = trim($documentType);
     if (strlen($documentType) <= 0) {
         return false;
     }
     $iblockId = intval(substr($documentType, strlen("iblock_")));
     $result = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));
     $groupsId = array(1);
     $extendedGroupsCode = array();
     if (CIBlock::getArrayByID($iblockId, "RIGHTS_MODE") === "E") {
         $rights = new CIBlockRights($iblockId);
         foreach ($rights->getGroups() as $iblockGroupCode) {
             if (preg_match("/^G(\\d+)\$/", $iblockGroupCode, $match)) {
                 $groupsId[] = $match[1];
             } else {
                 $extendedGroupsCode[] = $iblockGroupCode;
             }
         }
     } else {
         foreach (CIBlock::getGroupPermissions($iblockId) as $groupId => $perm) {
             if ($perm > "R") {
                 $groupsId[] = $groupId;
             }
         }
     }
     $groupsIterator = CGroup::getListEx(array("NAME" => "ASC"), array("ID" => $groupsId));
     while ($group = $groupsIterator->fetch()) {
         $result[$group["ID"]] = $group["NAME"];
     }
     if ($withExtended && $extendedGroupsCode) {
         foreach ($extendedGroupsCode as $groupCode) {
             $result['group_' . $groupCode] = CBPHelper::getExtendedGroupName($groupCode);
         }
     }
     return $result;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:42,代码来源:bizprocdocument.php

示例2: getAllowableUserGroups

 public static function getAllowableUserGroups($documentType)
 {
     $storageId = self::getStorageIdByType($documentType);
     if (!$storageId) {
         throw new CBPArgumentNullException('documentType');
     }
     /** @var Storage $storage */
     $storage = Storage::loadById($storageId, array('ROOT_OBJECT'));
     if (!$storage) {
         throw new CBPArgumentNullException('documentType');
     }
     if ($storage->getProxyType() instanceof ProxyType\Group) {
         if (Loader::includeModule("socialnetwork")) {
             $resultUserGroups = array();
             $resultUserGroups["author"] = Loc::getMessage("DISK_USER_GROUPS_AUTHOR");
             $resultUserGroups[SONET_ROLES_OWNER] = Loc::getMessage("DISK_USER_GROUPS_OWNER");
             $resultUserGroups[SONET_ROLES_MODERATOR] = Loc::getMessage("DISK_USER_GROUPS_MODS");
             $resultUserGroups[SONET_ROLES_USER] = Loc::getMessage("DISK_USER_GROUPS_MEMBERS");
             return $resultUserGroups;
         }
     } else {
         $resultUserGroups = array('Author' => Loc::getMessage("DISK_USER_GROUPS_AUTHOR"));
         $groupIds = array(1);
         foreach (Driver::getInstance()->getRightsManager()->getSpecificRights($storage->getRootObject()) as $right) {
             if (preg_match("/^G(\\d+)\$/", $right['ACCESS_CODE'], $match)) {
                 $groupIds[] = $match[1];
             }
         }
         unset($right);
         //Crutch for Bitrix24 context (user group management is not supported)
         if (ModuleManager::isModuleInstalled('bitrix24')) {
             $siteId = \CAllSite::getDefSite();
             $employeeGroup = \CGroup::getList($by = '', $order = '', array('STRING_ID' => 'EMPLOYEES_' . $siteId, 'STRING_ID_EXACT_MATCH' => 'Y'))->fetch();
             if ($employeeGroup) {
                 $employeeGroupId = (int) $employeeGroup['ID'];
                 if (!in_array($employeeGroupId, $groupIds, true)) {
                     $groupIds[] = $employeeGroupId;
                 }
             }
         }
         $dbGroupsList = \CGroup::getListEx(array('NAME' => 'ASC'), array('ID' => $groupIds));
         while ($group = $dbGroupsList->fetch()) {
             $resultUserGroups[$group['ID']] = $group['NAME'];
         }
         return $resultUserGroups;
     }
 }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:47,代码来源:bizprocdocument.php


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