Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
settings.php
1<?php
2namespace Bitrix\Im;
3
6
8{
9 public static function getLoggerConfig(): array
10 {
11 $types = [
12 'desktop' => true,
13 'log' => false,
14 'info' => false,
15 'warn' => false,
16 'error' => true,
17 'trace' => true,
18 ];
19
20 $settings = \Bitrix\Main\Config\Configuration::getValue('im');
21 if (!isset($settings['logger']))
22 {
23 return $types;
24 }
25
26 foreach ($types as $type => $value)
27 {
28 if (isset($settings['logger'][$type]))
29 {
30 $types[$type] = (bool)$settings['logger'][$type];
31 }
32 }
33
34 return $types;
35 }
36
37 public static function isBroadcastingEnabled(): bool
38 {
39 $broadcastingEnabled = false;
40
41 $settings = \Bitrix\Main\Config\Configuration::getValue('im');
42
43 if (!isset($settings['call']['broadcast_enabled']))
44 {
45 return $broadcastingEnabled;
46 }
47
48 return (bool)$settings['call']['broadcast_enabled'];
49 }
50
54 public static function isCallBetaAvailable(): bool
55 {
56 $result = \Bitrix\Main\Config\Option::get('im', 'call_beta_access', 'N');
57 return $result === 'Y';
58 }
59
63 public static function isAiBetaAvailable(): bool
64 {
65 $result = \Bitrix\Main\Config\Option::get('im', 'ai_beta_access', 'N');
66 return $result === 'Y';
67 }
68
69 public static function isV2Available(): bool
70 {
71 $userId = Common::getUserId();
72 if (!$userId)
73 {
74 return false;
75 }
76
77 if (!\Bitrix\Main\Loader::includeModule('intranet'))
78 {
79 return false;
80 }
81
82 return true;
83 }
84
85 public static function isLegacyChatActivated($userId = false): bool
86 {
87 if (!self::isV2Available())
88 {
89 return true;
90 }
91
92 if (\Bitrix\Main\Config\Option::get('im', 'legacy_chat_enabled', 'N') === 'Y')
93 {
94 return true;
95 }
96 if (\CUserOptions::GetOption('im', 'legacy_chat_user_enabled', 'N', $userId) === 'Y')
97 {
98 return true;
99 }
100
101 $isLegacy = \Bitrix\Main\Context::getCurrent()->getRequest()->getQuery('IM_LEGACY');
102 $isIframe = \Bitrix\Main\Context::getCurrent()->getRequest()->getQuery('IFRAME');
103
104 return $isLegacy === 'Y' || $isIframe === 'Y';
105 }
106
107 public static function setLegacyChatActivity($active = true, $userId = false): bool
108 {
109 if (!self::isV2Available())
110 {
111 return false;
112 }
113
114 \CUserOptions::SetOption('im', 'legacy_chat_user_enabled', $active ? 'Y' : 'N', false, $userId);
115 \Bitrix\Intranet\Composite\CacheProvider::deleteUserCache();
116
117 return true;
118 }
119}
static getUserId($userId=null)
Definition common.php:74
static setLegacyChatActivity($active=true, $userId=false)
Definition settings.php:107
static isCallBetaAvailable()
Definition settings.php:54
static isBroadcastingEnabled()
Definition settings.php:37
static isAiBetaAvailable()
Definition settings.php:63
static isLegacyChatActivated($userId=false)
Definition settings.php:85
static isV2Available()
Definition settings.php:69
static getLoggerConfig()
Definition settings.php:9