Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
roomfilter.php
1<?php
3
9
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}
$GLOBALS['____1444769544']
Definition license.php:1