Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
number.php
1<?php
2
4
10
11
16class Number extends Base
17{
18 const VIEW_KEY = 'number';
20
24 public function __construct()
25 {
26 parent::__construct();
27 $this->setHeight(180);
28 $this->setLabel(Loc::getMessage('REPORT_NUMBER_VIEW_LABEL'));
29 $this->setLogoUri('/bitrix/images/report/visualconstructor/view-number.jpg');
30 $this->setComponentName('bitrix:report.visualconstructor.widget.content.number');
31 $this->setCompatibleDataType(Common::SINGLE_REPORT_TYPE);
32 }
33
40 public function collectReportHandlerFormElements($reportHandler)
41 {
42 parent::collectReportHandlerFormElements($reportHandler);
43
44 $removeFormElement = $reportHandler->getFormElementByDataAttribute('role', 'report-remove-button');
45 if ($removeFormElement)
46 {
47 $removeFormElement->setDisplay(false);
48 }
49
51 $whatWillCalculateField = $reportHandler->getFormElement('calculate');
52 $labelField = $reportHandler->getFormElement('label');
53 if ($whatWillCalculateField)
54 {
55 $labelField->addJsEventListener($whatWillCalculateField, $whatWillCalculateField::JS_EVENT_ON_CHANGE, array(
56 'class' => 'BX.Report.VisualConstructor.FieldEventHandlers.Title',
57 'action' => 'whatWillCalculateChange',
58 ));
59 $whatWillCalculateField->addAssets(array(
60 'js' => array('/bitrix/js/report/js/visualconstructor/fields/reporttitle.js')
61 ));
62 }
63 }
64
74 public function prepareWidgetContent(Widget $widget, $withCalculatedData = false)
75 {
76 $resultWidget = parent::prepareWidgetContent($widget, $withCalculatedData);
77
78 if ($withCalculatedData)
79 {
80 $resultWidget['config']['color'] = $widget->getWidgetHandler()->getReportHandlers()[0]->getFormElement('color')->getValue();
81 $resultWidget['config']['title'] = $widget->getWidgetHandler()->getReportHandlers()[0]->getFormElement('label')->getValue();
82 }
83
84 return $resultWidget;
85 }
86}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
setCompatibleDataType($compatibleDataType)
Definition view.php:121
collectReportHandlerFormElements($reportHandler)
Definition view.php:289
prepareWidgetContent(Widget $widget, $withCalculatedData=false)
Definition number.php:74