29 if (!isset($params[
'widgetId']))
35 if (!isset($params[
'viewKey']))
41 $existReportCount = !empty($params[
'existReportCount']) ? $params[
'existReportCount'] : 0;
43 $componentName =
'bitrix:report.visualconstructor.widget.pseudoconfig';
45 $widgetParams = array(
46 'widgetGId' => $params[
'widgetId'],
47 'viewKey' => $params[
'viewKey'],
50 $reportHandlerClassName = !empty($params[
'reportHandlerClassName']) ? $params[
'reportHandlerClassName'] :
'__';
52 $widget = \Bitrix\Report\VisualConstructor\Entity\Widget::buildPseudoWidget($widgetParams);
55 $componentParams = array(
56 'WIDGET_ID' => $widget->getGId()
59 if ($reportHandlerClassName ==
'__')
61 $reportHandlerClassName = EmptyReport::getClassName();
64 $reportHandler = Report::buildReportHandlerForWidget($reportHandlerClassName, $widget,
true);
65 $colorFieldValue = !empty($params[
'colorFieldValue']) ? $params[
'colorFieldValue'] : $reportHandler->getView()->getReportDefaultColor($existReportCount + 1);
67 $reportHandler->getFormElement(
'color')->setValue($colorFieldValue);
68 $reportHandler->getFormElement(
'head_container_start')->addInlineStyle(
'background-color', $colorFieldValue);
69 $reportHandler->getFormElement(
'main_container_start')->addInlineStyle(
'background-color', $colorFieldValue .
'5f');
70 $componentParams[
'REPORT_HANDLER'] = $reportHandler;
71 return new Component($componentName, $templateName, $componentParams);
85 if (!isset($params[
'widgetId']))
91 if (!isset($params[
'viewKey']))
97 if (!isset($params[
'reportHandlerClassName']))
99 $this->
addError(
new Error(
'report handler class name not exist'));
103 if (!isset($params[
'groupBy']))
109 $widgetParams = array(
110 'widgetGId' => $params[
'widgetId'],
111 'viewKey' => $params[
'viewKey'],
113 $groupBy = $params[
'groupBy'];
114 $reportHandlerClassName = $params[
'reportHandlerClassName'];
115 $widget = \Bitrix\Report\VisualConstructor\Entity\Widget::buildPseudoWidget($widgetParams);
118 $reportHandler = ReportProvider::getReportHandlerByClassName($reportHandlerClassName);
120 $viewHandler = ViewProvider::getViewByViewKey($widget->getViewKey());
122 if ($reportHandler && $viewHandler)
124 $reportHandler->setView($viewHandler);
125 $whatWillCalculate = $reportHandler->getWhatWillCalculateOptions($groupBy);
126 foreach ($whatWillCalculate as $value => $text)
128 $result[$value] = $text;