public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) { if (!$this->isSubtableReport) { $widget = $factory->createWidget()->setParameters(array('secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($this->action))); $widgetsList->addToContainerWidget('Events', $widget); } }
public function configure(WidgetsList $widgetsList) { foreach (Events::getLabelTranslations() as $apiMethod => $labels) { $params = array('secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($apiMethod)); $widgetsList->add('Events_Events', $labels[0], 'Events', $apiMethod, $params); } }
private function getLeftMenuReports() { $reports = new View\ReportsByDimension('Events'); foreach (Events::getLabelTranslations() as $apiAction => $translations) { // 'getCategory' is the API method, but we are loading 'indexCategory' which displays <h2> $count = 1; $controllerAction = str_replace("get", "index", $apiAction, $count); $params = array('secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($apiAction)); $reports->addReport('Events_TopEvents', $translations[0], 'Events.' . $controllerAction, $params); } return $reports->render(); }
private function addRelatedReports($view, $secondaryDimension) { if (empty($secondaryDimension)) { // eg. Row Evolution return; } $events = new Events(); $view->config->show_related_reports = true; $apiMethod = $view->requestConfig->getApiMethodToRequest(); $secondaryDimensions = API::getInstance()->getSecondaryDimensions($apiMethod); if (empty($secondaryDimensions)) { return; } $secondaryDimensionTranslation = $events->getDimensionLabel($secondaryDimension); $view->config->related_reports_title = Piwik::translate('Events_SecondaryDimension', $secondaryDimensionTranslation) . "<br/>" . Piwik::translate('Events_SwitchToSecondaryDimension', ''); foreach ($secondaryDimensions as $dimension) { if ($dimension == $secondaryDimension) { // don't show as related report the currently selected dimension continue; } $dimensionTranslation = $events->getDimensionLabel($dimension); $view->config->addRelatedReport($view->requestConfig->apiMethodToRequestDataTable, $dimensionTranslation, array('secondaryDimension' => $dimension)); } }
protected function init() { $this->category = 'Events_Events'; $this->processedMetrics = false; $this->widgetParams = array('secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($this->action)); }