Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
settings.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Integration\Intranet
;
4
5
use Bitrix\Intranet\Settings\Tools\ToolsManager;
6
use
Bitrix\Main\Loader
;
7
8
final
class
Settings
9
{
10
public
const
LIMIT_CODES
= [
11
'workgroups'
=>
'limit_groups_off'
,
12
'projects'
=>
'limit_projects_off'
,
13
'scrum'
=>
'limit_tasks_scrum_off'
,
14
];
15
16
public
const
TASKS_TOOLS
= [
17
'base_tasks'
=>
'base_tasks'
,
18
'projects'
=>
'projects'
,
19
'scrum'
=>
'scrum'
,
20
'departments'
=>
'departments'
,
21
'effective'
=>
'effective'
,
22
'employee_plan'
=>
'employee_plan'
,
23
'report'
=>
'report'
,
24
];
25
26
public
const
SONET_TOOLS
= [
27
'news'
=>
'news'
,
28
'workgroups'
=>
'workgroups'
,
29
];
30
31
public
const
CALENDAR_TOOLS
= [
32
'calendar'
=>
'calendar'
,
33
];
34
35
private
function
isAvailable(): bool
36
{
37
return
Loader::includeModule(
'intranet'
) && class_exists(ToolsManager::class);
38
}
39
40
public
function
isGroupAvailableByType
(
bool
$isProject,
bool
$isScrum): bool
41
{
42
return
$this->
isToolAvailable
($this->getToolIdByType($isProject, $isScrum));
43
}
44
45
private
function
getToolIdByType(
bool
$isProject,
bool
$isScrum): string
46
{
47
if
($isScrum)
48
{
49
$toolId = self::TASKS_TOOLS[
'scrum'
];
50
}
51
elseif ($isProject)
52
{
53
$toolId = self::TASKS_TOOLS[
'projects'
];
54
}
55
else
56
{
57
$toolId = self::SONET_TOOLS[
'workgroups'
];
58
}
59
60
return
$toolId;
61
}
62
63
public
function
getGroupLimitCodeByType
(
bool
$isProject,
bool
$isScrum): ?string
64
{
65
return
self::LIMIT_CODES[$this->getToolIdByType($isProject, $isScrum)] ??
null
;
66
}
67
68
public
function
isToolAvailable
(
string
$tool): bool
69
{
70
$tools = array_merge(self::TASKS_TOOLS, self::SONET_TOOLS, self::CALENDAR_TOOLS);
71
if
(!$this->isAvailable() || !array_key_exists($tool, $tools))
72
{
73
return
true
;
74
}
75
76
return
ToolsManager::getInstance()->checkAvailabilityByToolId($tool);
77
}
78
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Socialnetwork\Integration\Intranet\Settings
Definition
settings.php:9
Bitrix\Socialnetwork\Integration\Intranet\Settings\getGroupLimitCodeByType
getGroupLimitCodeByType(bool $isProject, bool $isScrum)
Definition
settings.php:63
Bitrix\Socialnetwork\Integration\Intranet\Settings\LIMIT_CODES
const LIMIT_CODES
Definition
settings.php:10
Bitrix\Socialnetwork\Integration\Intranet\Settings\isGroupAvailableByType
isGroupAvailableByType(bool $isProject, bool $isScrum)
Definition
settings.php:40
Bitrix\Socialnetwork\Integration\Intranet\Settings\isToolAvailable
isToolAvailable(string $tool)
Definition
settings.php:68
Bitrix\Socialnetwork\Integration\Intranet\Settings\SONET_TOOLS
const SONET_TOOLS
Definition
settings.php:26
Bitrix\Socialnetwork\Integration\Intranet\Settings\TASKS_TOOLS
const TASKS_TOOLS
Definition
settings.php:16
Bitrix\Socialnetwork\Integration\Intranet\Settings\CALENDAR_TOOLS
const CALENDAR_TOOLS
Definition
settings.php:31
Bitrix\Socialnetwork\Integration\Intranet
modules
socialnetwork
lib
integration
intranet
settings.php
Создано системой
1.10.0