1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
TargetUserStage.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Recent\Initializer\Stage;
4
5use Bitrix\Im\Model\RecentTable;
6use Bitrix\Im\V2\Entity\User\User;
7use Bitrix\Im\V2\Recent\Initializer\BaseStage;
8use Bitrix\Im\V2\Recent\Initializer\InitialiazerResult;
9use Bitrix\Im\V2\Recent\Initializer\StageType;
10use Bitrix\Main\Type\DateTime;
11
13{
14 public static function getType(): StageType
15 {
16 return StageType::Target;
17 }
18
19 protected function getPullRecipients(array $items): array
20 {
21 return [$this->targetId];
22 }
23
24 protected function getPullParams(array $items): array
25 {
26 $date = $this->getCurrentDate();
27 $result = ['items' => []];
28 foreach ($items as $item)
29 {
30 $userId = $item['ITEM_ID'];
31 $result['items'][] = [
32 'user' => User::getInstance($userId)->toRestFormat(['WITHOUT_ONLINE' => true]),
33 'date' => $date,
34 ];
35 }
36
37 return $result;
38 }
39
40 protected function getUsersWithExistingItems(array $users): array
41 {
42 if (empty($users))
43 {
44 return [];
45 }
46
47 $result = [];
48 $raw = RecentTable::query()
49 ->setSelect(['ITEM_ID'])
50 ->where('USER_ID', $this->targetId)
51 ->where('ITEM_TYPE', 'P')
52 ->whereIn('ITEM_ID', $users)
53 ->fetchAll()
54 ;
55
56 foreach ($raw as $row)
57 {
58 $id = (int)($row['ITEM_ID'] ?? 0);
59 $result[$id] = $id;
60 }
61
62 return $result;
63 }
64
65 protected function getItemByTargetAndUser(int $targetUserId, int $otherUserId): array
66 {
67 return $this->getItem($targetUserId, $otherUserId);
68 }
69
70 protected function hasNextStep(InitialiazerResult $result): bool
71 {
72 return false;
73 }
74}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getInstance($userId=null)
Определения user.php:45
getItem(int $userId, int $itemId)
Определения BaseStage.php:118
hasNextStep(InitialiazerResult $result)
Определения TargetUserStage.php:70
getItemByTargetAndUser(int $targetUserId, int $otherUserId)
Определения TargetUserStage.php:65
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$items
Определения template.php:224