• Модуль: rpa
  • Путь к файлу: ~/bitrix/modules/rpa/lib/components/base.php
  • Класс: BitrixRpaComponentsBase
  • Вызов: Base::getUsers
static function getUsers(array $userIds): array
{
	$users = [];
	$currentUserId = Driver::getInstance()->getUserId();
	if($currentUserId > 0)
	{
		$userIds[] = $currentUserId;
	}
	if(empty($userIds))
	{
		return $users;
	}

	$nameFormat = Application::getInstance()->getContext()->getCulture()->getNameFormat();
	$converter = Converter::toJson();
	$urlManager = Driver::getInstance()->getUrlManager();

	$userList = UserTable::getList([
		'select' => [
			'ID', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'TITLE', 'PERSONAL_PHOTO', 'WORK_POSITION'
		], 'filter' => [
			'=ID' => $userIds,
		],
	]);
	while($user = $userList->fetch())
	{
		$userId = (int) $user['ID'];
		$user['FULL_NAME'] = CUser::FormatName($nameFormat, $user, false, false);
		$user['LINK'] = $urlManager->getUserPersonalUrl($userId);
		if($user['PERSONAL_PHOTO'] > 0)
		{
			$photo = CFile::ResizeImageGet($user['PERSONAL_PHOTO'], [
				'width' => 63,
				'height' => 63,
			], BX_RESIZE_IMAGE_EXACT, true, false, true);
			if($photo)
			{
				$user['PHOTO'] = $photo['src'];
			}
		}
		unset($user['PERSONAL_PHOTO']);
		$users[$userId] = $converter->process($user);
	}

	return $users;
}