本文整理匯總了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);
}
}
}