1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
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
use Bitrix\Socialnetwork\Item\Workgroup\Type;
8
9
final
class
Settings
10
{
11
public
const
LIMIT_CODES
= [
12
'workgroups'
=>
'limit_groups_off'
,
13
'projects'
=>
'limit_projects_off'
,
14
'scrum'
=>
'limit_tasks_scrum_off'
,
15
'collab'
=>
'limit_v2_socialnetwork_collab_off'
,
16
];
17
18
public
const
LIMIT_FEATURES
= [
19
'collab'
=>
'socialnetwork_collab_off'
,
20
];
21
22
public
const
TASKS_TOOLS
= [
23
'base_tasks'
=>
'base_tasks'
,
24
'projects'
=>
'projects'
,
25
'scrum'
=>
'scrum'
,
26
'departments'
=>
'departments'
,
27
'effective'
=>
'effective'
,
28
'employee_plan'
=>
'employee_plan'
,
29
'report'
=>
'report'
,
30
];
31
32
public
const
SONET_TOOLS
= [
33
'news'
=>
'news'
,
34
'workgroups'
=>
'workgroups'
,
35
'collab'
=>
'collab'
,
36
];
37
38
public
const
CALENDAR_TOOLS
= [
39
'calendar'
=>
'calendar'
,
40
];
41
42
private
function
isAvailable(): bool
43
{
44
return
Loader::includeModule(
'intranet'
) && class_exists(ToolsManager::class);
45
}
46
47
public
function
isGroupAvailableByType
(
Type
$type
): bool
48
{
49
return
$this->
isToolAvailable
($this->getToolIdByGroupType(
$type
));
50
}
51
52
private
function
getToolIdByGroupType(
Type
$type
): string
53
{
54
return
match (
$type
)
55
{
56
Type::Scrum => self::TASKS_TOOLS[
'scrum'
],
57
Type::Project => self::TASKS_TOOLS[
'projects'
],
58
Type::Collab => self::SONET_TOOLS[
'collab'
],
59
default
=> self::SONET_TOOLS[
'workgroups'
],
60
};
61
}
62
63
public
function
getGroupLimitCodeByType
(
Type
$type
): ?string
64
{
65
return
self::LIMIT_CODES[$this->getToolIdByGroupType(
$type
)] ??
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
}
$type
$type
Определения
options.php:106
Bitrix\Socialnetwork\Integration\Intranet\Settings
Определения
settings.php:10
Bitrix\Socialnetwork\Integration\Intranet\Settings\LIMIT_CODES
const LIMIT_CODES
Определения
settings.php:11
Bitrix\Socialnetwork\Integration\Intranet\Settings\LIMIT_FEATURES
const LIMIT_FEATURES
Определения
settings.php:18
Bitrix\Socialnetwork\Integration\Intranet\Settings\isToolAvailable
isToolAvailable(string $tool)
Определения
settings.php:68
Bitrix\Socialnetwork\Integration\Intranet\Settings\SONET_TOOLS
const SONET_TOOLS
Определения
settings.php:32
Bitrix\Socialnetwork\Integration\Intranet\Settings\TASKS_TOOLS
const TASKS_TOOLS
Определения
settings.php:22
Bitrix\Socialnetwork\Integration\Intranet\Settings\CALENDAR_TOOLS
const CALENDAR_TOOLS
Определения
settings.php:38
Bitrix\Socialnetwork\Integration\Intranet\Settings\getGroupLimitCodeByType
getGroupLimitCodeByType(Type $type)
Определения
settings.php:63
Bitrix\Socialnetwork\Integration\Intranet\Settings\isGroupAvailableByType
isGroupAvailableByType(Type $type)
Определения
settings.php:47
Bitrix\Main\Type
Определения
collection.php:2
bitrix
modules
socialnetwork
lib
integration
intranet
settings.php
Создано системой
1.14.0