Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
roomprovider.php
1
<?php
2
namespace
Bitrix\Calendar\Integration\UI\EntitySelector
;
3
use
Bitrix\UI\EntitySelector\Dialog
;
4
use
Bitrix\UI\EntitySelector\Item
;
5
6
class
RoomProvider
extends
\Bitrix\UI\EntitySelector\BaseProvider
7
{
8
public
const
ENTITY_ID
=
'room'
;
9
10
public
function
__construct
(array
$options
= [])
11
{
12
parent::__construct();
13
$this->
prepareOptions
(
$options
);
14
}
15
16
protected
function
prepareOptions
(array
$options
= [])
17
{
18
19
}
20
21
public
function
isAvailable
(): bool
22
{
23
return
$GLOBALS
[
'USER'
]->isAuthorized();
24
}
25
26
public
function
shouldFillDialog
(): bool
27
{
28
return
$this->
getOption
(
'fillDialog'
,
true
);
29
}
30
31
public
function
getItems
(array $ids): array
32
{
33
$roomList = \Bitrix\Calendar\Rooms\Manager::getRoomsList();
34
35
return
$this->
getItemsFromRoomList
($roomList);
36
}
37
38
public
function
getSelectedItems
(array $ids): array
39
{
40
$roomList = \Bitrix\Calendar\Rooms\Manager::getRoomsList();
41
42
return
$this->
getItemsFromRoomList
($roomList);
43
}
44
45
public
function
getItemsFromRoomList
(array $roomList)
46
{
47
$items = [];
48
foreach
($roomList as $room)
49
{
50
$items[] = $this->
makeItem
([
'id'
=> $room[
'ID'
],
'title'
=> $room[
'NAME'
],
'color'
=> $room[
'COLOR'
]]);
51
}
52
53
return
$items;
54
}
55
56
public
function
makeItem
(array $item, array
$options
= []):
Item
57
{
58
$itemOptions = [
59
'id'
=> $item[
'id'
],
60
'entityId'
=>
self::ENTITY_ID
,
61
'title'
=> $item[
'title'
],
62
'avatarOptions'
=> [
63
'bgColor'
=> $item[
'color'
],
64
'bgSize'
=>
'22px'
,
65
'bgImage'
=>
''
,
66
],
67
'tabs'
=>
'room'
,
68
];
69
70
return
new
Item
($itemOptions);
71
}
72
73
public
function
getRooms
()
74
{
75
$roomList = \Bitrix\Calendar\Rooms\Manager::getRoomsList();
76
return
$this->
getItemsFromRoomList
($roomList);
77
}
78
79
public
function
fillDialog
(
Dialog
$dialog): void
80
{
81
$dialog->
addItems
($this->
getRooms
());
82
}
83
}
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider
Definition
roomprovider.php:7
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\getRooms
getRooms()
Definition
roomprovider.php:73
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\getItemsFromRoomList
getItemsFromRoomList(array $roomList)
Definition
roomprovider.php:45
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\__construct
__construct(array $options=[])
Definition
roomprovider.php:10
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\ENTITY_ID
const ENTITY_ID
Definition
roomprovider.php:8
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\prepareOptions
prepareOptions(array $options=[])
Definition
roomprovider.php:16
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\makeItem
makeItem(array $item, array $options=[])
Definition
roomprovider.php:56
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\fillDialog
fillDialog(Dialog $dialog)
Definition
roomprovider.php:79
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\shouldFillDialog
shouldFillDialog()
Definition
roomprovider.php:26
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\getSelectedItems
getSelectedItems(array $ids)
Definition
roomprovider.php:38
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\getItems
getItems(array $ids)
Definition
roomprovider.php:31
Bitrix\Calendar\Integration\UI\EntitySelector\RoomProvider\isAvailable
isAvailable()
Definition
roomprovider.php:21
Bitrix\UI\EntitySelector\BaseProvider
Definition
baseprovider.php:5
Bitrix\UI\EntitySelector\BaseProvider\$options
$options
Definition
baseprovider.php:6
Bitrix\UI\EntitySelector\BaseProvider\getOption
getOption(string $option, $defaultValue=null)
Definition
baseprovider.php:48
Bitrix\UI\EntitySelector\Dialog
Definition
dialog.php:10
Bitrix\UI\EntitySelector\Dialog\addItems
addItems(array $items)
Definition
dialog.php:121
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
roomprovider.php
Создано системой
1.10.0