3declare(strict_types=1);
5namespace Bitrix\Im\V2\Relation\Provider;
7use Bitrix\Im\Model\RelationTable;
9use Bitrix\Im\V2\Common\ContextCustomer;
10use Bitrix\Im\V2\Relation;
11use Bitrix\Im\V2\RelationCollection;
12use Bitrix\Main\ORM\Fields\ExpressionField;
13use Bitrix\Main\ORM\Fields\IntegerField;
14use Bitrix\Main\ORM\Query\Query;
21 Chat::ROLE_OWNER => 1,
22 Chat::ROLE_MANAGER => 2,
23 Chat::ROLE_MEMBER => 3,
35 $query = RelationTable::query()
37 ->where(
'CHAT_ID', (
int)$this->chat->getId())
38 ->where(
'IS_HIDDEN',
false)
39 ->where(
'USER.ACTIVE',
true)
40 ->setOrder([
'ROLE_PRIORITY',
'ID'])
54 ->filter(
static fn (
Relation $relation) => !$relation->isHidden())
70 $chatAuthorId = (int)$this->chat->getAuthorId();
71 $ownerRole = Chat::ROLE_OWNER;
72 $managerRole = Chat::ROLE_MANAGER;
73 $memberRole = Chat::ROLE_MEMBER;
74 $rolePriorityMap = self::ROLE_PRIORITY_MAP;
79 WHEN %s = {$chatAuthorId} THEN '{$ownerRole}'
80 WHEN %s = 'Y' THEN '{$managerRole}'
83 [
'USER_ID',
'MANAGER']
85 $query->registerRuntimeField(
'ROLE', $roleField);
90 WHEN %s = '{$ownerRole}' THEN {$rolePriorityMap[$ownerRole]}
91 WHEN %s = '{$managerRole}' THEN {$rolePriorityMap[$managerRole]}
92 ELSE {$rolePriorityMap[$memberRole]}
96 $rolePriorityField->configureValueType(IntegerField::class);
97 $query->registerRuntimeField($rolePriorityField);
102 $rolePriority = self::ROLE_PRIORITY_MAP[$cursor->role];
105 ->where(
'ROLE_PRIORITY',
'>', $rolePriority)
108 ->where(
'ROLE_PRIORITY', $rolePriority)
109 ->where(
'ID',
'>', $cursor->relationId)
applyCursor(Query $query, RelationCursor $cursor)
getMembers(?int $limit=50, ?RelationCursor $cursor=null)
defineRoles(Query $query)
prepareQuery(Query $query, ?RelationCursor $cursor)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)