Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
roomfilter.php
1
<?php
2
namespace
Bitrix\Calendar\Integration\UI\EntitySelector
;
3
4
use
Bitrix\Im\User
;
5
use
Bitrix\Main\Localization\Loc
;
6
use
Bitrix\UI\EntitySelector\BaseFilter
;
7
use
Bitrix\UI\EntitySelector\Dialog
;
8
use
Bitrix\UI\EntitySelector\Item
;
9
10
class
RoomFilter
extends
BaseFilter
11
{
12
public
function
__construct
()
13
{
14
parent::__construct();
15
}
16
17
public
function
isAvailable
(): bool
18
{
19
return
$GLOBALS
[
'USER'
]->isAuthorized();
20
}
21
22
public
function
apply
(array $items,
Dialog
$dialog): void
23
{
24
$categories = \Bitrix\Calendar\Rooms\Categories\Manager::getCategoryList();
25
$rooms = \Bitrix\Calendar\Rooms\Manager::getRoomsList();
26
foreach
($items as $item)
27
{
28
if
(!($item instanceof
Item
))
29
{
30
continue
;
31
}
32
$categoryId = 0;
33
$color =
''
;
34
foreach
($rooms as $room)
35
{
36
if
($item->getId() === $room[
'ID'
])
37
{
38
$categoryId = $room[
'CATEGORY_ID'
];
39
$color = $room[
'COLOR'
];
40
break
;
41
}
42
}
43
44
$customData = $item->getCustomData();
45
$customData->set(
'room'
, [
'COLOR'
=> $color]);
46
$item->setAvatarOptions([
47
'bgColor'
=> $color,
48
'bgSize'
=>
'22px'
,
49
'bgImage'
=>
'none'
,
50
]);
51
$item->setBadgesOptions([
52
'fitContent'
=>
true
,
53
'maxWidth'
=>
'230px'
,
54
]);
55
if
(!$categoryId)
56
{
57
continue
;
58
}
59
60
foreach
($categories as $category)
61
{
62
if
($categoryId === $category[
'ID'
])
63
{
64
$item->addBadges([[
65
'id'
=>
'CATEGORY'
,
66
'title'
=> $category[
'NAME'
],
67
]]);
68
break
;
69
}
70
}
71
}
72
}
73
}
Bitrix\Calendar\Integration\UI\EntitySelector\RoomFilter
Definition
roomfilter.php:11
Bitrix\Calendar\Integration\UI\EntitySelector\RoomFilter\__construct
__construct()
Definition
roomfilter.php:12
Bitrix\Calendar\Integration\UI\EntitySelector\RoomFilter\apply
apply(array $items, Dialog $dialog)
Definition
roomfilter.php:22
Bitrix\Calendar\Integration\UI\EntitySelector\RoomFilter\isAvailable
isAvailable()
Definition
roomfilter.php:17
Bitrix\Im\User
Definition
user.php:10
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\UI\EntitySelector\BaseFilter
Definition
basefilter.php:5
Bitrix\UI\EntitySelector\Dialog
Definition
dialog.php:10
Bitrix\UI\EntitySelector\Item
Definition
item.php:8
Bitrix\Calendar\Integration\UI\EntitySelector
Bitrix\Main\$GLOBALS
$GLOBALS['____1444769544']
Definition
license.php:1
modules
calendar
lib
integration
ui
entityselector
roomfilter.php
Создано системой
1.10.0