示例#1
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'Example Widgets';
     $controller = 'CoreHome';
     $widgetsList->add($category, 'CoreHome_SupportPiwik', $controller, 'getDonateForm');
     $widgetsList->add($category, 'Installation_Welcome', $controller, 'getPromoVideo');
 }
示例#2
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'Insights_WidgetCategory';
     $controller = 'Insights';
     $widgetsList->add($category, 'Insights_OverviewWidgetTitle', $controller, 'getInsightsOverview');
     $widgetsList->add($category, 'Insights_MoversAndShakersWidgetTitle', $controller, 'getOverallMoversAndShakers');
 }
示例#3
0
 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);
     }
 }
示例#4
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'General_Visitors';
     $controller = 'VisitFrequency';
     $widgetsList->add($category, 'VisitFrequency_WidgetOverview', $controller, 'getSparklines');
     $widgetsList->add($category, 'VisitFrequency_WidgetGraphReturning', $controller, 'getEvolutionGraph', array('columns' => array('nb_visits_returning')));
 }
示例#5
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'VisitsSummary_VisitsSummary';
     $controller = 'VisitTime';
     $widgetsList->add($category, 'VisitTime_WidgetLocalTime', $controller, 'getVisitInformationPerLocalTime');
     $widgetsList->add($category, 'VisitTime_WidgetServerTime', $controller, 'getVisitInformationPerServerTime');
     $widgetsList->add($category, 'VisitTime_VisitsByDayOfWeek', $controller, 'getByDayOfWeek');
 }
示例#6
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'VisitsSummary_VisitsSummary';
     $controller = 'VisitsSummary';
     $widgetsList->add($category, 'VisitsSummary_WidgetLastVisits', $controller, 'getEvolutionGraph', array('columns' => array('nb_visits')));
     $widgetsList->add($category, 'VisitsSummary_WidgetVisits', $controller, 'getSparklines');
     $widgetsList->add($category, 'VisitsSummary_WidgetOverviewGraph', $controller, 'index');
 }
示例#7
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'General_Visitors';
     $controller = 'VisitorInterest';
     $widgetsList->add($category, 'VisitorInterest_WidgetLengths', $controller, 'getNumberOfVisitsPerVisitDuration');
     $widgetsList->add($category, 'VisitorInterest_WidgetPages', $controller, 'getNumberOfVisitsPerPage');
     $widgetsList->add($category, 'VisitorInterest_visitsByVisitCount', $controller, 'getNumberOfVisitsByVisitCount');
     $widgetsList->add($category, 'VisitorInterest_WidgetVisitsByDaysSinceLast', $controller, 'getNumberOfVisitsByDaysSinceLast');
 }
示例#8
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'Live!';
     $controller = 'Live';
     $widgetsList->add($category, 'Live_VisitorsInRealTime', $controller, 'widget');
     $widgetsList->add($category, 'Live_VisitorLog', $controller, 'getVisitorLog', array('small' => 1));
     $widgetsList->add($category, 'Live_RealTimeVisitorCount', $controller, 'getSimpleLastVisitCount');
     $widgetsList->add($category, 'Live_VisitorProfile', $controller, 'getVisitorProfilePopup');
 }
示例#9
0
 private function addGoalsWidgets(WidgetsList $widgetsList, $idSite)
 {
     $widgetsList->add('Goals_Goals', 'Goals_GoalsOverview', 'Goals', 'widgetGoalsOverview');
     $goals = API::getInstance()->getGoals($idSite);
     if (count($goals) > 0) {
         foreach ($goals as $goal) {
             $widgetsList->add('Goals_Goals', Common::sanitizeInputValue($goal['name']), 'Goals', 'widgetGoalReport', array('idGoal' => $goal['idgoal']));
         }
     }
 }
示例#10
0
 public function configure(WidgetsList $widgetsList)
 {
     $detection = new DevicesDetection();
     foreach ($detection->getRawMetadataReports() as $report) {
         list($category, $name, $controllerName, $controllerAction) = $report;
         if ($category == false) {
             continue;
         }
         $widgetsList->add($category, $name, $controllerName, $controllerAction);
     }
 }
示例#11
0
 public function configure(WidgetsList $widgetsList)
 {
     $userSettings = new UserSettings();
     foreach ($userSettings->getRawReportMetadata() as $report) {
         list($category, $name, $controllerName, $controllerAction) = $report;
         if ($category == false) {
             continue;
         }
         $widgetsList->add($category, $name, $controllerName, $controllerAction);
     }
 }
 public function addWidgets()
 {
     WidgetsList::add('General_Visitors', 'VisitorInterest_WidgetLengths', 'VisitorInterest', 'getNumberOfVisitsPerVisitDuration');
     WidgetsList::add('General_Visitors', 'VisitorInterest_WidgetPages', 'VisitorInterest', 'getNumberOfVisitsPerPage');
     WidgetsList::add('General_Visitors', 'VisitorInterest_visitsByVisitCount', 'VisitorInterest', 'getNumberOfVisitsByVisitCount');
     WidgetsList::add('General_Visitors', 'VisitorInterest_WidgetVisitsByDaysSinceLast', 'VisitorInterest', 'getNumberOfVisitsByDaysSinceLast');
 }
 public function registerWidgets()
 {
     if (PluginManager::getInstance()->isPluginActivated('UserCountry')) {
         WidgetsList::add('General_Visitors', Piwik::translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap');
         WidgetsList::add('Live!', Piwik::translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap');
     }
 }
示例#14
0
 public function addWidgets()
 {
     foreach (self::getLabelTranslations() as $apiMethod => $labels) {
         $params = array('secondaryDimension' => API::getInstance()->getDefaultSecondaryDimension($apiMethod));
         WidgetsList::add('Events_Events', $labels[0], 'Events', $apiMethod, $params);
     }
 }
示例#15
0
 public function index()
 {
     $view = new View('@Widgetize/index');
     $view->availableWidgets = Common::json_encode(WidgetsList::get());
     $this->setGeneralVariablesView($view);
     return $view->render();
 }
示例#16
0
 public function addWidget()
 {
     WidgetsList::add('Live!', 'Live_VisitorsInRealTime', 'Live', 'widget');
     WidgetsList::add('Live!', 'Live_VisitorLog', 'Live', 'getVisitorLog', array('small' => 1));
     WidgetsList::add('Live!', 'Live_RealTimeVisitorCount', 'Live', 'getSimpleLastVisitCount');
     WidgetsList::add('Live!', 'Live_VisitorProfile', 'Live', 'getVisitorProfilePopup');
 }
示例#17
0
 public function postLoad()
 {
     if (PluginManager::getInstance()->isPluginActivated('UserCountry')) {
         WidgetsList::add('General_Visitors', Piwik::translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap');
         WidgetsList::add('Live!', Piwik::translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap');
     }
     Piwik::addAction('Template.leftColumnUserCountry', array('Piwik\\Plugins\\UserCountryMap\\UserCountryMap', 'insertMapInLocationReport'));
 }
示例#18
0
 public function configure(WidgetsList $widgetsList)
 {
     $category = 'Referrers_Referrers';
     $controller = 'Referrers';
     $widgetsList->add($category, 'Referrers_WidgetKeywords', $controller, 'getKeywords');
     $widgetsList->add($category, 'Referrers_WidgetExternalWebsites', $controller, 'getWebsites');
     $widgetsList->add($category, 'Referrers_WidgetSocials', $controller, 'getSocials');
     $widgetsList->add($category, 'Referrers_SearchEngines', $controller, 'getSearchEngines');
     $widgetsList->add($category, 'Referrers_Campaigns', $controller, 'getCampaigns');
     $widgetsList->add($category, 'General_Overview', $controller, 'getReferrerType');
     $widgetsList->add($category, 'Referrers_WidgetGetAll', $controller, 'getAll');
     if (SettingsPiwik::isSegmentationEnabled()) {
         $widgetsList->add('SEO', 'Referrers_WidgetTopKeywordsForPages', $controller, 'getKeywordsForPage');
     }
 }
示例#19
0
 public function addWidgets()
 {
     foreach ($this->getRawMetadataReports() as $report) {
         list($category, $name, $controllerName, $controllerAction) = $report;
         if ($category == false) {
             continue;
         }
         WidgetsList::add($category, $name, $controllerName, $controllerAction);
     }
 }
示例#20
0
 public function configure(WidgetsList $widgetsList)
 {
     $widgetContinentLabel = Piwik::translate('UserCountry_WidgetLocation') . ' (' . Piwik::translate('UserCountry_Continent') . ')';
     $widgetCountryLabel = Piwik::translate('UserCountry_WidgetLocation') . ' (' . Piwik::translate('UserCountry_Country') . ')';
     $widgetRegionLabel = Piwik::translate('UserCountry_WidgetLocation') . ' (' . Piwik::translate('UserCountry_Region') . ')';
     $widgetCityLabel = Piwik::translate('UserCountry_WidgetLocation') . ' (' . Piwik::translate('UserCountry_City') . ')';
     $category = 'General_Visitors';
     $controller = 'UserCountry';
     WidgetsList::add($category, $widgetContinentLabel, $controller, 'getContinent');
     WidgetsList::add($category, $widgetCountryLabel, $controller, 'getCountry');
     WidgetsList::add($category, $widgetRegionLabel, $controller, 'getRegion');
     WidgetsList::add($category, $widgetCityLabel, $controller, 'getCity');
 }
示例#21
0
 public function test_AvailableWidgetListIsUpToDate()
 {
     $namesOfWidgetsThatAreAPI = $this->getWidgetNames($this->getWidgetsThatAreAPI());
     Piwik::postEvent('Platform.initialized');
     // userCountryMap defines it's Widgets via this event currently
     $currentWidgetNames = array();
     foreach (WidgetsList::get() as $widgets) {
         $currentWidgetNames = array_merge($this->getWidgetNames($widgets), $currentWidgetNames);
     }
     $allWidgetNames = array_merge($namesOfWidgetsThatAreAPI, $currentWidgetNames);
     $regressedWidgetNames = array_diff($allWidgetNames, $currentWidgetNames);
     $this->assertEmpty($regressedWidgetNames, 'The widgets list is no longer up to date. If you added, removed or renamed a widget please update `getAvailableWidgets()` otherwise you will need to fix it. Different names: ' . var_export($regressedWidgetNames, 1));
 }
示例#22
0
 /**
  * Adds Referrer widgets
  */
 function addWidgets()
 {
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetKeywords', 'Referrers', 'getKeywords');
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetExternalWebsites', 'Referrers', 'getWebsites');
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetSocials', 'Referrers', 'getSocials');
     WidgetsList::add('Referrers_Referrers', 'Referrers_SearchEngines', 'Referrers', 'getSearchEngines');
     WidgetsList::add('Referrers_Referrers', 'Referrers_Campaigns', 'Referrers', 'getCampaigns');
     WidgetsList::add('Referrers_Referrers', 'General_Overview', 'Referrers', 'getReferrerType');
     WidgetsList::add('Referrers_Referrers', 'Referrers_WidgetGetAll', 'Referrers', 'getAll');
     if (SettingsPiwik::isSegmentationEnabled()) {
         WidgetsList::add('SEO', 'Referrers_WidgetTopKeywordsForPages', 'Referrers', 'getKeywordsForPage');
     }
 }
示例#23
0
 private function addSearchWidgets(WidgetsList $widgetsList, $controller)
 {
     $category = 'Actions_SubmenuSitesearch';
     $widgetsList->add($category, 'Actions_WidgetSearchKeywords', $controller, 'getSiteSearchKeywords');
     if (Actions::isCustomVariablesPluginsEnabled()) {
         $widgetsList->add($category, 'Actions_WidgetSearchCategories', $controller, 'getSiteSearchCategories');
     }
     $widgetsList->add($category, 'Actions_WidgetSearchNoResultKeywords', $controller, 'getSiteSearchNoResultKeywords');
     $widgetsList->add($category, 'Actions_WidgetPageUrlsFollowingSearch', $controller, 'getPageUrlsFollowingSiteSearch');
     $widgetsList->add($category, 'Actions_WidgetPageTitlesFollowingSearch', $controller, 'getPageTitlesFollowingSiteSearch');
 }
示例#24
0
 /** Creates two dashboards that split the widgets up into different groups. */
 public function setupDashboards()
 {
     $dashboardColumnCount = 3;
     $dashboardCount = 4;
     $layout = array();
     for ($j = 0; $j != $dashboardColumnCount; ++$j) {
         $layout[] = array();
     }
     $dashboards = array();
     for ($i = 0; $i != $dashboardCount; ++$i) {
         $dashboards[] = $layout;
     }
     $oldGet = $_GET;
     $_GET['idSite'] = 1;
     $_GET['token_auth'] = Fixture::getTokenAuth();
     // collect widgets & sort them so widget order is not important
     $allWidgets = array();
     foreach (WidgetsList::get() as $category => $widgets) {
         $allWidgets = array_merge($allWidgets, $widgets);
     }
     usort($allWidgets, function ($lhs, $rhs) {
         return strcmp($lhs['uniqueId'], $rhs['uniqueId']);
     });
     $widgetsPerDashboard = ceil(count($allWidgets) / $dashboardCount);
     // group widgets so they will be spread out across 3 dashboards
     $groupedWidgets = array();
     $dashboard = 0;
     foreach ($allWidgets as $widget) {
         if ($widget['uniqueId'] == 'widgetSEOgetRank' || $widget['uniqueId'] == 'widgetReferrersgetKeywordsForPage' || $widget['uniqueId'] == 'widgetLivegetVisitorProfilePopup' || $widget['uniqueId'] == 'widgetActionsgetPageTitles' || strpos($widget['uniqueId'], 'widgetExample') === 0) {
             continue;
         }
         $widgetEntry = array('uniqueId' => $widget['uniqueId'], 'parameters' => $widget['parameters']);
         // dashboard images must have height of less than 4000px to avoid odd discoloration of last line of image
         $widgetEntry['parameters']['filter_limit'] = 5;
         $groupedWidgets[$dashboard][] = $widgetEntry;
         if (count($groupedWidgets[$dashboard]) >= $widgetsPerDashboard) {
             $dashboard = $dashboard + 1;
         }
         // sanity check
         if ($dashboard >= $dashboardCount) {
             throw new Exception("Unexpected error: Incorrect dashboard widget placement logic. Something's wrong w/ the code.");
         }
     }
     // distribute widgets in each dashboard
     $column = 0;
     foreach ($groupedWidgets as $dashboardIndex => $dashboardWidgets) {
         foreach ($dashboardWidgets as $widget) {
             $column = ($column + 1) % $dashboardColumnCount;
             $dashboards[$dashboardIndex][$column][] = $widget;
         }
     }
     foreach ($dashboards as $id => $layout) {
         if ($id == 0) {
             $_GET['name'] = self::makeXssContent('dashboard name' . $id);
         } else {
             $_GET['name'] = 'dashboard name' . $id;
         }
         $_GET['layout'] = json_encode($layout);
         $_GET['idDashboard'] = $id + 1;
         FrontController::getInstance()->fetchDispatch('Dashboard', 'saveLayout');
     }
     // create empty dashboard
     $dashboard = array(array(array('uniqueId' => "widgetVisitsSummarygetEvolutionGraphcolumnsArray", 'parameters' => array('module' => 'VisitsSummary', 'action' => 'getEvolutionGraph', 'columns' => 'nb_visits'))), array(), array());
     $_GET['name'] = 'D4';
     $_GET['layout'] = json_encode($dashboard);
     $_GET['idDashboard'] = 5;
     $_GET['idSite'] = 2;
     FrontController::getInstance()->fetchDispatch('Dashboard', 'saveLayout');
     $_GET = $oldGet;
 }
示例#25
0
 function addWidgets()
 {
     WidgetsList::add('General_Actions', 'General_Pages', 'Actions', 'getPageUrls');
     WidgetsList::add('General_Actions', 'Actions_WidgetPageTitles', 'Actions', 'getPageTitles');
     WidgetsList::add('General_Actions', 'General_Outlinks', 'Actions', 'getOutlinks');
     WidgetsList::add('General_Actions', 'General_Downloads', 'Actions', 'getDownloads');
     WidgetsList::add('General_Actions', 'Actions_WidgetPagesEntry', 'Actions', 'getEntryPageUrls');
     WidgetsList::add('General_Actions', 'Actions_WidgetPagesExit', 'Actions', 'getExitPageUrls');
     WidgetsList::add('General_Actions', 'Actions_WidgetEntryPageTitles', 'Actions', 'getEntryPageTitles');
     WidgetsList::add('General_Actions', 'Actions_WidgetExitPageTitles', 'Actions', 'getExitPageTitles');
     if ($this->isSiteSearchEnabled()) {
         WidgetsList::add('Actions_SubmenuSitesearch', 'Actions_WidgetSearchKeywords', 'Actions', 'getSiteSearchKeywords');
         if (self::isCustomVariablesPluginsEnabled()) {
             WidgetsList::add('Actions_SubmenuSitesearch', 'Actions_WidgetSearchCategories', 'Actions', 'getSiteSearchCategories');
         }
         WidgetsList::add('Actions_SubmenuSitesearch', 'Actions_WidgetSearchNoResultKeywords', 'Actions', 'getSiteSearchNoResultKeywords');
         WidgetsList::add('Actions_SubmenuSitesearch', 'Actions_WidgetPageUrlsFollowingSearch', 'Actions', 'getPageUrlsFollowingSiteSearch');
         WidgetsList::add('Actions_SubmenuSitesearch', 'Actions_WidgetPageTitlesFollowingSearch', 'Actions', 'getPageTitlesFollowingSiteSearch');
     }
 }
示例#26
0
 /**
  * Adds the various User Settings widgets
  */
 function addWidgets()
 {
     // in this case, Widgets have same names as API reports
     foreach ($this->reportMetadata as $report) {
         list($category, $name, $controllerName, $controllerAction) = $report;
         if ($category == false) {
             continue;
         }
         WidgetsList::add($category, $name, $controllerName, $controllerAction);
     }
 }
示例#27
0
 function addWidgets()
 {
     WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitTime_WidgetLocalTime', 'VisitTime', 'getVisitInformationPerLocalTime');
     WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitTime_WidgetServerTime', 'VisitTime', 'getVisitInformationPerServerTime');
     WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitTime_VisitsByDayOfWeek', 'VisitTime', 'getByDayOfWeek');
 }
示例#28
0
 /**
  * By default a widget will be configured for this report if a {@link $widgetTitle} is set. If you want to customize
  * the way the widget is added or modify any other behavior you can overwrite this method.
  * @param WidgetsList $widget
  * @api
  */
 public function configureWidget(WidgetsList $widget)
 {
     if ($this->widgetTitle) {
         $params = array();
         if (!empty($this->widgetParams) && is_array($this->widgetParams)) {
             $params = $this->widgetParams;
         }
         $widget->add($this->category, $this->widgetTitle, $this->module, $this->action, $params);
     }
 }
示例#29
0
 public function removeDisabledPluginFromLayout($layout)
 {
     $layoutObject = $this->decodeLayout($layout);
     // if the json decoding works (ie. new Json format)
     // we will only return the widgets that are from enabled plugins
     if (is_array($layoutObject)) {
         $layoutObject = (object) array('config' => array('layout' => '33-33-33'), 'columns' => $layoutObject);
     }
     if (empty($layoutObject) || empty($layoutObject->columns)) {
         $layoutObject = (object) array('config' => array('layout' => '33-33-33'), 'columns' => array());
     }
     foreach ($layoutObject->columns as &$row) {
         if (!is_array($row)) {
             $row = array();
             continue;
         }
         foreach ($row as $widgetId => $widget) {
             if (isset($widget->parameters->module)) {
                 $controllerName = $widget->parameters->module;
                 $controllerAction = $widget->parameters->action;
                 if (!WidgetsList::isDefined($controllerName, $controllerAction)) {
                     unset($row[$widgetId]);
                 }
             } else {
                 unset($row[$widgetId]);
             }
         }
     }
     $layout = $this->encodeLayout($layoutObject);
     return $layout;
 }
示例#30
0
 function addWidgets()
 {
     WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitsSummary_WidgetLastVisits', 'VisitsSummary', 'getEvolutionGraph', array('columns' => array('nb_visits')));
     WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitsSummary_WidgetVisits', 'VisitsSummary', 'getSparklines');
     WidgetsList::add('VisitsSummary_VisitsSummary', 'VisitsSummary_WidgetOverviewGraph', 'VisitsSummary', 'index');
 }