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