本文整理汇总了PHP中Piwik\DataTable\Map::getEmptyClone方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::getEmptyClone方法的具体用法?PHP Map::getEmptyClone怎么用?PHP Map::getEmptyClone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataTable\Map
的用法示例。
在下文中一共展示了Map::getEmptyClone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manipulateDataTableMap
/**
* Manipulates child DataTables of a DataTable\Map. See @manipulate for more info.
*
* @param DataTable\Map $dataTable
* @return DataTable\Map
*/
protected function manipulateDataTableMap($dataTable)
{
$result = $dataTable->getEmptyClone();
foreach ($dataTable->getDataTables() as $tableLabel => $childTable) {
$newTable = $this->manipulate($childTable);
$result->addTable($newTable, $tableLabel);
}
return $result;
}
示例2: getMultiRowEvolution
/** Get row evolution for a multiple labels */
private function getMultiRowEvolution(DataTable\Map $dataTable, $metadata, $apiModule, $apiAction, $labels, $column, $legendAppendMetric = true, $labelUseAbsoluteUrl = true)
{
if (!isset($metadata['metrics'][$column])) {
// invalid column => use the first one that's available
$metrics = array_keys($metadata['metrics']);
$column = reset($metrics);
}
// get the processed label and logo (if any) for every requested label
$actualLabels = $logos = array();
foreach ($labels as $labelIdx => $label) {
foreach ($dataTable->getDataTables() as $table) {
$labelRow = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
if ($labelRow) {
$actualLabels[$labelIdx] = $this->getRowUrlForEvolutionLabel($labelRow, $apiModule, $apiAction, $labelUseAbsoluteUrl);
$logos[$labelIdx] = $labelRow->getMetadata('logo');
if (!empty($actualLabels[$labelIdx])) {
break;
}
}
}
if (empty($actualLabels[$labelIdx])) {
$actualLabels[$labelIdx] = $this->cleanOriginalLabel($label);
}
}
// convert rows to be array($column.'_'.$labelIdx => $value) as opposed to
// array('label' => $label, 'column' => $value).
$dataTableMulti = $dataTable->getEmptyClone();
foreach ($dataTable->getDataTables() as $tableLabel => $table) {
$newRow = new Row();
foreach ($labels as $labelIdx => $label) {
$row = $this->getRowEvolutionRowFromLabelIdx($table, $labelIdx);
$value = 0;
if ($row) {
$value = $row->getColumn($column);
$value = floatVal(str_replace(',', '.', $value));
}
if ($value == '') {
$value = 0;
}
$newLabel = $column . '_' . (int) $labelIdx;
$newRow->addColumn($newLabel, $value);
}
$newTable = $table->getEmptyClone();
if (!empty($labels)) {
// only add a row if the row has data (no labels === no data)
$newTable->addRow($newRow);
}
$dataTableMulti->addTable($newTable, $tableLabel);
}
// the available metrics for the report are returned as metadata / columns
$metadata['columns'] = $metadata['metrics'];
// metadata / metrics should document the rows that are compared
// this way, UI code can be reused
$metadata['metrics'] = array();
foreach ($actualLabels as $labelIndex => $label) {
if ($legendAppendMetric) {
$label .= ' (' . $metadata['columns'][$column] . ')';
}
$metricName = $column . '_' . $labelIndex;
$metadata['metrics'][$metricName] = SafeDecodeLabel::decodeLabelSafe($label);
if (!empty($logos[$labelIndex])) {
$metadata['logos'][$metricName] = $logos[$labelIndex];
}
}
$this->enhanceRowEvolutionMetaData($metadata, $dataTableMulti);
return array('column' => $column, 'reportData' => $dataTableMulti, 'metadata' => $metadata);
}
示例3: manipulateDataTable
/**
* Filter a DataTable instance. See @filter for more info.
*
* @param DataTable\Simple|DataTable\Map $dataTable
* @return mixed
*/
protected function manipulateDataTable($dataTable)
{
$result = $dataTable->getEmptyClone();
foreach ($this->labels as $labelIndex => $label) {
$row = null;
foreach ($this->getLabelVariations($label) as $labelVariation) {
$labelVariation = explode(self::SEPARATOR_RECURSIVE_LABEL, $labelVariation);
$row = $this->doFilterRecursiveDescend($labelVariation, $dataTable);
if ($row) {
if ($this->addLabelIndex) {
$row->setMetadata(self::FLAG_IS_ROW_EVOLUTION, $labelIndex);
}
$result->addRow($row);
break;
}
}
}
return $result;
}