getCategoryId() public method

Get the translated name of the category the report belongs to.
public getCategoryId ( ) : string
return string
Esempio n. 1
0
 /**
  * Creates a new container widget based on the specified report in {@link construct()}.
  *
  * It will automatically use the report's categoryId, subcategoryId (if specified) and order in order to
  * create the container.
  *
  * @param string $containerId eg 'Products' or 'Contents' see {Piwik\Widget\WidgetContainerConfig::setId()}.
  *                            Other reports or widgets will be able to add more widgets to this container.
  *                            This is useful when you want to show for example multiple related widgets
  *                            together.
  * @return WidgetContainerConfig
  */
 public function createContainerWidget($containerId)
 {
     $widget = new WidgetContainerConfig();
     $widget->setCategoryId($this->report->getCategoryId());
     $widget->setId($containerId);
     if ($this->report->getSubcategoryId()) {
         $widget->setSubcategoryId($this->report->getSubcategoryId());
     }
     $orderThatListsReportsAtTheEndOfEachCategory = 100 + $this->report->getOrder();
     $widget->setOrder($orderThatListsReportsAtTheEndOfEachCategory);
     return $widget;
 }
Esempio n. 2
0
 /**
  * API metadata are sorted by category/name,
  * with a little tweak to replicate the standard Piwik category ordering
  *
  * @param Report $a
  * @param Report $b
  * @return int
  */
 private function sort($a, $b)
 {
     return $this->compareCategories($a->getCategoryId(), $a->getSubcategoryId(), $a->getOrder(), $b->getCategoryId(), $b->getSubcategoryId(), $b->getOrder());
 }