Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
user.php
1
<?php
2
namespace
Bitrix\Im\Integration\UI\EntitySelector\Helper
;
3
4
use Bitrix\Main\EO_User;
5
6
class
User
7
{
8
public
static
function
formatName
(EO_User $user, array $options = []): string
9
{
10
return \CUser::formatName(
11
!empty($options[
'nameTemplate'
])
12
? $options[
'nameTemplate'
]
13
: \CSite::getNameFormat(
false
),
14
[
15
'NAME'
=> $user->getName(),
16
'LAST_NAME'
=> $user->getLastName(),
17
'SECOND_NAME'
=> $user->getSecondName(),
18
'LOGIN'
=> $user[
'LOGIN'
],
19
'EMAIL'
=> $user[
'EMAIL'
],
20
'TITLE'
=> $user[
'TITLE'
],
21
],
22
true
,
23
false
24
);
25
}
26
27
public
static
function
makeAvatar
(EO_User $user): ?string
28
{
29
if
(empty($user->getPersonalPhoto()))
30
{
31
return
null
;
32
}
33
34
$avatar = \CFile::resizeImageGet(
35
$user->getPersonalPhoto(),
36
[
'width'
=> 100,
'height'
=> 100],
37
BX_RESIZE_IMAGE_EXACT,
38
false
39
);
40
41
return
!empty($avatar[
'src'
]) ? $avatar[
'src'
] :
null
;
42
}
43
44
public
static
function
getCurrentUserId
(): int
45
{
46
return
is_object(
$GLOBALS
[
'USER'
]) ? (int)
$GLOBALS
[
'USER'
]->getId() : 0;
47
}
48
}
Bitrix\Im\Integration\UI\EntitySelector\Helper\User
Definition
user.php:7
Bitrix\Im\Integration\UI\EntitySelector\Helper\User\getCurrentUserId
static getCurrentUserId()
Definition
user.php:44
Bitrix\Im\Integration\UI\EntitySelector\Helper\User\makeAvatar
static makeAvatar(EO_User $user)
Definition
user.php:27
Bitrix\Im\Integration\UI\EntitySelector\Helper\User\formatName
static formatName(EO_User $user, array $options=[])
Definition
user.php:8
Bitrix\Im\Integration\UI\EntitySelector\Helper
Definition
chat.php:3
Bitrix\Main\$GLOBALS
$GLOBALS['____1444769544']
Definition
license.php:1
modules
im
lib
integration
ui
entityselector
helper
user.php
Создано системой
1.10.0