当前位置: 首页>>代码示例>>PHP>>正文


PHP Map::getEmptyClone方法代码示例

本文整理汇总了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;
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:15,代码来源:DataTableManipulator.php

示例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);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:68,代码来源:RowEvolution.php

示例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;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:25,代码来源:LabelFilter.php


注:本文中的Piwik\DataTable\Map::getEmptyClone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。