Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
groupeddatagrid.php
1<?php
2
4
11
12
17class GroupedDataGrid extends Base
18{
19 const VIEW_KEY = 'tripleDataWithProgress';
20
22
26 public function __construct()
27 {
28 parent::__construct();
29 $this->setLabel(Loc::getMessage('REPORT_GROUPED_DATA_GRID_VIEW_LABEL'));
30 $this->setLogoUri('/bitrix/images/report/visualconstructor/view-lines-list.png');
31 $this->setComponentName('bitrix:report.visualconstructor.widget.content.groupeddatagrid');
32 $this->setCompatibleDataType(Common::MULTIPLE_GROUPED_REPORT_TYPE);
33 $this->setJsClassName('BX.Report.VisualConstructor.Widget.Content.GroupedDataGrid');
34 $this->setHeight('auto');
35 $this->setHorizontalResizable(false);
36 }
37
38
45 public function handlerFinallyBeforePassToView($calculatedPerformedData)
46 {
47 $calculatedPerformedData = parent::handlerFinallyBeforePassToView($calculatedPerformedData);
48 $result = array(
49 'items' => array()
50 );
51 if ($allCalculatedReportData = $calculatedPerformedData['data'])
52 {
53 foreach ($allCalculatedReportData as $reportKey => $reportHandlerResult)
54 {
55 $items = $reportHandlerResult['items'];
56 if (!$items)
57 {
58 continue;
59 }
60
61 foreach ($items as $item)
62 {
63 $result['items'][$item['groupBy']][$reportKey] = $item;
64 }
65 $result['config']['reportOptions'][$reportKey]['title'] = htmlspecialcharsbx($reportHandlerResult['config']['reportTitle']);
66
67 foreach ($reportHandlerResult['config']['groupsLabelMap'] as $groupKey => $label)
68 {
69 $result['config']['groupOptions'][$groupKey]['title'] = htmlspecialcharsbx($label);
70 }
71
72 foreach ($reportHandlerResult['config']['groupsLogoMap'] as $groupKey => $logUrl)
73 {
74 $result['config']['groupOptions'][$groupKey]['logo'] = $logUrl;
75 }
76
77 if (!empty($reportHandlerResult['config']['groupsTargetUrlMap']))
78 {
79 foreach ($reportHandlerResult['config']['groupsTargetUrlMap'] as $groupKey => $targetUrl)
80 {
81 $result['config']['groupOptions'][$groupKey]['link'] = $targetUrl;
82 }
83 }
84 }
85 }
86
87 return $result;
88 }
89
96 public function collectWidgetHandlerFormElements(BaseWidget $widgetHandler)
97 {
98 parent::collectWidgetHandlerFormElements($widgetHandler);
99 }
100
107 public function collectReportHandlerFormElements($reportHandler)
108 {
109 parent::collectReportHandlerFormElements($reportHandler);
111 $colorField = $reportHandler->getFormElement('color');
112 if ($colorField)
113 {
114 $colorField->setPickerFieldHidden(true);
115 }
116
118 $whatWillCalculateField = $reportHandler->getFormElement('calculate');
119 $labelField = $reportHandler->getFormElement('label');
120 if ($whatWillCalculateField)
121 {
122 $labelField->addJsEventListener($whatWillCalculateField, $whatWillCalculateField::JS_EVENT_ON_CHANGE, array(
123 'class' => 'BX.Report.VisualConstructor.FieldEventHandlers.Title',
124 'action' => 'whatWillCalculateChange',
125 ));
126 $labelField->addAssets(array(
127 'js' => array('/bitrix/js/report/js/visualconstructor/fields/reporttitle.js')
128 ));
129 }
131 $calculateField = $reportHandler->getFormElement('calculate');
132 if ($calculateField)
133 {
134 $groupByField = $reportHandler->getFormElement('groupingBy');
135 $groupByField->setDefaultValue('RESPONSIBLE');
136 $reportHandler->addFormElementBefore($groupByField, $reportHandler->getFormElement('main_container_end'));
137 }
138 }
139
146 public function getReportDefaultColor($num)
147 {
148 return '#acacac';
149 }
150}
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
setHorizontalResizable($horizontalResizable)
Definition view.php:507
setCompatibleDataType($compatibleDataType)
Definition view.php:121
collectReportHandlerFormElements($reportHandler)
Definition view.php:289