20 if (!\
Bitrix\Main\Loader::includeModule(
'bitrix24'))
26 $scope = Site\Type::getCurrentScopeId();
28 $scope == Type::SCOPE_CODE_KNOWLEDGE ||
29 $scope == Type::SCOPE_CODE_GROUP
34 $availableCount = Feature::getVariable(
35 'landing_dynamic_blocks'
37 if ($availableCount <= 0)
42 static $dynamicBlocks =
null;
43 $targetBlockId = isset($params[
'targetBlockId'])
44 ? intval($params[
'targetBlockId'])
48 if ($dynamicBlocks ===
null)
55 B.PARENT_ID as PARENT_ID,
56 B.DATE_MODIFY as DATE_MODIFY,
60 ' . Internals\FilterBlockTable::getTableName() .
' FB
62 ' . Internals\BlockTable::getTableName() .
' B
66 ' . Internals\LandingTable::getTableName() .
' L
70 ' . Internals\SiteTable::getTableName() .
' S
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;';
81 while ($row = $res->fetch())
83 $dynamicBlocks[$row[
'ID']] = $row;
86 foreach ($dynamicBlocks as $dynamicBlock)
89 $dynamicBlock[
'PARENT_ID'] &&
90 isset($dynamicBlocks[$dynamicBlock[
'PARENT_ID']])
93 unset($dynamicBlocks[$dynamicBlock[
'PARENT_ID']]);
99 $dynamicBlocks = array_slice($dynamicBlocks, 0, $availableCount,
true);
100 foreach ($dynamicBlocks as $dynamicBlock)
103 $dynamicBlock[
'ID'] == $targetBlockId ||
104 $dynamicBlock[
'PARENT_ID'] == $targetBlockId