createWidget() public method

It will automatically use the report's name, categoryId, subcategoryId (if specified), defaultViewDataTable, module, action, order and parameters in order to create the widget.
public createWidget ( ) : ReportWidgetConfig
return ReportWidgetConfig
Example #1
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createContainerWidget('Continent'));
     $widgetsList->addToContainerWidget('Continent', $factory->createWidget());
     $widget = $factory->createWidget()->setAction('getDistinctCountries')->setName('');
     $widgetsList->addToContainerWidget('Continent', $widget);
 }
Example #2
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     // this will render the default view, in this case an Html Table
     $widgetsList->addWidgetConfig($factory->createWidget());
     $widgetsList->addWidgetConfig($factory->createWidget()->forceViewDataTable(Bar::ID)->setSubcategoryId('Bar graph'));
     if (PluginManager::getInstance()->isPluginActivated('TreemapVisualization')) {
         $widgetsList->addWidgetConfig($factory->createWidget()->setName('Treemap example')->setSubcategoryId('Treemap')->forceViewDataTable('infoviz-treemap'));
     }
 }
Example #3
0
File: Base.php Project: piwik/piwik
 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);
     }
 }
Example #4
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     // we have to do it manually since it's only done automatically if a subcategoryId is specified,
     // we do not set a subcategoryId since this report is not supposed to be shown in the UI
     $widgetsList->addWidgetConfig($factory->createWidget());
 }
Example #5
0
File: Get.php Project: piwik/piwik
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('VisitsSummary_WidgetLastVisits')->forceViewDataTable(Evolution::ID)->setAction('getEvolutionGraph')->setOrder(5));
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('VisitsSummary_WidgetVisits')->forceViewDataTable(Sparklines::ID)->setOrder(10));
 }
Example #6
0
File: Base.php Project: piwik/piwik
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widget = $factory->createWidget();
     $widgetsList->addToContainerWidget('Contents', $widget);
 }
Example #7
0
File: Get.php Project: piwik/piwik
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('VisitFrequency_WidgetGraphReturning')->forceViewDataTable(Evolution::ID)->setAction('getEvolutionGraph')->setOrder(1));
     $widgetsList->addWidgetConfig($factory->createWidget()->forceViewDataTable(Sparklines::ID)->setName('VisitFrequency_WidgetOverview')->setOrder(2));
 }
Example #8
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widget = $factory->createWidget()->setName('Provider_WidgetProviders');
     $widgetsList->addWidgetConfig($widget);
 }
Example #9
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget()->setSubcategoryId('Sparklines')->forceViewDataTable(Sparklines::ID));
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('ExampleUI_TemperaturesEvolution')->setSubcategoryId('Evolution Graph')->forceViewDataTable(Evolution::ID)->setParameters(array('columns' => array('server1', 'server2'))));
 }
Example #10
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widget = $factory->createWidget()->setName('Live_RealTimeVisitorCount')->setOrder(15);
     $widgetsList->addWidgetConfig($widget);
 }
Example #11
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addToContainerWidget('Products', $factory->createWidget());
 }
Example #12
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('Actions_WidgetEntryPageTitles'));
 }
Example #13
0
 private function createWidgetForReport($module, $action)
 {
     $report = ReportsProvider::factory($module, $action);
     $factory = new ReportWidgetFactory($report);
     return $factory->createWidget();
 }
Example #14
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widget = $factory->createWidget()->forceViewDataTable(VisitorLog::ID)->setName('Live_VisitorLog')->setOrder(10)->setParameters(array('small' => 1));
     $widgetsList->addWidgetConfig($widget);
 }
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widget = $factory->createWidget()->setName('VisitorInterest_WidgetVisitsByDaysSinceLast');
     $widgetsList->addWidgetConfig($widget);
 }
Example #16
0
 /**
  * lets you add any amount of widgets for this report. If a report defines a {@link $categoryId} and a
  * {@link $subcategoryId} a widget will be generated automatically.
  *
  * Example to add a widget manually by overwriting this method in your report:
  * $widgetsList->addWidgetConfig($factory->createWidget());
  *
  * If you want to have the name and the order of the widget differently to the name and order of the report you can
  * do the following:
  * $widgetsList->addWidgetConfig($factory->createWidget()->setName('Custom')->setOrder(5));
  *
  * If you want to add a widget to any container defined by your plugin or by another plugin you can do
  * this:
  * $widgetsList->addToContainerWidget($containerId = 'Products', $factory->createWidget());
  *
  * @param WidgetsList $widgetsList
  * @param ReportWidgetFactory $factory
  * @api
  */
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     if ($this->categoryId && $this->subcategoryId) {
         $widgetsList->addWidgetConfig($factory->createWidget());
     }
 }
Example #17
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget());
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('Simple tag cloud')->setSubcategoryId('Tag clouds')->forceViewDataTable(Cloud::ID)->setOrder(5));
 }
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if ($idSite < 1) {
         return;
     }
     $dimensions = $this->getActiveDimensionsForSite($idSite);
     foreach ($dimensions as $dimension) {
         if (!$dimension['active']) {
             continue;
         }
         if ($dimension['scope'] === CustomDimensions::SCOPE_ACTION) {
             $this->categoryId = 'General_Actions';
             $this->subcategoryId = 'customdimension' . $dimension['idcustomdimension'];
         } elseif ($dimension['scope'] === CustomDimensions::SCOPE_VISIT) {
             $this->categoryId = 'General_Visitors';
             $this->subcategoryId = 'customdimension' . $dimension['idcustomdimension'];
         } else {
             continue;
         }
         $widget = $factory->createWidget()->setName($dimension['name']);
         $widget->setParameters(array('idDimension' => $dimension['idcustomdimension']));
         $widgetsList->addWidgetConfig($widget);
     }
 }
Example #19
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widget = $factory->createWidget()->setName('Referrers_Socials');
     $widgetsList->addWidgetConfig($widget);
 }
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('VisitorInterest_VisitsPerDuration'));
 }
Example #21
0
 public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory)
 {
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('Referrers_ReferrerTypes')->setSubcategoryId('Referrers_WidgetGetAll'));
     $widgetsList->addWidgetConfig($factory->createWidget()->setName('General_EvolutionOverPeriod')->setSubcategoryId('General_Overview')->setAction('getEvolutionGraph')->setOrder(9)->setIsNotWidgetizable()->forceViewDataTable(Evolution::ID)->addParameters(array('columns' => $defaultColumns = array('nb_visits'))));
     $widgetsList->addWidgetConfig($factory->createCustomWidget('getSparklines')->forceViewDataTable(Sparklines::ID)->setIsNotWidgetizable()->setName('Referrers_Type')->setSubcategoryId('General_Overview')->setOrder(10));
 }