• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/kanban.php
  • Класс: Bitrix\Crm\Kanban
  • Вызов: Kanban::getAdmins
protected function getAdmins(): array
{
	$users = [];

	$userQuery = new \Bitrix\Main\Entity\Query(\Bitrix\Main\UserTable::getEntity());
	// set select
	$userQuery->setSelect([
		'ID',
		'LOGIN',
		'NAME',
		'LAST_NAME',
		'SECOND_NAME',
		'PERSONAL_PHOTO',
	]);
	// set runtime for inner group ID=1 (admins)
	$userQuery->registerRuntimeField(
		null,
		new \Bitrix\Main\Entity\ReferenceField(
			'UG',
			\Bitrix\Main\UserGroupTable::getEntity(),
			[
				'=this.ID' => 'ref.USER_ID',
				'=ref.GROUP_ID' => new \Bitrix\Main\DB\SqlExpression(1),
			],
			[
				'join_type' => 'INNER',
			]
		)
	);
	// set filter
	$date = new \Bitrix\Main\Type\DateTime;
	$userQuery->setFilter([
		'=ACTIVE' => 'Y',
		'!ID' => $this->currentUserId,
		[
			'LOGIC' => 'OR',
			'<=UG.DATE_ACTIVE_FROM' => $date,
			'UG.DATE_ACTIVE_FROM' => false,
		],
		[
			'LOGIC' => 'OR',
			'>=UG.DATE_ACTIVE_TO' => $date,
			'UG.DATE_ACTIVE_TO' => false,
		],
	]);
	$res = $userQuery->exec();
	while ($row = $res->fetch())
	{
		$row = $this->processAvatar($row);
		$users[$row['ID']] = [
			'id' => $row['ID'],
			'name' => \CUser::FormatName($this->getNameTemplate(), $row, true, false),
			'img' => $row['PERSONAL_PHOTO'],
		];
	}

	return $users;
}