Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
grid.php
1<?php
3
4
8
9class Grid extends GroupedDataGrid
10{
11 const VIEW_KEY = 'grid';
14
15 public function __construct()
16 {
17 parent::__construct();
18 $this->setHeight('auto');
19 $this->setLabel('Grid');
20 $this->setLogoUri('/bitrix/images/report/visualconstructor/view-number.jpg');
21 $this->setPreviewImageUri('/bitrix/images/report/visualconstructor/preview/grid.svg');
22 $this->setComponentName('bitrix:report.visualconstructor.widget.content.grid');
23 $this->setCompatibleDataType(Common::MULTIPLE_GROUPED_REPORT_TYPE);
24 $this->setDraggable(false);
25 }
26
27 public function handlerFinallyBeforePassToView($calculatedPerformedData)
28 {
29 $calculatedPerformedData['data'] = $calculatedPerformedData;
30 $result = array(
31 'items' => array()
32 );
33 if ($allCalculatedReportData = $calculatedPerformedData['data'])
34 {
35 foreach ($allCalculatedReportData as $reportKey => $reportHandlerResult)
36 {
37 $items = $reportHandlerResult['items'];
38
39 foreach ($items as $item)
40 {
41 $result['items'][$item['groupBy']][$reportKey] = $item;
42 }
43 $result['config']['reportOptions'][$reportKey]['title'] = htmlspecialcharsbx($reportHandlerResult['config']['reportTitle']);
44 $result['config']['reportOptions'][$reportKey]['amount'] = !empty($reportHandlerResult['config']['amount']) ? $reportHandlerResult['config']['amount'] : [];
45
46 if (!empty($reportHandlerResult['config']['groupsLabelMap']))
47 {
48 foreach ($reportHandlerResult['config']['groupsLabelMap'] as $groupKey => $label)
49 {
50 $result['config']['groupOptions'][$groupKey]['title'] = htmlspecialcharsbx($label);
51 }
52 }
53
54 if (!empty($reportHandlerResult['config']['groupsLogoMap']))
55 {
56 foreach ($reportHandlerResult['config']['groupsLogoMap'] as $groupKey => $logUrl)
57 {
58 $result['config']['groupOptions'][$groupKey]['logo'] = $logUrl;
59 }
60 }
61
62
63 if (!empty($reportHandlerResult['config']['groupsTargetUrlMap']))
64 {
65 foreach ($reportHandlerResult['config']['groupsTargetUrlMap'] as $groupKey => $targetUrl)
66 {
67 $result['config']['groupOptions'][$groupKey]['link'] = $targetUrl;
68 }
69 }
70 }
71 }
72
73 return $result;
74 }
75
76
77
84 public function collectWidgetHandlerFormElements(BaseWidget $widgetHandler)
85 {
86 parent::collectWidgetHandlerFormElements($widgetHandler);
87 $widgetHandler->addFormElement(new Hidden('amountFieldTitle'));
88 $widgetHandler->addFormElement(new Hidden('groupingColumnTitle'));
89 }
90
91}
setPreviewImageUri($previewImageUri)
Definition view.php:523
setCompatibleDataType($compatibleDataType)
Definition view.php:121
handlerFinallyBeforePassToView($calculatedPerformedData)
Definition grid.php:27
collectWidgetHandlerFormElements(BaseWidget $widgetHandler)
Definition grid.php:84