Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
user.php
1<?php
3
7
8Loc::loadMessages(__FILE__);
9
10final 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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29