1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
livefeed.php
См. документацию.
1<?php
2namespace Bitrix\Landing\Note\Source;
3
4use \Bitrix\Forum\MessageTable;
5use \Bitrix\Socialnetwork\Livefeed as SonetLivefeed;
6
7class LiveFeed extends Entity
8{
14 public static function getData(int $sourceId): ?array
15 {
16 if (
17 \Bitrix\Main\Loader::includeModule('socialnetwork') &&
18 \Bitrix\Main\Loader::includeModule('forum')
19 )
20 {
21 $provider = SonetLivefeed\Provider::init([
22 'ENTITY_TYPE' => 'FORUM_POST',
23 'ENTITY_ID' => $sourceId,
24 'CLONE_DISK_OBJECTS' => false
25 ]);
26 if (!$provider || !$provider->getSourceTitle())
27 {
28 return null;
29 }
30 $res = MessageTable::getList([
31 'select' => [
32 'POST_MESSAGE',
33 'TOPIC_TITLE' => 'TOPIC.TITLE'
34 ],
35 'filter' => [
36 'ID' => $sourceId,
37 '=APPROVED' => 'Y'
38 ],
39 'limit' => 1
40 ]);
41 if ($comment = $res->fetch())
42 {
43 $title = $provider->getSourceTitle();
44 $title = preg_replace('/\[[^\]]+\]/is', '', $title);
45 $params = [];
46 $blocks = [[
47 'type' => 'header',
48 'content' => $title
49 ]];
50 if (\Bitrix\Main\Loader::includeModule('disk'))
51 {
52 $params = [
53 'files' => self::getDiskFiles(
54 $sourceId,
55 \Bitrix\Disk\Uf\ForumMessageConnector::class,
56 'forum'
57 )
58 ];
59 }
60 $blocks = array_merge(
61 $blocks,
62 Parser::textToBlocks($comment['POST_MESSAGE'], $params)
63 );
64 return [
65 'TITLE' => \truncateText($title, self::TITLE_LENGTH),
66 'BLOCKS' => $blocks
67 ];
68 }
69 }
70
71 return null;
72 }
73}
if(!Loader::includeModule('messageservice')) $provider
Определения callback_ednaruimhpx.php:21
static getDiskFiles(int $sourceId, string $entityType, string $module)
Определения entity.php:18
static getData(int $sourceId)
Определения livefeed.php:14
static textToBlocks(string $text, array $params=[])
Определения parser.php:212
</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
$comment
Определения template.php:15
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$title
Определения pdf.php:123