This class is for now not exposed as public API until needed. Categories of plugins will be automatically displayed in the menu at the very right after all core categories.
コード例 #1
0
ファイル: CategoryList.php プロジェクト: piwik/piwik
 /**
  * @return CategoryList
  */
 public static function get()
 {
     $list = new CategoryList();
     $categories = StaticContainer::get('Piwik\\Plugin\\Categories');
     foreach ($categories->getAllCategories() as $category) {
         $list->addCategory($category);
     }
     // move subcategories into categories
     foreach ($categories->getAllSubcategories() as $subcategory) {
         $categoryId = $subcategory->getCategoryId();
         if (!$categoryId) {
             continue;
         }
         if ($list->hasCategory($categoryId)) {
             $category = $list->getCategory($categoryId);
         } else {
             $category = new Category();
             $category->setId($categoryId);
             $list->addCategory($category);
         }
         $category->addSubcategory($subcategory);
     }
     return $list;
 }
コード例 #2
0
ファイル: WidgetMetadata.php プロジェクト: piwik/piwik
 public function buildPageMetadata(Category $category, Subcategory $subcategory, $widgetConfigs)
 {
     $ca = array('uniqueId' => $this->buildPageId($category->getId(), $subcategory->getId()), 'category' => $this->buildCategoryMetadata($category), 'subcategory' => $this->buildSubcategoryMetadata($subcategory), 'widgets' => array());
     foreach ($widgetConfigs as $config) {
         $ca['widgets'][] = $this->buildWidgetMetadata($config);
     }
     return $ca;
 }