Exemplo n.º 1
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('Installation_SystemCheck');
     $config->setOrder(16);
     $config->setIsEnabled(Piwik::hasUserSuperUserAccess());
 }
Exemplo n.º 2
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('ProfessionalServices_WidgetProfessionalServicesForPiwik');
     $advertising = StaticContainer::get('Piwik\\ProfessionalServices\\Advertising');
     $config->setIsEnabled($advertising->areAdsForProfessionalServicesEnabled());
 }
Exemplo n.º 3
0
 public static function configure(WidgetConfig $config)
 {
     /**
      * Set the category the widget belongs to. You can reuse any existing widget category or define
      * your own category.
      */
     $config->setCategoryId('About Piwik');
     /**
      * Set the subcategory the widget belongs to. If a subcategory is set, the widget will be shown in the UI.
      */
     // $config->setSubcategoryId('General_Overview');
     /**
      * Set the name of the widget belongs to.
      */
     $config->setName('Example Widget Name');
     /**
      * Set the order of the widget. The lower the number, the earlier the widget will be listed within a category.
      */
     $config->setOrder(99);
     /**
      * Optionally set URL parameters that will be used when this widget is requested.
      * $config->setParameters(array('myparam' => 'myvalue'));
      */
     /**
      * Define whether a widget is enabled or not. For instance some widgets might not be available to every user or
      * might depend on a setting (such as Ecommerce) of a site. In such a case you can perform any checks and then
      * set `true` or `false`. If your widget is only available to users having super user access you can do the
      * following:
      *
      * $config->setIsEnabled(\Piwik\Piwik::hasUserSuperUserAccess());
      * or
      * if (!\Piwik\Piwik::hasUserSuperUserAccess())
      *     $config->disable();
      */
 }
Exemplo n.º 4
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('CoreHome_SystemSummaryWidget');
     $config->setOrder(15);
     $config->setIsEnabled(Piwik::hasUserSuperUserAccess());
 }
Exemplo n.º 5
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('General_Visitors');
     $config->setName('Live_VisitorProfile');
     $config->setOrder(25);
     if (Piwik::isUserIsAnonymous()) {
         $config->disable();
     }
 }
Exemplo n.º 6
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('General_Visitors');
     $config->setSubcategoryId('UserCountryMap_RealTimeMap');
     $config->setName('UserCountryMap_RealTimeMap');
     $config->setModule('UserCountryMap');
     $config->setAction('realtimeMap');
     $config->setOrder(5);
     if (!PluginManager::getInstance()->isPluginActivated('UserCountry')) {
         $config->disable();
     }
 }
Exemplo n.º 7
0
 private function addDefaultDashboard(&$widgets)
 {
     $config = new WidgetConfig();
     $config->setIsNotWidgetizable();
     $config->setModule('Dashboard');
     $config->setAction('embeddedIndex');
     $config->setCategoryId('Dashboard_Dashboard');
     $config->setSubcategoryId('1');
     $config->setParameters(array('idDashboard' => 1));
     $widgets[] = $config;
 }
Exemplo n.º 8
0
 /**
  * @inheritdoc
  */
 public function getParameters()
 {
     $parameters = parent::getParameters();
     $defaultParams = array();
     if ($this->forceViewDataTable) {
         $defaultParams['forceView'] = '1';
         if ($this->viewDataTable) {
             // URL param is not needed for default view dataTable
             $defaultParams['viewDataTable'] = $this->viewDataTable;
         }
     }
     return $defaultParams + $parameters;
 }
Exemplo n.º 9
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('General_Visitors');
     $config->setSubcategoryId('UserCountry_SubmenuLocations');
     $config->setName('UserCountryMap_VisitorMap');
     $config->setAction('visitorMap');
     $config->setOrder(1);
 }
Exemplo n.º 10
0
 public static function configure(WidgetConfig $config)
 {
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     $config->setCategoryId('Goals_Goals');
     $config->setSubcategoryId('Goals_AddNewGoal');
     $config->setParameters(array('idGoal' => ''));
     $config->setIsNotWidgetizable();
     if (empty($idSite)) {
         $config->disable();
         return;
     }
     $goals = API::getInstance()->getGoals($idSite);
     if (Piwik::isUserHasAdminAccess($idSite)) {
         $config->setName('Goals_AddNewGoal');
     } else {
         $config->setName('Goals_CreateNewGOal');
     }
     if (count($goals) !== 0) {
         $config->disable();
     }
 }
Exemplo n.º 11
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('Goals_Ecommerce');
     $config->setSubcategoryId('Goals_EcommerceLog');
     $config->setName('Goals_EcommerceLog');
     $idSite = Common::getRequestVar('idSite', 0, 'int');
     if (empty($idSite)) {
         $config->disable();
         return;
     }
     $site = new Site($idSite);
     $config->setIsEnabled($site->isEcommerceEnabled());
 }
Exemplo n.º 12
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('SEO');
     $config->setName('Referrers_WidgetTopKeywordsForPages');
     $config->setIsEnabled(SettingsPiwik::isSegmentationEnabled());
 }
Exemplo n.º 13
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('Latest Marketplace Updates');
     $config->setOrder(19);
 }
Exemplo n.º 14
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('Piwik.org Blog');
 }
Exemplo n.º 15
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('SEO');
     $config->setName('SEO_SeoRankings');
 }
Exemplo n.º 16
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('Live!');
     $config->setName('Live_VisitorsInRealTime');
     $config->setOrder(20);
 }
Exemplo n.º 17
0
 private function getWidgetConfigForClassName($widgetClass)
 {
     /** @var string|Widget $widgetClass */
     $config = new WidgetConfig();
     $config->setModule($this->getModuleFromWidgetClassName($widgetClass));
     $config->setAction($this->getActionFromWidgetClassName($widgetClass));
     $widgetClass::configure($config);
     return $config;
 }
Exemplo n.º 18
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('Insights_WidgetCategory');
     $config->setName('Insights_MoversAndShakersWidgetTitle');
 }
Exemplo n.º 19
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('Insights_WidgetCategory');
     $config->setName('Insights_OverviewWidgetTitle');
 }
Exemplo n.º 20
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('Installation_Welcome');
     $config->setOrder(10);
 }
Exemplo n.º 21
0
 private function checkIsValidWidget(WidgetConfig $widget)
 {
     if (!$widget->getModule()) {
         Development::error('No module is defined for added widget having name "' . $widget->getName());
     }
     if (!$widget->getAction()) {
         Development::error('No action is defined for added widget having name "' . $widget->getName());
     }
 }
Exemplo n.º 22
0
 /**
  * @param WidgetConfig $widget
  * @param CategoryList|null $categoryList If null, no category information will be added to the widgets in first
  *                                        level (they will be added to nested widgets as potentially needed eg for
  *                                        widgets in ByDimensionView where they are needed to build the left menu)
  * @return array
  */
 public function buildWidgetMetadata(WidgetConfig $widget, $categoryList = null)
 {
     $item = array('name' => Piwik::translate($widget->getName()));
     if (isset($categoryList)) {
         $category = $categoryList->getCategory($widget->getCategoryId());
         $subcategory = $category ? $category->getSubcategory($widget->getSubcategoryId()) : null;
         $item['category'] = $this->buildCategoryMetadata($category);
         $item['subcategory'] = $this->buildSubcategoryMetadata($subcategory);
     }
     $item['module'] = $widget->getModule();
     $item['action'] = $widget->getAction();
     $item['order'] = $widget->getOrder();
     $item['parameters'] = $widget->getParameters();
     $item['uniqueId'] = $widget->getUniqueId();
     $item['isWide'] = $widget->isWide();
     $middleware = $widget->getMiddlewareParameters();
     if (!empty($middleware)) {
         $item['middlewareParameters'] = $middleware;
     }
     if ($widget instanceof ReportWidgetConfig) {
         $item['viewDataTable'] = $widget->getViewDataTable();
         $item['isReport'] = true;
     }
     if ($widget instanceof WidgetContainerConfig) {
         $item['layout'] = $widget->getLayout();
         $item['isContainer'] = true;
         // we do not want to create categories to the inital categoryList. Otherwise we'd maybe display more pages
         // etc.
         $subCategoryList = new CategoryList();
         $this->createMissingCategoriesAndSubcategories($subCategoryList, $widget->getWidgetConfigs());
         $children = array();
         foreach ($widget->getWidgetConfigs() as $widgetConfig) {
             $children[] = $this->buildWidgetMetadata($widgetConfig, $subCategoryList);
         }
         $item['widgets'] = $children;
     }
     return $item;
 }
Exemplo n.º 23
0
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setName('CoreHome_SupportPiwik');
     $config->setOrder(5);
 }
Exemplo n.º 24
0
Arquivo: Rss.php Projeto: piwik/piwik
 public static function configure(WidgetConfig $config)
 {
     $config->setCategoryId('About Piwik');
     $config->setIsEnabled(false);
 }