1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
General.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Settings\Entity;
4
5use Bitrix\Im\Common;
6use Bitrix\Im\V2\Settings\Preset\Preset;
7use Bitrix\Pull\Event;
8use CModule;
9
10class General extends BaseSettings
11{
12 public const SIMPLE_SITE = 'notifySchemeSendSite';
13 public const SIMPLE_MAIL = 'notifySchemeSendEmail';
14 public const SIMPLE_PUSH = 'notifySchemeSendPush';
15 public const SCHEME = 'notifyScheme';
16
17 public const PRIVACY_SEARCH = 'privacySearch';
18 public const OPEN_DESKTOP_FROM_PANEL = 'openDesktopFromPanel';
19
20
21 public static function getRestEntityName(): string
22 {
23 return 'general';
24 }
25
26 public function toRestFormat(array $option = []): array
27 {
28 return $this->settings;
29 }
30
36 public function updateSetting(array $settingConfiguration): void
37 {
38 $updatingSetting = [
39 $settingConfiguration['name'] => $settingConfiguration['value']
40 ];
41 $this->settings[$settingConfiguration['name']] = $settingConfiguration['value'];
42
43 \Bitrix\Im\Configuration\General::updateGroupSettings($this->groupId, $updatingSetting);
44 }
45
46 public function shouldUpdateSimpleNotifySettings(array $settingsConfiguration): bool
47 {
48 if ($settingsConfiguration['name'] === self::SCHEME && $settingsConfiguration['value'] === 'simple')
49 {
50 return true;
51 }
52
53 if ($this->getValue(self::SCHEME) === 'simple')
54 {
55 return in_array(
56 $settingsConfiguration['name'],
57 [
58 self::SIMPLE_SITE,
59 self::SIMPLE_MAIL,
60 self::SIMPLE_PUSH
61 ],
62 true
63 );
64 }
65
66 return false;
67 }
68
73 public function load($source): BaseSettings // TODO return int|array
74 {
75 if (is_int($source))
76 {
77 $this->settings = \Bitrix\Im\Configuration\General::getGroupSettings($this->groupId);
78 $this->isLoad = true;
79
80 return $this;
81 }
82
83 if (is_array($source) && !empty($source))
84 {
85 $this->settings =
87 ;
88 $this->isLoad = true;
89 }
90
91 return $this;
92 }
93
94 protected function getValue(string $name, $defaultValue = null)
95 {
96 if (!$this->isLoad())
97 {
98 $this->load($this->groupId);
99 }
100
101 return $this->settings[$name] ?? $defaultValue;
102 }
103
104 public function fillDataBase(): BaseSettings
105 {
106 \Bitrix\Im\Configuration\General::setSettings($this->groupId, [], true);
107
109
110 return $this;
111 }
112
113 public function isSimpleNotifySchema(): bool
114 {
115 return $this->getValue(static::SCHEME) === 'simple';
116 }
117
118 public function getSimpleNotifyScheme(): array
119 {
120 return [
121 static::SIMPLE_SITE => $this->getValue(static::SIMPLE_SITE),
122 self::SIMPLE_MAIL => $this->getValue(self::SIMPLE_MAIL),
123 self::SIMPLE_PUSH => $this->getValue(self::SIMPLE_PUSH),
124 ];
125 }
126}
if($_SERVER $defaultValue['REQUEST_METHOD']==="GET" &&!empty($RestoreDefaults) && $bizprocPerms==="W" &&check_bitrix_sessid())
Определения options.php:32
static updateGroupSettings(int $groupId, array $settings)
Определения General.php:478
static setSettings(int $groupId, array $settings=[], bool $forInitialize=false)
Определения General.php:149
static getDefaultSettings()
Определения General.php:95
static getGroupSettings(int $groupId)
Определения General.php:410
static prepareRawGroupSettings(array $settings)
Определения General.php:437
static getRestEntityName()
Определения General.php:21
shouldUpdateSimpleNotifySettings(array $settingsConfiguration)
Определения General.php:46
toRestFormat(array $option=[])
Определения General.php:26
getValue(string $name, $defaultValue=null)
Определения General.php:94
updateSetting(array $settingConfiguration)
Определения General.php:36
const OPEN_DESKTOP_FROM_PANEL
Определения General.php:18
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$name
Определения menu_edit.php:35
$option
Определения options.php:1711