• Модуль: report
  • Путь к файлу: ~/bitrix/modules/report/lib/visualconstructor/controller/configuration.php
  • Класс: BitrixReportVisualConstructorControllerConfiguration
  • Вызов: Configuration::loadWhatWillCalculateByGroupAction
public function loadWhatWillCalculateByGroupAction($params)
{
	if (!isset($params['widgetId']))
	{
		$this->addError(new Error('widgetId not exist'));
		return false;
	}

	if (!isset($params['viewKey']))
	{
		$this->addError(new Error('view key not exist'));
		return false;
	}

	if (!isset($params['reportHandlerClassName']))
	{
		$this->addError(new Error('report handler class name not exist'));
		return false;
	}

	if (!isset($params['groupBy']))
	{
		$this->addError(new Error('groupBy field not exist'));
		return false;
	}

	$widgetParams = array(
		'widgetGId' => $params['widgetId'],
		'viewKey' => $params['viewKey'],
	);
	$groupBy = $params['groupBy'];
	$reportHandlerClassName = $params['reportHandlerClassName'];
	$widget = BitrixReportVisualConstructorEntityWidget::buildPseudoWidget($widgetParams);
	if ($widget)
	{
		$reportHandler = ReportProvider::getReportHandlerByClassName($reportHandlerClassName);

		$viewHandler = ViewProvider::getViewByViewKey($widget->getViewKey());
		$result = array();
		if ($reportHandler && $viewHandler)
		{
			$reportHandler->setView($viewHandler);
			$whatWillCalculate = $reportHandler->getWhatWillCalculateOptions($groupBy);
			foreach ($whatWillCalculate as $value => $text)
			{
				$result[$value] = $text;
			}
		}
		return $result;
	}
	$this->addError(new Error('No widget with this id'));
	return false;

}