3namespace Bitrix\Im\V2\Recent\Initializer\Source;
5use Bitrix\Im\Model\RelationTable;
7use Bitrix\Im\V2\Recent\Initializer\BaseSource;
8use Bitrix\Im\V2\Recent\Initializer\InitialiazerResult;
9use Bitrix\Im\V2\Recent\Initializer\SourceType;
10use Bitrix\Im\V2\Recent\Initializer\Stage;
11use Bitrix\Im\V2\Recent\Initializer\StageType;
12use Bitrix\Main\ORM\Fields\Relations\Reference;
13use Bitrix\Main\ORM\Query\Join;
14use Bitrix\Main\ORM\Query\Query;
20 $lastUserId = (int)$pointer;
22 $query = RelationTable::query()
24 ->setSelect([self::USER_ID_FIELD_NAME =>
'OTHER.USER_ID'])
25 ->where(
'USER_ID', $this->targetId)
26 ->where(
'MESSAGE_TYPE', Chat::IM_TYPE_COLLAB)
27 ->registerRuntimeField($this->getSelfJoin())
28 ->whereNotNull(
'OTHER.USER.LAST_ACTIVITY_DATE')
30 ->setOrder([self::USER_ID_FIELD_NAME =>
'DESC'])
35 $query->where(self::USER_ID_FIELD_NAME,
'<', $lastUserId);
41 public static function getType(): SourceType
43 return SourceType::Collabs;
48 $selectedItemsCount =
count($raw);
51 $hasNextStep = $selectedItemsCount >= $limit;
53 foreach ($raw as $row)
55 $userId = (int)($row[self::USER_ID_FIELD_NAME] ?? 0);
57 if (
$userId < $nextId || $nextId ===
null)
65 ->setNextPointer((
string)$nextId)
66 ->setHasNextStep($hasNextStep)
67 ->setSelectedItemsCount($selectedItemsCount)
76 Join::on(
'this.CHAT_ID',
'ref.CHAT_ID')
77 ->whereColumn(
'this.USER_ID',
'!=',
'ref.USER_ID')
78 ->where(
'this.MESSAGE_TYPE', Chat::IM_TYPE_COLLAB)
79 ->where(
'ref.MESSAGE_TYPE', Chat::IM_TYPE_COLLAB)
80 ->where(
'this.USER_ID', $this->targetId),
81 [
'join_type' => Join::TYPE_INNER]
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
getBaseQuery(string $pointer, int $limit)
getResultByRaw(array $raw, int $limit)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"