Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
ReplayedMessageCollection.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Message\Reply
;
4
5
use
Bitrix\Im\V2\Entity\File\FilePopupItem
;
6
use
Bitrix\Im\V2\Entity\User\UserPopupItem
;
7
use
Bitrix\Im\V2\Link\Reminder\ReminderPopupItem
;
8
use
Bitrix\Im\V2\MessageCollection
;
9
use
Bitrix\Im\V2\Message\Params
;
10
use
Bitrix\Im\V2\Rest\PopupData
;
11
12
class
ReplayedMessageCollection
extends
MessageCollection
13
{
14
public
static
function
createByMessageCollection
(
MessageCollection
$collection): self
15
{
16
$instance =
new
self
();
17
18
$replyIdList = $instance->getReplyIdList($collection);
19
if
(!empty($replyIdList))
20
{
21
$instance->load($replyIdList);
22
}
23
24
return
$instance;
25
}
26
27
public
function
getPopupData
(array $excludedList = []):
PopupData
28
{
29
return
new
PopupData
([
30
new
UserPopupItem
($this->
getUserIds
()),
31
new
FilePopupItem
($this->
getFiles
()),
32
new
ReminderPopupItem
($this->
getReminders
())
33
], $excludedList);
34
}
35
36
private
function
getReplyIdList(
MessageCollection
$messageCollection): array
37
{
38
$messageCollection->
fillParams
();
39
$result = [];
40
foreach
($messageCollection as $message)
41
{
42
if
($message->getParams()->isSet(
Params::REPLY_ID
))
43
{
44
$result[] = $message->getParams()->get(
Params::REPLY_ID
)->getValue();
45
}
46
}
47
48
return
$result;
49
}
50
51
}
Bitrix\Im\V2\Entity\File\FilePopupItem
Definition
FilePopupItem.php:10
Bitrix\Im\V2\Entity\User\UserPopupItem
Definition
UserPopupItem.php:8
Bitrix\Im\V2\Link\Reminder\ReminderPopupItem
Definition
ReminderPopupItem.php:8
Bitrix\Im\V2\Message\Params
Definition
Params.php:22
Bitrix\Im\V2\Message\Params\REPLY_ID
const REPLY_ID
Definition
Params.php:68
Bitrix\Im\V2\Message\Reply\ReplayedMessageCollection
Definition
ReplayedMessageCollection.php:13
Bitrix\Im\V2\Message\Reply\ReplayedMessageCollection\getPopupData
getPopupData(array $excludedList=[])
Definition
ReplayedMessageCollection.php:27
Bitrix\Im\V2\Message\Reply\ReplayedMessageCollection\createByMessageCollection
static createByMessageCollection(MessageCollection $collection)
Definition
ReplayedMessageCollection.php:14
Bitrix\Im\V2\MessageCollection
Definition
MessageCollection.php:35
Bitrix\Im\V2\MessageCollection\getUserIds
getUserIds()
Definition
MessageCollection.php:439
Bitrix\Im\V2\MessageCollection\getFiles
getFiles()
Definition
MessageCollection.php:421
Bitrix\Im\V2\MessageCollection\fillParams
fillParams()
Definition
MessageCollection.php:209
Bitrix\Im\V2\MessageCollection\getReminders
getReminders()
Definition
MessageCollection.php:474
Bitrix\Im\V2\Rest\PopupData
Definition
PopupData.php:6
Bitrix\Im\V2\Message\Reply
Definition
ReplayedMessageCollection.php:3
modules
im
lib
V2
Message
Reply
ReplayedMessageCollection.php
Создано системой
1.10.0