Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
knowledge.php
1<?php
3
4use \Bitrix\Bitrix24\Feature;
5use \Bitrix\Landing\Site;
6use \Bitrix\Landing\Site\Type;
7
9{
16 public static function isViewAllowed(string $code, array $params): bool
17 {
18 if (!\Bitrix\Main\Loader::includeModule('bitrix24'))
19 {
20 return true;
21 }
22
23 if (Site\Type::getCurrentScopeId() != Type::SCOPE_CODE_KNOWLEDGE)
24 {
25 return true;
26 }
27
28 $availableCount = Feature::getVariable(
29 'landing_site_knowledge'
30 );
31 if ($availableCount)
32 {
33 if (!isset($params['ID']) || $params['ID'] <= 0)
34 {
35 return false;
36 }
37 $allowedSiteIds = [];
38 $res = Site::getList([
39 'select' => [
40 'ID'
41 ],
42 'order' => [
43 'ID' => 'asc'
44 ],
45 'limit' => $availableCount
46 ]);
47 while ($row = $res->fetch())
48 {
49 $allowedSiteIds[] = $row['ID'];
50 }
51 return in_array((int)$params['ID'], $allowedSiteIds);
52 }
53
54 return true;
55 }
56
61 public static function isAllowedInGroup(): bool
62 {
63 if (\Bitrix\Main\Loader::includeModule('bitrix24'))
64 {
65 return Feature::isFeatureEnabled('landing_knowledge_group');
66 }
67
68 return true;
69 }
70}
static isViewAllowed(string $code, array $params)
Definition knowledge.php:16