本文整理汇总了PHP中Piwik\Plugin\Report::getCategoryId方法的典型用法代码示例。如果您正苦于以下问题:PHP Report::getCategoryId方法的具体用法?PHP Report::getCategoryId怎么用?PHP Report::getCategoryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Plugin\Report
的用法示例。
在下文中一共展示了Report::getCategoryId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createContainerWidget
/**
* 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;
}
示例2: sort
/**
* 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());
}