private function addContainer(WidgetContainerConfig $containerWidget) { $widgetId = $containerWidget->getId(); $this->container[$widgetId] = $containerWidget; // widgets were added to this container, but the container did not exist yet. if (isset($this->containerWidgets[$widgetId])) { foreach ($this->containerWidgets[$widgetId] as $widget) { $containerWidget->addWidgetConfig($widget); } unset($this->containerWidgets[$widgetId]); } }
private function buildGoalByDimensionView($idGoal, WidgetContainerConfig $container) { $container->setLayout('ByDimension'); $ecommerce = $idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER; // for non-Goals reports, we show the goals table $customParams = array('documentationForGoalsPage' => '1'); if ($idGoal === '') { // if no idGoal, use 0 for overview. Must be string! Otherwise Piwik_View_HtmlTable_Goals fails. $customParams['idGoal'] = '0'; } else { $customParams['idGoal'] = $idGoal; } $translationHelper = new TranslationHelper(); foreach ($this->allReports as $category => $reports) { $order = $this->getSortOrderOfCategory($category) * 100; if ($ecommerce) { $categoryText = $translationHelper->translateEcommerceMetricCategory($category); } else { $categoryText = $translationHelper->translateGoalMetricCategory($category); } foreach ($reports as $report) { $order++; if (empty($report['viewDataTable']) && empty($report['abandonedCarts'])) { $report['viewDataTable'] = 'tableGoals'; } if (!empty($report['parameters'])) { $params = array_merge($customParams, $report['parameters']); } else { $params = $customParams; } $widget = $this->createWidgetForReport($report['module'], $report['action']); if (!empty($report['name'])) { $widget->setName($report['name']); } $widget->setParameters($params); $widget->setCategoryId($categoryText); $widget->setSubcategoryId($categoryText); $widget->setOrder($order); $widget->setIsNotWidgetizable(); if (!empty($report['viewDataTable'])) { $widget->forceViewDataTable($report['viewDataTable']); } $container->addWidgetConfig($widget); } } }