1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
intranetnewuser.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Livefeed;
4
5
use Bitrix\Iblock\SectionTable;
6
use Bitrix\Main\Config\Option;
7
use Bitrix\Main\Loader;
8
use Bitrix\Main\Localization\Loc;
9
use Bitrix\Main\ModuleManager;
10
use Bitrix\Main\UserTable;
11
use Bitrix\Socialnetwork\LogTable;
12
13
Loc::loadMessages(__FILE__);
14
15
class
IntranetNewUser
extends
Provider
16
{
17
public
const
PROVIDER_ID
=
'INTRANET_NEW_USER'
;
18
public
const
CONTENT_TYPE_ID
=
'INTRANET_NEW_USER'
;
19
20
public
static
function
getId
(): string
21
{
22
return
static::PROVIDER_ID;
23
}
24
25
public
function
getEventId
():
array
26
{
27
return
[
'intranet_new_user'
];
28
}
29
30
public
function
getType
(): string
31
{
32
return
Provider::TYPE_POST
;
33
}
34
35
public
function
getCommentProvider
(): Provider
36
{
37
return
new
LogComment
();
38
}
39
40
public
function
initSourceFields
()
41
{
42
static
$cache = [];
43
44
$ratingEntityId
= $this->
getEntityId
();
45
46
if
(
$ratingEntityId
<= 0)
47
{
48
return
;
49
}
50
51
$sourceFields
= [];
52
53
if
(isset($cache[
$ratingEntityId
]))
54
{
55
$sourceFields
= $cache[
$ratingEntityId
];
56
}
57
else
58
{
59
$userId
= 0;
60
$bitrix24NewUserProvider =
new
Bitrix24NewUser
();
61
62
$res
=
LogTable::getList
([
63
'filter'
=> [
64
'@EVENT_ID'
=> array_merge($this->
getEventId
(), $bitrix24NewUserProvider->getEventId() ),
65
'=RATING_ENTITY_ID'
=>
$ratingEntityId
66
],
67
'select'
=> [
'ID'
,
'ENTITY_ID'
]
68
]);
69
if
($logEntry =
$res
->fetch())
70
{
71
$userId
= $logEntry[
'ENTITY_ID'
];
72
}
73
74
if
(
$userId
> 0)
75
{
76
$res
= UserTable::getList(
array
(
77
'filter'
=> [
78
'=ID'
=>
$userId
79
],
80
'select'
=> [
81
'NAME'
,
'LAST_NAME'
,
'SECOND_NAME'
,
'LOGIN'
,
'UF_DEPARTMENT'
82
]
83
));
84
if
(
$user
=
$res
->fetch())
85
{
86
$userName
= \CUser::formatName(
87
\CSite::getNameFormat(),
88
$user
,
89
true
,
90
false
91
);
92
$user
[
'FULL_NAME'
] =
$userName
;
93
94
$user
[
'DEPARTMENT_NAME'
] =
''
;
95
if
(
96
is_array(
$user
[
'UF_DEPARTMENT'
])
97
&& !empty(
$user
[
'UF_DEPARTMENT'
])
98
&& Loader::includeModule(
'iblock'
)
99
)
100
{
101
$res
= SectionTable::getList([
102
'filter'
=> [
103
'ID'
=>
$user
[
'UF_DEPARTMENT'
]
104
],
105
'select'
=> [
'ID'
,
'NAME'
]
106
]);
107
if
(
$sectionFields
=
$res
->fetch())
108
{
109
$user
[
'DEPARTMENT_NAME'
] =
$sectionFields
[
'NAME'
];
110
}
111
}
112
113
$sourceFields
= array_merge(
$user
, [
'LOG_ENTRY'
=> $logEntry ]);
114
$cache[
$ratingEntityId
] =
$sourceFields
;
115
}
116
}
117
}
118
119
if
(empty(
$sourceFields
))
120
{
121
return
;
122
}
123
124
$this->
setLogId
(
$sourceFields
[
'LOG_ENTRY'
][
'ID'
]);
125
$this->
setSourceFields
(
$sourceFields
);
126
$this->
setSourceTitle
(Loc::getMessage(
'SONET_LIVEFEED_INTRANET_NEW_USER_TITLE'
, [
127
'#USER_NAME#'
=>
$sourceFields
[
'FULL_NAME'
]
128
]));
129
}
130
131
public
function
getPinnedTitle
(): string
132
{
133
$result
=
''
;
134
135
if
(ModuleManager::isModuleInstalled(
'bitrix24'
))
136
{
137
$result
= Option::get(
'main'
,
'site_name'
);
138
}
139
else
140
{
141
if
(empty($this->sourceFields))
142
{
143
$this->
initSourceFields
();
144
}
145
146
$sourceFields
= $this->
getSourceFields
();
147
if
(empty(
$sourceFields
))
148
{
149
return
$result
;
150
}
151
152
$result
=
$sourceFields
[
'DEPARTMENT_NAME'
];
153
}
154
155
return
$result
;
156
}
157
158
public
function
getPinnedDescription
()
159
{
160
$result
=
''
;
161
162
if
(empty($this->sourceFields))
163
{
164
$this->
initSourceFields
();
165
}
166
167
$sourceFields
= $this->
getSourceFields
();
168
if
(empty(
$sourceFields
))
169
{
170
return
$result
;
171
}
172
173
return
Loc::getMessage(
'SONET_LIVEFEED_INTRANET_NEW_USER_PINNED_DESCRIPTION'
, [
174
'#USER_NAME#'
=>
$sourceFields
[
'FULL_NAME'
]
175
]);
176
}
177
178
public
static
function
canRead
(
$params
): bool
179
{
180
return
true
;
181
}
182
183
protected
function
getPermissions
(
array
$post
): string
184
{
185
return
self::PERMISSION_READ;
186
}
187
188
public
function
getLiveFeedUrl
(): string
189
{
190
$pathToLogEntry =
''
;
191
192
$logId
= $this->
getLogId
();
193
if
(
$logId
)
194
{
195
$pathToLogEntry = Option::get(
'socialnetwork'
,
'log_entry_page'
,
''
, $this->
getSiteId
());
196
if
(!empty($pathToLogEntry))
197
{
198
$pathToLogEntry =
\CComponentEngine::makePathFromTemplate
($pathToLogEntry,
array
(
"log_id"
=>
$logId
));
199
}
200
}
201
202
return
$pathToLogEntry;
203
}
204
}
$sectionFields
if($strVal !='') $sectionFields
Определения
options.php:1848
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Socialnetwork\Livefeed\Bitrix24NewUser
Определения
bitrix24newuser.php:10
Bitrix\Socialnetwork\Livefeed\IntranetNewUser
Определения
intranetnewuser.php:16
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\initSourceFields
initSourceFields()
Определения
intranetnewuser.php:40
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getCommentProvider
getCommentProvider()
Определения
intranetnewuser.php:35
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\CONTENT_TYPE_ID
const CONTENT_TYPE_ID
Определения
intranetnewuser.php:18
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getPinnedTitle
getPinnedTitle()
Определения
intranetnewuser.php:131
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getPermissions
getPermissions(array $post)
Определения
intranetnewuser.php:183
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getType
getType()
Определения
intranetnewuser.php:30
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getLiveFeedUrl
getLiveFeedUrl()
Определения
intranetnewuser.php:188
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getEventId
getEventId()
Определения
intranetnewuser.php:25
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\canRead
static canRead($params)
Определения
intranetnewuser.php:178
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getId
static getId()
Определения
intranetnewuser.php:20
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\PROVIDER_ID
const PROVIDER_ID
Определения
intranetnewuser.php:17
Bitrix\Socialnetwork\Livefeed\IntranetNewUser\getPinnedDescription
getPinnedDescription()
Определения
intranetnewuser.php:158
Bitrix\Socialnetwork\Livefeed\LogComment
Определения
logcomment.php:9
Bitrix\Socialnetwork\Livefeed\Provider\getEntityId
getEntityId()
Определения
provider.php:619
Bitrix\Socialnetwork\Livefeed\Provider\setLogId
setLogId($logId)
Определения
provider.php:624
Bitrix\Socialnetwork\Livefeed\Provider\$logId
$logId
Определения
provider.php:55
Bitrix\Socialnetwork\Livefeed\Provider\setSourceFields
setSourceFields(array $fields)
Определения
provider.php:639
Bitrix\Socialnetwork\Livefeed\Provider\setSourceTitle
setSourceTitle($title)
Определения
provider.php:677
Bitrix\Socialnetwork\Livefeed\Provider\getSiteId
getSiteId()
Определения
provider.php:97
Bitrix\Socialnetwork\Livefeed\Provider\$sourceFields
$sourceFields
Определения
provider.php:56
Bitrix\Socialnetwork\Livefeed\Provider\getSourceFields
getSourceFields()
Определения
provider.php:649
Bitrix\Socialnetwork\Livefeed\Provider\TYPE_POST
const TYPE_POST
Определения
provider.php:25
Bitrix\Socialnetwork\Livefeed\Provider\getLogId
getLogId($params=[])
Определения
provider.php:336
Bitrix\Socialnetwork\Livefeed\Provider\$ratingEntityId
int null $ratingEntityId
Определения
provider.php:60
CComponentEngine\makePathFromTemplate
static makePathFromTemplate($template, $arParams=array())
Определения
component_engine.php:355
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$res
$res
Определения
filter_act.php:7
$result
$result
Определения
get_property_values.php:14
Bitrix\Main\$user
$user
Определения
mysql_to_pgsql.php:33
$userName
else $userName
Определения
order_form.php:75
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$post
$post
Определения
template.php:8
bitrix
modules
socialnetwork
lib
livefeed
intranetnewuser.php
Создано системой
1.14.0