1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
Toolbar.php
См. документацию.
1<?php
2
4
11use Bitrix\UI;
12
14{
15 public function build(): void
16 {
17 $this->addCreateButton();
18 $this->addFilter();
19 }
20
21 protected function addCreateButton(): void
22 {
23 $calendarType = Dictionary::CALENDAR_TYPE['open_event'];
24 $userId = CurrentUser::get()->getId();
25
27
28 $addButton = new UI\Buttons\Button([
29 'color' => UI\Buttons\Color::SUCCESS,
30 'text' => Loc::getMessage('CALENDAR_OPEN_EVENTS_TOOLBAR_BUTTON_CREATE'),
31 'click' => new UI\Buttons\JsCode("
32 BX.Runtime.loadExtension('calendar.entry').then(({ EntryManager }) => {
33 const colors = $colors;
34 EntryManager.openEditSlider({
35 type: '$calendarType',
36 userId: $userId,
37 formDataValue: {
38 color: colors[Math.floor(Math.random()*colors.length)],
39 },
40 });
41 });
42 "),
43 'events' => [
44 'mouseover' => new UI\Buttons\JsCode("BX.Runtime.loadExtension('calendar.entry');"),
45 ],
46 ]);
47
48 UI\Toolbar\Facade\Toolbar::addButton($addButton, UI\Toolbar\ButtonLocation::AFTER_TITLE);
49 }
50
51 protected function addFilter(): void
52 {
53 $filter = new Filter();
54
55 (new Options($filter::getId()))->reset();
56
57 UI\Toolbar\Facade\Toolbar::addFilter($filter->getOptions());
58 }
59}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static encode($data, $options=null)
Определения json.php:22
$filter
Определения iblock_catalog_list.php:54
Определения addbutton.php:3