• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/vk/api/apihelper.php
  • Класс: BitrixSaleTradingPlatformVkApiApiHelper
  • Вызов: ApiHelper::getUserGroups
private function getUserGroups($offset = null)
{
	$userGroups = array();
	$stepCount = 0;
	
//		max 1000 in one step.Check this value and run api again if needed
	while(true)
	{
		$params = array(
			'extended' => 1,
			'filter' => 'editor',
			'offset' => $stepCount,
			'count' => Vk::GROUP_GET_STEP,
		);
		$apiResult = $this->api->run('groups.get', $params);
		foreach($apiResult['items'] as $group)
		{
			$userGroups[$group['id']] = array(
				'id' => $group['id'],
				'name' => $group['name']
			);
		}
		
//			increment step items counter
		if($apiResult['count'] > Vk::GROUP_GET_STEP + $stepCount)
			$stepCount += Vk::GROUP_GET_STEP;
		else
			break;
	}
	
	return $userGroups;
}