Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
SpaceListMode.php
1<?php
3
4final class SpaceListMode
5{
6 private const MODULE_NAME = 'socialnetwork';
7 private const OPTION_NAME = 'spacesListState';
8 private const DEFAULT_VALUE = Dictionary::SPACE_LIST_STATES['default'];
9
10 public static function getOption(): string
11 {
12 $spacesListMode = \CUserOptions::GetOption(
13 self::MODULE_NAME,
14 self::OPTION_NAME,
15 self::DEFAULT_VALUE,
16 );
17
18 if (!in_array($spacesListMode, Dictionary::SPACE_LIST_STATES, true))
19 {
20 $spacesListMode = self::DEFAULT_VALUE;
21 }
22
23 return $spacesListMode;
24 }
25
26 public static function setOption(int $userId, string $mode): void
27 {
28 if (in_array($mode, Dictionary::SPACE_LIST_STATES))
29 {
30 \CUserOptions::SetOption(
31 self::MODULE_NAME,
32 self::OPTION_NAME,
33 $mode,
34 false,
35 $userId,
36 );
37 }
38 }
39}
static setOption(int $userId, string $mode)