Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
user.php
1
<?php
2
namespace
Bitrix\Socialnetwork\Livefeed\RenderParts
;
3
4
use
Bitrix\Main\Localization\Loc
;
5
use
Bitrix\Main\Config\Option
;
6
use
Bitrix\Main\ModuleManager
;
7
8
Loc::loadMessages
(__FILE__);
9
10
final
class
User
extends
Base
11
{
12
public
function
getData
($entityId = 0)
13
{
14
static
$userPath =
null
;
15
static
$userNameTemplate =
null
;
16
static
$intranetInstalled =
null
;
17
static
$extranetInstalled =
null
;
18
19
$result = $this->
getMetaResult
();
20
$options
= $this->
getOptions
();
21
22
if
($intranetInstalled ===
null
)
23
{
24
$intranetInstalled = ModuleManager::isModuleInstalled(
"intranet"
);
25
}
26
27
if
($extranetInstalled ===
null
)
28
{
29
$extranetInstalled = ($intranetInstalled && ModuleManager::isModuleInstalled(
"extranet"
));
30
}
31
32
$extranetSite = (
33
isset(
$options
[
'extranetSite'
])
34
?
$options
[
'extranetSite'
]
35
: false
36
);
37
38
if
(intval($entityId) == 0)
39
{
40
$result[
'name'
] = (
41
$intranetInstalled
42
?
Loc::getMessage
(
"SONET_LIVEFEED_RENDERPARTS_USER_ALL"
)
43
:
Loc::getMessage
(
"SONET_LIVEFEED_RENDERPARTS_USER_ALL_BUS"
)
44
);
45
46
if
(
47
(!isset(
$options
[
'mobile'
]) || !
$options
[
'mobile'
])
48
&& (!isset(
$options
[
'im'
]) || !
$options
[
'im'
])
49
&& ($extranetSite != SITE_ID)
50
&& defined(
"BITRIX24_PATH_COMPANY_STRUCTURE_VISUAL"
)
51
)
52
{
53
$result[
'link'
] = BITRIX24_PATH_COMPANY_STRUCTURE_VISUAL;
54
}
55
}
56
elseif (
57
($res = \CUser::getByID($entityId))
58
&& ($fields = $res->fetch())
59
)
60
{
61
$result[
'id'
] = $entityId;
62
63
if
($userNameTemplate ===
null
)
64
{
65
$userNameTemplate = \CSite::getNameFormat();
66
}
67
68
$result[
'name'
] = \CUser::formatName($userNameTemplate, $fields,
true
,
false
);
69
$result[
'type'
] =
''
;
70
if
($fields[
'EXTERNAL_AUTH_ID'
] ==
'email'
)
71
{
72
$result[
'type'
] =
'email'
;
73
}
74
elseif (
75
$extranetInstalled
76
&& isset($fields[
'UF_DEPARTMENT'
])
77
&& empty($fields[
'UF_DEPARTMENT'
])
78
)
79
{
80
$result[
'type'
] =
'extranet'
;
81
}
82
83
if
(
84
empty(
$options
[
'skipLink'
])
85
|| !
$options
[
'skipLink'
]
86
)
87
{
88
if
($userPath ===
null
)
89
{
90
$userPath = (
91
(!isset(
$options
[
'im'
]) || !
$options
[
'im'
])
92
? (
93
(!isset(
$options
[
'mobile'
]) || !
$options
[
'mobile'
])
94
? Option::get(
'socialnetwork'
,
'user_page'
, SITE_DIR.
'company/personal/'
).
'user/#user_id#/'
95
: SITE_DIR.
'mobile/users/?user_id=#user_id#'
96
)
97
:
''
98
);
99
}
100
if
(!empty($userPath))
101
{
102
$result[
'link'
] = \CComponentEngine::makePathFromTemplate(
103
$userPath,
104
array(
105
"user_id"
=> $entityId
106
)
107
);
108
}
109
}
110
}
111
112
return
$result;
113
}
114
}
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Main\ModuleManager
Definition
modulemanager.php:5
Bitrix\Socialnetwork\Livefeed\RenderParts\Base
Definition
base.php:5
Bitrix\Socialnetwork\Livefeed\RenderParts\Base\$options
$options
Definition
base.php:6
Bitrix\Socialnetwork\Livefeed\RenderParts\Base\getOptions
getOptions()
Definition
base.php:13
Bitrix\Socialnetwork\Livefeed\RenderParts\Base\getMetaResult
getMetaResult()
Definition
base.php:18
Bitrix\Socialnetwork\Livefeed\RenderParts\User
Definition
user.php:11
Bitrix\Socialnetwork\Livefeed\RenderParts\User\getData
getData($entityId=0)
Definition
user.php:12
Bitrix\Socialnetwork\Livefeed\RenderParts
Definition
base.php:2
modules
socialnetwork
lib
livefeed
renderparts
user.php
Создано системой
1.10.0