Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
toolavailabilitymanager.php
1<?php
2
4
5use Bitrix\Intranet\Settings\Tools\ToolsManager;
7
8
10{
11 private bool $canUseIntranetToolsManager;
12
13 public function __construct()
14 {
15 $this->canUseIntranetToolsManager = (
16 Loader::includeModule('intranet')
17 && class_exists('\Bitrix\Intranet\Settings\Tools\ToolsManager')
18 );
19 }
20
21 public static function getInstance(): self
22 {
23 return new self();
24 }
25
26 public function check(string $toolId): bool
27 {
28 if ($this->canUseIntranetToolsManager)
29 {
30 return ToolsManager::getInstance()->checkAvailabilityByToolId($toolId);
31 }
32
33 return true;
34 }
35
36 public function getStubComponentContent(string $sliderCode): string
37 {
38 $params = [];
39
40 if (!empty($sliderCode))
41 {
42 $params['SLIDER_CODE'] = $sliderCode;
43 }
44
45 ob_start();
46 global $APPLICATION;
47 $APPLICATION->IncludeComponent(
48 'bitrix:intranet.tool.inaccessibility',
49 '',
50 $params,
51 null,
52 ['HIDE_ICONS' => 'Y'],
53 );
54
55 return ob_get_clean();
56 }
57}