本文整理汇总了PHP中Piwik_DataTable::getMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::getMetadata方法的具体用法?PHP Piwik_DataTable::getMetadata怎么用?PHP Piwik_DataTable::getMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable
的用法示例。
在下文中一共展示了Piwik_DataTable::getMetadata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPastDataMetadata
/**
* Sets the total evolution metadata for a datatable returned by $this->buildDataTable
* given data for the last period.
*
* @param Piwik_DataTable $dataTable
* @param Piwik_DataTable $pastData
* @param array $apiMetrics Metrics info.
*/
private function setPastDataMetadata($dataTable, $pastData, $apiMetrics)
{
if ($dataTable instanceof Piwik_DataTable_Array) {
$pastArray = $pastData->getArray();
foreach ($dataTable->getArray() as $subTable) {
$this->setPastDataMetadata($subTable, current($pastArray), $apiMetrics);
next($pastArray);
}
} else {
// calculate total visits/actions/revenue for past data
$this->setMetricsTotalsMetadata($pastData, $apiMetrics);
foreach ($apiMetrics as $label => $metricInfo) {
// get the names of metadata to set
$totalMetadataName = self::getTotalMetadataName($label);
$lastPeriodTotalMetadataName = self::getLastPeriodMetadataName($totalMetadataName);
$totalEvolutionMetadataName = self::getTotalMetadataName($metricInfo[self::METRIC_EVOLUTION_COL_NAME_KEY]);
// set last period total
$pastTotal = $pastData->getMetadata($totalMetadataName);
$dataTable->setMetadata($lastPeriodTotalMetadataName, $pastTotal);
// calculate & set evolution
$currentTotal = $dataTable->getMetadata($totalMetadataName);
$evolution = Piwik_MultiSites_CalculateEvolutionFilter::calculate($currentTotal, $pastTotal);
$dataTable->setMetadata($totalEvolutionMetadataName, $evolution);
}
}
}