Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userdatafilter.php
1
<?php
2
namespace
Bitrix\Im\Integration\UI\EntitySelector
;
3
4
use
Bitrix\Im\User
;
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\UI\EntitySelector\BaseFilter
;
7
use
Bitrix\UI\EntitySelector\Dialog
;
8
use
Bitrix\UI\EntitySelector\Item
;
9
10
class
UserDataFilter
extends
BaseFilter
11
{
12
public
function
__construct
()
13
{
14
parent::__construct();
15
}
16
17
public
function
isAvailable
(): bool
18
{
19
return
$GLOBALS
[
'USER'
]->isAuthorized();
20
}
21
22
public
function
apply
(array $items,
Dialog
$dialog): void
23
{
24
foreach
($items as $item)
25
{
26
if
(!($item instanceof
Item
))
27
{
28
continue
;
29
}
30
31
if
($item->getId() ===
Helper
\User::getCurrentUserId())
32
{
33
$item->addBadges([[
34
'id'
=>
'IT_IS_YOU'
,
35
'title'
=>
Loc::getMessage
(
'IM_UI_ENTITY_SELECTOR_IT_IS_YOU'
),
36
]]);
37
}
38
39
$customData = $item->getCustomData();
40
$userInfo =
User::getInstance
($item->getId())->getArray();
41
$customData->set(
'imUser'
, $userInfo);
42
43
//TODO delete after immobile chatselector fix with revision 21c5a9948579
44
$defaultIcon =
''
;
45
if
(!$item->getAvatar())
46
{
47
$item->setAvatar($defaultIcon);
48
}
49
}
50
}
51
}
Bitrix\Im\Integration\UI\EntitySelector\UserDataFilter
Definition
userdatafilter.php:11
Bitrix\Im\Integration\UI\EntitySelector\UserDataFilter\__construct
__construct()
Definition
userdatafilter.php:12
Bitrix\Im\Integration\UI\EntitySelector\UserDataFilter\apply
apply(array $items, Dialog $dialog)
Definition
userdatafilter.php:22
Bitrix\Im\Integration\UI\EntitySelector\UserDataFilter\isAvailable
isAvailable()
Definition
userdatafilter.php:17
Bitrix\Im\User
Definition
user.php:10
Bitrix\Im\User\getInstance
static getInstance($userId=null)
Definition
user.php:44
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ORM\Query\Filter\Helper
Definition
helper.php:20
Bitrix\UI\EntitySelector\BaseFilter
Definition
basefilter.php:5
Bitrix\UI\EntitySelector\Dialog
Definition
dialog.php:10
Bitrix\UI\EntitySelector\Item
Definition
item.php:8
Bitrix\Im\Integration\UI\EntitySelector
Definition
botprovider.php:2
Bitrix\Main\$GLOBALS
$GLOBALS['____1444769544']
Definition
license.php:1
modules
im
lib
integration
ui
entityselector
userdatafilter.php
Создано системой
1.10.0