当前位置: 首页>>代码示例>>PHP>>正文


PHP WidgetsList::get方法代码示例

本文整理汇总了PHP中Piwik\WidgetsList::get方法的典型用法代码示例。如果您正苦于以下问题:PHP WidgetsList::get方法的具体用法?PHP WidgetsList::get怎么用?PHP WidgetsList::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\WidgetsList的用法示例。


在下文中一共展示了WidgetsList::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     $view = new View('@Widgetize/index');
     $view->availableWidgets = Common::json_encode(WidgetsList::get());
     $this->setGeneralVariablesView($view);
     return $view->render();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:7,代码来源:Controller.php

示例2: 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));
 }
开发者ID:sebastianpiskorski,项目名称:piwik,代码行数:13,代码来源:WidgetTest.php

示例3: 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;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:71,代码来源:UITestFixture.php

示例4: test_configureWidget_shouldMixinWidgetParametersIfSet

 public function test_configureWidget_shouldMixinWidgetParametersIfSet()
 {
     $widgets = WidgetsList::get();
     $this->assertCount(0, $widgets);
     $this->advancedReport->set('widgetParams', array('foo' => 'bar'));
     $this->advancedReport->configureWidget(WidgetsList::getInstance());
     $widgets = WidgetsList::get();
     $this->assertCount(1, $widgets);
     $this->assertEquals(array('module' => 'TestPlugin', 'action' => 'getAdvancedReport', 'foo' => 'bar'), $widgets['Goals_Goals'][0]['parameters']);
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:10,代码来源:ReportTest.php

示例5: getAvailableWidgets

 public function getAvailableWidgets()
 {
     $this->checkTokenInUrl();
     Json::sendHeaderJSON();
     return Common::json_encode(WidgetsList::get());
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:6,代码来源:Controller.php

示例6: testRemove

 /**
  * @group Core
  */
 public function testRemove()
 {
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     Fixture::createWebsite('2009-01-04 00:11:42', true);
     API::getInstance()->addGoal(1, 'Goal 1 - Thank you', 'title', 'Thank you', 'contains', $caseSensitive = false, $revenue = 10, $allowMultipleConversions = 1);
     $_GET['idSite'] = 1;
     WidgetsList::_reset();
     $widgets = WidgetsList::get();
     $this->assertCount(14, $widgets);
     WidgetsList::remove('SEO', 'NoTeXiStInG');
     $widgets = WidgetsList::get();
     $this->assertCount(14, $widgets);
     $this->assertArrayHasKey('SEO', $widgets);
     $this->assertCount(2, $widgets['SEO']);
     WidgetsList::remove('SEO', 'SEO_SeoRankings');
     $widgets = WidgetsList::get();
     $this->assertCount(1, $widgets['SEO']);
     WidgetsList::remove('SEO');
     $widgets = WidgetsList::get();
     $this->assertArrayNotHasKey('SEO', $widgets);
     WidgetsList::_reset();
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:28,代码来源:WidgetsListTest.php

示例7: foreach

?>
" scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>
</div>

<br/>

<?php 
$_GET['idSite'] = $idSite;
define('PIWIK_INCLUDE_PATH', '../..');
define('PIWIK_ENABLE_DISPATCH', false);
define('PIWIK_ENABLE_ERROR_HANDLER', false);
define('PIWIK_ENABLE_SESSION_START', false);
require_once PIWIK_INCLUDE_PATH . "/index.php";
require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
FrontController::getInstance()->init();
$widgets = WidgetsList::get();
foreach ($widgets as $category => $widgetsInCategory) {
    echo '<h2>' . $category . '</h2>';
    foreach ($widgetsInCategory as $widget) {
        echo '<h3>' . $widget['name'] . '</h3>';
        $widgetUrl = UrlHelper::getArrayFromQueryString($url);
        $widgetUrl['moduleToWidgetize'] = $widget['parameters']['module'];
        $widgetUrl['actionToWidgetize'] = $widget['parameters']['action'];
        $parameters = $widget['parameters'];
        unset($parameters['module']);
        unset($parameters['action']);
        foreach ($parameters as $name => $value) {
            if (is_array($value)) {
                $value = current($value);
            }
            $widgetUrl[$name] = $value;
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:31,代码来源:iframeWidget_localhost.php


注:本文中的Piwik\WidgetsList::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。