1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
photogalleryphoto.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Livefeed;
4
5use Bitrix\Iblock\ElementTable;
6use Bitrix\Main\Config\Option;
7use Bitrix\Main\Loader;
8use Bitrix\Main\Localization\Loc;
9use Bitrix\Socialnetwork\LogTable;
10
11Loc::loadMessages(__FILE__);
12
13final class PhotogalleryPhoto extends Provider
14{
15 public const PROVIDER_ID = 'PHOTO_PHOTO';
16 public const CONTENT_TYPE_ID = 'PHOTO_PHOTO';
17
18 protected static $iblockElementClass = ElementTable::class;
19 protected static $logTableClass = LogTable::class;
20 protected static $logClass = \CSocNetLog::class;
21
22 public static function getId(): string
23 {
24 return static::PROVIDER_ID;
25 }
26
27 public function getEventId(): array
28 {
29 return [ 'photo_photo' ];
30 }
31
32 public function getType(): string
33 {
35 }
36
37 public function getCommentProvider(): Provider
38 {
39 return new ForumPost();
40 }
41
42 public function initSourceFields()
43 {
44 static $cache = [];
45
46 $elementId = $this->entityId;
47
48 if ($elementId <= 0)
49 {
50 return;
51 }
52
53 $photoFields = [];
54
55 if (isset($cache[$elementId]))
56 {
57 $photoFields = $cache[$elementId];
58 }
59 elseif (Loader::includeModule('iblock'))
60 {
61 $res = self::$iblockElementClass::getList([
62 'filter' => [
63 '=ID' => $elementId
64 ],
65 'select' => [ 'ID', 'NAME' ]
66 ]);
67 if ($element = $res->fetch())
68 {
69 $logId = false;
70
71 $res = self::$logTableClass::getList([
72 'filter' => [
73 'SOURCE_ID' => $elementId,
74 '@EVENT_ID' => $this->getEventId(),
75 ],
76 'select' => [ 'ID', 'URL' ]
77 ]);
78 if ($logEntryFields = $res->fetch())
79 {
80 $logId = (int)$logEntryFields['ID'];
81 }
82
83 if ($logId)
84 {
85 $res = self::$logClass::getList(
86 [],
87 [
88 '=ID' => $logId
89 ],
90 false,
91 false,
92 [ 'ID', 'EVENT_ID', 'URL' ],
93 [
94 "CHECK_RIGHTS" => "Y",
95 "USE_FOLLOW" => "N",
96 "USE_SUBSCRIBE" => "N"
97 ]
98 );
99 if ($logFields = $res->fetch())
100 {
101 $photoFields = array_merge($element, [
102 'LOG_ID' => $logFields['ID'],
103 'LOG_EVENT_ID' => $logFields['EVENT_ID'],
104 'URL' => $logFields['URL']
105 ]);
106 }
107 }
108 }
109
110 $cache[$elementId] = $photoFields;
111 }
112
113 if (empty($photoFields))
114 {
115 return;
116 }
117
118 $this->setLogId($photoFields['LOG_ID']);
119 $this->setSourceFields($photoFields);
120
121 $title = $photoFields['NAME'];
123 $this->setSourceTitle($title);
124 }
125
126 public function getPinnedTitle(): string
127 {
128 $result = '';
129
130 if (empty($this->sourceFields))
131 {
132 $this->initSourceFields();
133 }
134
135 $photoFields = $this->getSourceFields();
136 if (empty($photoFields))
137 {
138 return $result;
139 }
140
141 return (string)Loc::getMessage('SONET_LIVEFEED_PHOTOGALLERY_PHOTO_PINNED_TITLE', [
142 '#TITLE#' => $photoFields['NAME']
143 ]);
144 }
145
146 public function getPinnedDescription(): string
147 {
148 return '';
149 }
150
151 public static function canRead($params): bool
152 {
153 return true;
154 }
155
156 protected function getPermissions(array $post): string
157 {
158 return self::PERMISSION_READ;
159 }
160
161 public function getLiveFeedUrl()
162 {
163 $pathToPhoto = '';
164
165 if (
166 ($message = $this->getSourceFields())
167 && !empty($message)
168 )
169 {
170 $pathToPhoto = str_replace(
171 "#GROUPS_PATH#",
172 Option::get('socialnetwork', 'workgroups_page', '/workgroups/', $this->getSiteId()),
173 $message['URL']
174 );
175 }
176
177 return $pathToPhoto;
178 }
179}
Определения forumpost.php:22
setSourceFields(array $fields)
Определения provider.php:639
setSourceDescription($description)
Определения provider.php:654
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
$message
Определения payment.php:8
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$post
Определения template.php:8
$title
Определения pdf.php:123