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


PHP Row::addColumn方法代码示例

本文整理汇总了PHP中Piwik\DataTable\Row::addColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Row::addColumn方法的具体用法?PHP Row::addColumn怎么用?PHP Row::addColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik\DataTable\Row的用法示例。


在下文中一共展示了Row::addColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_getColumn_shouldPassRowToCallable

 public function test_getColumn_shouldPassRowToCallable()
 {
     $callbackRow = null;
     $this->row->addColumn('testClosure', function (Row $row) use(&$callbackRow) {
         $callbackRow = $row;
         return $row;
     });
     $returnedRow = $this->row->getColumn('testClosure');
     $this->assertNotEmpty($callbackRow);
     $this->assertSame($returnedRow, $callbackRow);
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:11,代码来源:RowTest.php

示例2: tryToAddColumn

 private function tryToAddColumn(Row $row, $column, $callable)
 {
     try {
         $row->addColumn($column, $callable);
     } catch (\Exception $e) {
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:7,代码来源:AddColumnsProcessedMetrics.php

示例3: 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

示例4: addColumn

 private function addColumn(Row $row, $columnName, $callback)
 {
     $this->expectedColumns[$columnName] = true;
     $row->addColumn($columnName, $callback);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:5,代码来源:AddColumnsProcessedMetricsGoal.php

示例5: processTableFormat

 /**
  * Convert a dimension-less report to a multi-row two-column data table
  *
  * @static
  * @param  $reportMetadata array
  * @param  $report DataTable
  * @param  $reportColumns array
  * @return array DataTable $report & array $columns
  */
 protected static function processTableFormat($reportMetadata, $report, $reportColumns)
 {
     $finalReport = $report;
     if (empty($reportMetadata['dimension'])) {
         $simpleReportMetrics = $report->getFirstRow();
         if ($simpleReportMetrics) {
             $finalReport = new Simple();
             foreach ($simpleReportMetrics->getColumns() as $metricId => $metric) {
                 $newRow = new Row();
                 $newRow->addColumn("label", $reportColumns[$metricId]);
                 $newRow->addColumn("value", $metric);
                 $finalReport->addRow($newRow);
             }
         }
         $reportColumns = array('label' => Piwik::translate('General_Name'), 'value' => Piwik::translate('General_Value'));
     }
     return array($finalReport, $reportColumns);
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:27,代码来源:ReportRenderer.php


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