1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
block.php
См. документацию.
1<?php
3
4use \Bitrix\Landing\Site;
5use \Bitrix\Landing\Internals;
6use \Bitrix\Landing\Site\Type;
7use \Bitrix\Bitrix24\Feature;
8use \Bitrix\Main\Application;
9
10class Block
11{
18 public static function isDynamicEnabled(string $code, array $params): bool
19 {
20 if (!\Bitrix\Main\Loader::includeModule('bitrix24'))
21 {
22 return true;
23 }
24
25 // @todo: make more useful in future
27 if (
28 $scope == Type::SCOPE_CODE_KNOWLEDGE ||
29 $scope == Type::SCOPE_CODE_GROUP
30 )
31 {
32 return true;
33 }
34 $availableCount = Feature::getVariable(
35 'landing_dynamic_blocks'
36 );
37 if ($availableCount <= 0)
38 {
39 return true;
40 }
41
42 static $dynamicBlocks = null;
43 $targetBlockId = isset($params['targetBlockId'])
44 ? intval($params['targetBlockId'])
45 : 0;
46
47 // gets actual dynamic blocks
48 if ($dynamicBlocks === null)
49 {
50 $dynamicBlocks = [];
51 // plain sql, reason for this described in task 186683
52 $sql = '
53 SELECT
54 B.ID as ID,
55 B.PARENT_ID as PARENT_ID,
56 B.DATE_MODIFY as DATE_MODIFY,
57 S.ID as SID,
58 L.DELETED
59 FROM
61 LEFT JOIN
63 ON
64 FB.BLOCK_ID = B.ID
65 LEFT JOIN
67 ON
68 B.LID = L.ID
69 LEFT JOIN
71 ON
72 L.SITE_ID = S.ID
73 WHERE
74 B.DELETED = \'N\' AND
75 L.DELETED = \'N\' AND
76 S.DELETED = \'N\' AND
77 S.TYPE NOT IN (\'KNOWLEDGE\', \'GROUP\')
78 GROUP BY B.ID, S.ID, FB.BLOCK_ID, L.DELETED
79 ORDER BY B.DATE_MODIFY ASC;';
80
81 $res = Application::getConnection()->query($sql);
82 while ($row = $res->fetch())
83 {
84 $dynamicBlocks[$row['ID']] = $row;
85 }
86 // remove public blocks
87 foreach ($dynamicBlocks as $dynamicBlock)
88 {
89 if (
90 $dynamicBlock['PARENT_ID'] &&
91 isset($dynamicBlocks[$dynamicBlock['PARENT_ID']])
92 )
93 {
94 unset($dynamicBlocks[$dynamicBlock['PARENT_ID']]);
95 }
96 }
97 }
98
99 // allow only first $availableCount dynamic blocks
100 $dynamicBlocks = array_slice($dynamicBlocks, 0, $availableCount, true);
101 foreach ($dynamicBlocks as $dynamicBlock)
102 {
103 if (
104 $dynamicBlock['ID'] == $targetBlockId ||
105 $dynamicBlock['PARENT_ID'] == $targetBlockId
106 )
107 {
108 return true;
109 }
110 }
111
112 return false;
113 }
114
119 public static function isDesignerAllowed(): bool
120 {
121 if (\Bitrix\Main\Loader::includeModule('bitrix24'))
122 {
123 return Feature::isFeatureEnabled('landing_designerblock');
124 }
125
126 return true;
127 }
128}
static getTableName()
Определения block.php:31
static getTableName()
Определения landing.php:53
static getTableName()
Определения site.php:67
static isDesignerAllowed()
Определения block.php:119
static isDynamicEnabled(string $code, array $params)
Определения block.php:18
static getCurrentScopeId()
Определения type.php:188
</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
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799