本文整理汇总了PHP中Piwik\WidgetsList类的典型用法代码示例。如果您正苦于以下问题:PHP WidgetsList类的具体用法?PHP WidgetsList怎么用?PHP WidgetsList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WidgetsList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
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: configure
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);
}
}
示例3: addGoalsWidgets
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']));
}
}
}
示例4: addWidgets
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');
}
示例5: registerWidgets
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');
}
}
示例6: addWidgets
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);
}
}
示例7: index
public function index()
{
$view = new View('@Widgetize/index');
$view->availableWidgets = Common::json_encode(WidgetsList::get());
$this->setGeneralVariablesView($view);
return $view->render();
}
示例8: addWidget
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');
}
示例9: postLoad
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'));
}
示例10: addWidgets
public function addWidgets()
{
foreach ($this->getRawMetadataReports() as $report) {
list($category, $name, $controllerName, $controllerAction) = $report;
if ($category == false) {
continue;
}
WidgetsList::add($category, $name, $controllerName, $controllerAction);
}
}
示例11: test_AvailableWidgetListIsUpToDate
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));
}
示例12: addWidgets
/**
* 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');
}
}
示例13: addSearchWidgets
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');
}
示例14: setupDashboards
/** 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;
}
示例15: addWidgets
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');
}
}