CBPHelper :: extractUsersFromExtendedGroup: Bitrix method

      
<?php 
//  CBPHelper :: extractUsersFromExtendedGroup()
//  /dist/bitrix/modules/bizproc/classes/general/helper.php:1881

    
public static function extractUsersFromExtendedGroup($code)
    {
        if (
strpos($code'group_') !== 0)
        {
            return 
false;
        }
        
$code strtoupper(substr($codestrlen('group_')));

        if (
strpos($code'G') === 0)
        {
            
$group = (int)substr($code1);
            if (
$group <= 0)
            {
                return [];
            }
            
$result = [];

            
$iterator CUser::GetList(($b "ID"), ($o "ASC"), array("GROUPS_ID" => $group"ACTIVE" => "Y"));
            while (
$user $iterator->fetch())
            {
                
$result[] = $user['ID'];
            }

            return 
$result;
        }

        if (
preg_match('/^(U|IU|SU)([0-9]+)$/i'$code$match))
        {
            return array(
$match[2]);
        }

        if (
$code == 'UA' && CModule::IncludeModule('intranet'))
        {
            
$result = [];
            
$iterator CUser::GetList(($by="id"), ($order="asc"),
                array(
'ACTIVE' => 'Y''>UF_DEPARTMENT' => 0),
                array(
'FIELDS' => array('ID'))
            );
            while(
$user $iterator->fetch())
            {
                
$result[] = $user['ID'];
            }
            return 
$result;
        }

        if (
preg_match('/^(D|DR)([0-9]+)$/'$code$match) && CModule::IncludeModule('intranet'))
        {
            
$recursive $match[1] == 'DR';
            
$id $match[2];
            
$iblockId COption::GetOptionInt('intranet''iblock_structure');
            
$departmentIds = array($id);

            if (
$recursive)
            {
                
//TODO: replace with \CIntranetUtils::getSubStructure($id)
                
$iterator CIBlockSection::GetList(
                    array(
'ID' => 'ASC'),
                    array(
'=IBLOCK_ID' => $iblockId'ID'=> $id),
                    
false,
                    array(
'ID''LEFT_MARGIN''RIGHT_MARGIN''DEPTH_LEVEL')
                );
                
$section $iterator->fetch();
                
$filter = array (
                    
'=IBLOCK_ID' => $iblockId,
                    
">LEFT_MARGIN" => $section["LEFT_MARGIN"],
                    
"<RIGHT_MARGIN" => $section["RIGHT_MARGIN"],
                    
">DEPTH_LEVEL" => $section['DEPTH_LEVEL'],
                );
                
$iterator CIBlockSection::GetList(array("left_margin"=>"asc"), $filterfalse, array('ID'));
                while(
$section $iterator->fetch())
                {
                    
$departmentIds[] =  $section['ID'];
                }
                unset(
$iterator$section$filter);
            }
            
$result = array();
            
$iterator CUser::GetList(($by="id"), ($order="asc"),
                array(
'ACTIVE' => 'Y''UF_DEPARTMENT' => $departmentIds),
                array(
'FIELDS' => array('ID'))
            );
            while(
$user $iterator->fetch())
            {
                
$result[] = $user['ID'];
            }
            return 
$result;
        }
        if (
$code == 'Dextranet' && CModule::IncludeModule('extranet'))
        {
            
$result = array();
            
$iterator CUser::GetList(($by="id"), ($order="asc"),
                array(
COption::GetOptionString("extranet""extranet_public_uf_code""UF_PUBLIC") => "1",
                    
"!UF_DEPARTMENT" => false,
                    
"GROUPS_ID" => array(CExtranet::GetExtranetUserGroupID())
                ),
                array(
'FIELDS' => array('ID'))
            );
            while(
$user $iterator->fetch())
            {
                
$result[] = $user['ID'];
            }
            return 
$result;
        }
        if (
preg_match('/^SG([0-9]+)_?([AEK])?$/'$code$match) && CModule::IncludeModule('socialnetwork'))
        {
            
$groupId = (int)$match[1];
            
$role = isset($match[2])? $match[2] : 'K';

            
$iterator CSocNetUserToGroup::GetList(
                array(
"USER_ID" => "ASC"),
                array(
                    
"=GROUP_ID" => $groupId,
                    
"<=ROLE" => $role,
                    
"USER_ACTIVE" => "Y"
                
),
                
false,
                
false,
                array(
"USER_ID")
            );
            
$result = array();
            while(
$user $iterator->fetch())
            {
                
$result[] = $user['USER_ID'];
            }
            return 
$result;
        }

        return 
false;
    }