Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
fileversion.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\CommentAux
;
4
5
use Bitrix\Disk\Configuration;
6
use
Bitrix\Main\UserTable
;
7
use
Bitrix\Main\Localization\Loc
;
8
use
Bitrix\Main\Loader
;
9
10
Loc::loadMessages
(__FILE__);
11
12
final
class
FileVersion
extends
Base
13
{
14
public
const
TYPE
=
'FILEVERSION'
;
15
public
const
POST_TEXT
=
'commentAuxFileVersion'
;
16
17
public
function
getParamsFromFields
($fields = []): array
18
{
19
$params
= [];
20
21
if
(!empty($fields[
'AUTHOR_ID'
]))
22
{
23
$params
[
'userId'
] = (int)$fields[
'AUTHOR_ID'
];
24
}
25
26
return
$params
;
27
}
28
29
public
function
getText
(): string
30
{
31
static
$userCache = [];
32
33
$params
=
$this->params
;
34
35
$gender =
''
;
36
37
if
(
38
!empty(
$params
[
'userId'
])
39
&& (
int
)
$params
[
'userId'
] > 0
40
)
41
{
42
if
(isset($userCache[(
int
)
$params
[
'userId'
]][
'PERSONAL_GENDER'
]))
43
{
44
$gender = $userCache[(int)
$params
[
'userId'
]][
'PERSONAL_GENDER'
];
45
}
46
else
47
{
48
$res = UserTable::getList([
49
'filter'
=> [
50
'=ID'
=> (
int
)
$params
[
'userId'
],
51
],
52
'select'
=> [
'ID'
,
'PERSONAL_GENDER'
],
53
]);
54
55
if
($user = $res->fetch())
56
{
57
$userCache[$user[
'ID'
]] = $user;
58
$gender = $user[
'PERSONAL_GENDER'
];
59
}
60
}
61
}
62
63
if
(Loader::includeModule(
'disk'
) && !Configuration::isEnabledKeepVersion())
64
{
65
return
Loc::getMessage
(
'SONET_COMMENTAUX_HEAD_FILEVERSION_TEXT'
. (!empty($gender) ?
'_'
. $gender :
''
));
66
}
67
68
return
Loc::getMessage
(
'SONET_COMMENTAUX_FILEVERSION_TEXT'
. (!empty($gender) ?
'_'
. $gender :
''
));
69
}
70
71
protected
function
getRatingNotificationFollowValue
(
int
$userId = 0, array $ratingVoteParams = [], array $fields = [])
72
{
73
return \CSocNetLogFollow::getExactValueByRating(
74
$userId,
75
'BLOG_COMMENT'
,
76
$fields[
'ID'
]
77
);
78
}
79
80
protected
function
getRatingNotificationNotigyTag
(array $ratingVoteParams = [], array $fields = []): string
81
{
82
return
'RATING|'
. ($ratingVoteParams[
'VALUE'
] >= 0 ?
''
:
'DL|'
) .
'BLOG_COMMENT|'
. $fields[
'ID'
];
83
}
84
}
Bitrix\Main\Loader
Definition
loader.php:12
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\UserTable
Definition
user.php:46
Bitrix\Socialnetwork\CommentAux\Base
Definition
base.php:13
Bitrix\Socialnetwork\CommentAux\Base\$params
$params
Definition
base.php:17
Bitrix\Socialnetwork\CommentAux\FileVersion
Definition
fileversion.php:13
Bitrix\Socialnetwork\CommentAux\FileVersion\getParamsFromFields
getParamsFromFields($fields=[])
Definition
fileversion.php:17
Bitrix\Socialnetwork\CommentAux\FileVersion\POST_TEXT
const POST_TEXT
Definition
fileversion.php:15
Bitrix\Socialnetwork\CommentAux\FileVersion\getRatingNotificationFollowValue
getRatingNotificationFollowValue(int $userId=0, array $ratingVoteParams=[], array $fields=[])
Definition
fileversion.php:71
Bitrix\Socialnetwork\CommentAux\FileVersion\getText
getText()
Definition
fileversion.php:29
Bitrix\Socialnetwork\CommentAux\FileVersion\TYPE
const TYPE
Definition
fileversion.php:14
Bitrix\Socialnetwork\CommentAux\FileVersion\getRatingNotificationNotigyTag
getRatingNotificationNotigyTag(array $ratingVoteParams=[], array $fields=[])
Definition
fileversion.php:80
Bitrix\Socialnetwork\CommentAux
Definition
base.php:3
modules
socialnetwork
lib
commentaux
fileversion.php
Создано системой
1.10.0