CAdvContract :: GetEmailArrayByRole: Bitrix method

      
<?php 
//  CAdvContract :: GetEmailArrayByRole()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:190

    
public static function GetEmailArrayByRole($role)
    {
        global 
$USER;
        if (!
is_object($USER)) $USER = new CUser;
        
$arrEMail = array();
        
$arGroups CAdvContract::GetGroupsByRole($role);
        if (
is_array($arGroups) && count($arGroups)>0)
        {
            
$rsUser CUser::GetList($v1="id"$v2="desc", array("ACTIVE" => "Y""GROUPS_ID" => $arGroups));
            while (
$arUser $rsUser->Fetch())
            {
                
$arrEMail[] = $arUser["EMAIL"];
            }
        }
        return 
array_unique($arrEMail);
    }