1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
settings.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Integration\Intranet;
4
5use Bitrix\Intranet\Settings\Tools\ToolsManager;
6use Bitrix\Main\Loader;
7use Bitrix\Socialnetwork\Item\Workgroup\Type;
8
9final 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
Определения options.php:106
Определения collection.php:2