Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
fileversion.php
1<?php
2
4
5use Bitrix\Disk\Configuration;
9
10Loc::loadMessages(__FILE__);
11
12final 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
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}
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
getRatingNotificationFollowValue(int $userId=0, array $ratingVoteParams=[], array $fields=[])
getRatingNotificationNotigyTag(array $ratingVoteParams=[], array $fields=[])