CAdvContract :: GetGroupsByRole: Bitrix method

      
<?php 
//  CAdvContract :: GetGroupsByRole()
//  /dist/bitrix/modules/advertising/classes/general/advertising.php:162

    
public static function GetGroupsByRole($role)
    {
        global 
$APPLICATION$USER;
        if (!
is_object($USER)) $USER = new CUser;
        
$arGroups = array();
        
$z CGroup::GetList($v1="dropdown"$v2="asc", array("ACTIVE" => "Y"));
        while(
$zr $z->Fetch())
        {
            
$arRoles $APPLICATION->GetUserRoles("advertising", array(intval($zr["ID"])), "Y""N");
            if (
in_array($role$arRoles)) $arGroups[] = intval($zr["ID"]);
        }
        return 
array_unique($arGroups);
    }