public function configure(WidgetsList $widgetsList) { $category = 'Example Widgets'; $controller = 'CoreHome'; $widgetsList->add($category, 'CoreHome_SupportPiwik', $controller, 'getDonateForm'); $widgetsList->add($category, 'Installation_Welcome', $controller, 'getPromoVideo'); }
public function configure(WidgetsList $widgetsList) { $category = 'Insights_WidgetCategory'; $controller = 'Insights'; $widgetsList->add($category, 'Insights_OverviewWidgetTitle', $controller, 'getInsightsOverview'); $widgetsList->add($category, 'Insights_MoversAndShakersWidgetTitle', $controller, 'getOverallMoversAndShakers'); }
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); } }
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'))); }
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'); }
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'); }
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'); }
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'); }
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'])); } } }
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); } }
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'); } }
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); } }
public function index() { $view = new View('@Widgetize/index'); $view->availableWidgets = Common::json_encode(WidgetsList::get()); $this->setGeneralVariablesView($view); return $view->render(); }
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'); }
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')); }
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'); } }
public function addWidgets() { foreach ($this->getRawMetadataReports() as $report) { list($category, $name, $controllerName, $controllerAction) = $report; if ($category == false) { continue; } WidgetsList::add($category, $name, $controllerName, $controllerAction); } }
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'); }
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)); }
/** * 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'); } }
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'); }
/** 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; }
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'); } }
/** * 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); } }
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'); }
/** * 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); } }
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; }
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'); }