php Piwik-WidgetsList类(方法)实例源码

下面列出了php Piwik-WidgetsList 类(方法)源码代码实例,从而了解它的用法。

作者:brienomatt    项目:elmsl   
public function configure(WidgetsList $widgetsList)
 {
     $category = 'Example Widgets';
     $controller = 'CoreHome';
     $widgetsList->add($category, 'CoreHome_SupportPiwik', $controller, 'getDonateForm');
     $widgetsList->add($category, 'Installation_Welcome', $controller, 'getPromoVideo');
 }

作者:kreyne    项目:elmsl   
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);
     }
 }

作者:brienomatt    项目:elmsl   
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']));
         }
     }
 }

作者:KiwiJuice    项目:handball-dacha   
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');
 }

作者:CaptainShar    项目:SSAD_Projec   
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');
     }
 }

作者:carriercom    项目:piwi   
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);
     }
 }

作者:carriercom    项目:piwi   
public function index()
 {
     $view = new View('@Widgetize/index');
     $view->availableWidgets = Common::json_encode(WidgetsList::get());
     $this->setGeneralVariablesView($view);
     return $view->render();
 }

作者:KiwiJuice    项目:handball-dacha   
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');
 }

作者:a4tunad    项目:piwi   
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'));
 }

作者:carriercom    项目:piwi   
public function addWidgets()
 {
     foreach ($this->getRawMetadataReports() as $report) {
         list($category, $name, $controllerName, $controllerAction) = $report;
         if ($category == false) {
             continue;
         }
         WidgetsList::add($category, $name, $controllerName, $controllerAction);
     }
 }

作者:sebastianpiskorsk    项目:piwi   
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));
 }

作者:KiwiJuice    项目:handball-dacha   
/**
  * 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');
     }
 }

作者:kreyne    项目:elmsl   
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');
 }

作者:FluentDevelopmen    项目:piwi   
/** 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;
 }

作者:KiwiJuice    项目:handball-dacha   
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');
     }
 }

作者:KiwiJuice    项目:handball-dacha   
/**
  * 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);
     }
 }

作者:KiwiJuice    项目:handball-dacha   
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');
 }

作者:jos    项目:CGE-File-Sharin   
/**
  * 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);
     }
 }

作者:diosmosi    项目:piwi   
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;
 }

作者:carriercom    项目:piwi   
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');
 }


问题


面经


文章

微信
公众号

扫码关注公众号