Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
toolsmanager.php
1
<?php
2
3
namespace
Bitrix\Bizproc\Integration\Intranet
;
4
5
use Bitrix\Intranet\Settings\Tools;
6
use
Bitrix\Main\Loader
;
7
8
final
class
ToolsManager
9
{
10
private
static
?
ToolsManager
$instance =
null
;
11
private
bool
$canUseIntranetToolsManager;
12
13
private
const
AUTOMATION_TOOL_ID =
'automation'
;
14
private
const
BIZPROC_TOOL_ID =
'bizproc'
;
15
private
const
ROBOTS_TOOL_ID =
'robots'
;
16
private
const
SCRIPTS_TOOL_ID =
'bizproc_script'
;
17
18
public
static
function
getInstance
(): self
19
{
20
if
(self::$instance ===
null
)
21
{
22
self::$instance =
new
self
();
23
}
24
25
return
self::$instance;
26
}
27
28
public
function
__construct
()
29
{
30
$this->canUseIntranetToolsManager = (
31
Loader::includeModule(
'intranet'
)
32
&& class_exists(\
Bitrix
\Intranet\Settings\Tools\ToolsManager::class)
33
);
34
}
35
36
public
function
isAutomationAvailable
(): bool
37
{
38
return
$this->check(self::AUTOMATION_TOOL_ID);
39
}
40
41
public
function
isBizprocAvailable
(): bool
42
{
43
return
$this->check(self::BIZPROC_TOOL_ID) && $this->
isAutomationAvailable
();
44
}
45
46
public
function
isRobotsAvailable
(): bool
47
{
48
return
$this->check(self::ROBOTS_TOOL_ID) && $this->
isAutomationAvailable
();
49
}
50
51
public
function
isScriptsAvailable
(): bool
52
{
53
return
$this->check(self::SCRIPTS_TOOL_ID) && $this->
isAutomationAvailable
();
54
}
55
56
public
function
getBizprocUnavailableContent
()
57
{
58
ob_start();
59
global $APPLICATION;
60
$APPLICATION->IncludeComponent(
61
'bitrix:intranet.tool.inaccessibility'
,
62
''
,
63
[
64
'SLIDER_CODE'
=>
'limit_automation_off'
,
65
],
66
);
67
68
return
ob_get_clean();
69
}
70
71
private
function
check(
string
$toolId): bool
72
{
73
if
($this->canUseIntranetToolsManager)
74
{
75
return
Tools\ToolsManager::getInstance()->checkAvailabilityByToolId($toolId);
76
}
77
78
return
true
;
79
}
80
}
Bitrix\Bizproc\Integration\Intranet\ToolsManager
Definition
toolsmanager.php:9
Bitrix\Bizproc\Integration\Intranet\ToolsManager\isScriptsAvailable
isScriptsAvailable()
Definition
toolsmanager.php:51
Bitrix\Bizproc\Integration\Intranet\ToolsManager\__construct
__construct()
Definition
toolsmanager.php:28
Bitrix\Bizproc\Integration\Intranet\ToolsManager\getBizprocUnavailableContent
getBizprocUnavailableContent()
Definition
toolsmanager.php:56
Bitrix\Bizproc\Integration\Intranet\ToolsManager\isAutomationAvailable
isAutomationAvailable()
Definition
toolsmanager.php:36
Bitrix\Bizproc\Integration\Intranet\ToolsManager\isBizprocAvailable
isBizprocAvailable()
Definition
toolsmanager.php:41
Bitrix\Bizproc\Integration\Intranet\ToolsManager\getInstance
static getInstance()
Definition
toolsmanager.php:18
Bitrix\Bizproc\Integration\Intranet\ToolsManager\isRobotsAvailable
isRobotsAvailable()
Definition
toolsmanager.php:46
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Bizproc\Integration\Intranet
Definition
toolsmanager.php:3
Bitrix
modules
bizproc
lib
integration
intranet
toolsmanager.php
Создано системой
1.10.0