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


PHP DataTable::getRows方法代码示例

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


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

示例1: assertColumnValues

 protected function assertColumnValues($rowsWithValues)
 {
     $index = 0;
     foreach ($this->table->getRows() as $row) {
         $rowToCheck = $rowsWithValues[$index];
         foreach ($rowToCheck as $columnToCheck => $expectedValue) {
             $actualValue = $row->getColumn($columnToCheck);
             $this->assertEquals($expectedValue, $actualValue, "{$columnToCheck} in row {$index} does not match assumed {$actualValue} is {$expectedValue}");
         }
         $index++;
     }
     $this->assertEquals(count($rowsWithValues), $this->table->getRowsCount());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:13,代码来源:BaseUnitTest.php

示例2: filter

 /**
  * See {@link PatternRecursive}.
  * 
  * @param DataTable $table
  * @return int The number of deleted rows.
  */
 public function filter($table)
 {
     $rows = $table->getRows();
     foreach ($rows as $key => $row) {
         // A row is deleted if
         // 1 - its label doesnt contain the pattern
         // AND 2 - the label is not found in the children
         $patternNotFoundInChildren = false;
         try {
             $idSubTable = $row->getIdSubDataTable();
             $subTable = Manager::getInstance()->getTable($idSubTable);
             // we delete the row if we couldn't find the pattern in any row in the
             // children hierarchy
             if ($this->filter($subTable) == 0) {
                 $patternNotFoundInChildren = true;
             }
         } catch (Exception $e) {
             // there is no subtable loaded for example
             $patternNotFoundInChildren = true;
         }
         if ($patternNotFoundInChildren && !Pattern::match($this->patternToSearchQuoted, $row->getColumn($this->columnToFilter), $invertedMatch = false)) {
             $table->deleteRow($key);
         }
     }
     return $table->getRowsCount();
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:32,代码来源:PatternRecursive.php

示例3: filter

 /**
  * @param DataTable $table
  */
 public function filter($table)
 {
     $numRows = 0;
     $lastGroupFromPreviousPage = null;
     foreach ($table->getRows() as $row) {
         $this->addRowIfNeeded($row, $numRows);
         $numRows++;
         $subtable = $row->getSubtable();
         if ($subtable) {
             if (!$this->hasRows()) {
                 $lastGroupFromPreviousPage = $row;
             }
             foreach ($subtable->getRows() as $subRow) {
                 $this->addRowIfNeeded($subRow, $numRows);
                 $numRows++;
             }
             $row->removeSubtable();
         }
         if ($this->hasNumberOfRequestedRowsFound()) {
             break;
         }
     }
     $this->prependGroupIfFirstSiteBelongsToAGroupButGroupIsMissingInRows($lastGroupFromPreviousPage);
     $table->setRows($this->rows);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:NestedSitesLimiter.php

示例4: filter

 /**
  * See {@link ColumnCallbackReplace}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     foreach ($table->getRows() as $row) {
         $extraColumnParameters = array();
         foreach ($this->extraColumnParameters as $columnName) {
             $extraColumnParameters[] = $row->getColumn($columnName);
         }
         foreach ($this->columnsToFilter as $column) {
             // when a value is not defined, we set it to zero by default (rather than displaying '-')
             $value = $this->getElementToReplace($row, $column);
             if ($value === false) {
                 $value = 0;
             }
             $parameters = array_merge(array($value), $extraColumnParameters);
             if (!is_null($this->functionParameters)) {
                 $parameters = array_merge($parameters, $this->functionParameters);
             }
             $newValue = call_user_func_array($this->functionToApply, $parameters);
             $this->setElementToReplace($row, $column, $newValue);
             $this->filterSubTable($row);
         }
     }
     if (in_array('label', $this->columnsToFilter)) {
         // we need to force rebuilding the index
         $table->setLabelsHaveChanged();
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:32,代码来源:ColumnCallbackReplace.php

示例5: filter

 /**
  * See {@link ColumnCallbackAddMetadata}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     if ($this->applyToSummaryRow) {
         $rows = $table->getRows();
     } else {
         $rows = $table->getRowsWithoutSummaryRow();
     }
     foreach ($rows as $key => $row) {
         $parameters = array();
         foreach ($this->columnsToRead as $columnsToRead) {
             $parameters[] = $row->getColumn($columnsToRead);
         }
         if (!is_null($this->functionParameters)) {
             $parameters = array_merge($parameters, $this->functionParameters);
         }
         if (!is_null($this->functionToApply)) {
             $newValue = call_user_func_array($this->functionToApply, $parameters);
         } else {
             $newValue = $parameters[0];
         }
         if ($newValue !== false) {
             $row->addMetadata($this->metadataToAdd, $newValue);
         }
     }
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:30,代码来源:ColumnCallbackAddMetadata.php

示例6: filter

 /**
  * See {@link GroupBy}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     $groupByRows = array();
     $nonGroupByRowIds = array();
     foreach ($table->getRows() as $rowId => $row) {
         // skip the summary row
         if ($rowId == DataTable::ID_SUMMARY_ROW) {
             continue;
         }
         // reduce the group by column of this row
         $groupByColumnValue = $row->getColumn($this->groupByColumn);
         $parameters = array_merge(array($groupByColumnValue), $this->parameters);
         $groupByValue = call_user_func_array($this->reduceFunction, $parameters);
         if (!isset($groupByRows[$groupByValue])) {
             // if we haven't encountered this group by value before, we mark this row as a
             // row to keep, and change the group by column to the reduced value.
             $groupByRows[$groupByValue] = $row;
             $row->setColumn($this->groupByColumn, $groupByValue);
         } else {
             // if we have already encountered this group by value, we add this row to the
             // row that will be kept, and mark this one for deletion
             $groupByRows[$groupByValue]->sumRow($row, $copyMeta = true, $table->getMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME));
             $nonGroupByRowIds[] = $rowId;
         }
     }
     // delete the unneeded rows.
     $table->deleteRows($nonGroupByRowIds);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:33,代码来源:GroupBy.php

示例7: filterTable

 /**
  * @param DataTable $table
  */
 protected function filterTable($table)
 {
     foreach ($table->getRows() as $row) {
         $newColumns = $this->getRenamedColumns($row->getColumns());
         $row->setColumns($newColumns);
         $this->filterSubTable($row);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:11,代码来源:ReplaceColumnNames.php

示例8: filter

 /**
  * See {@link ColumnCallbackDeleteMetadata}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     $this->enableRecursive(true);
     foreach ($table->getRows() as $row) {
         $row->deleteMetadata($this->metadataToRemove);
         $this->filterSubTable($row);
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:13,代码来源:ColumnCallbackDeleteMetadata.php

示例9: filter

 /**
  * Decodes all columns of the given data table
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     foreach ($table->getRows() as $row) {
         $value = $row->getColumn($this->columnToDecode);
         if ($value !== false) {
             $value = self::decodeLabelSafe($value);
             $row->setColumn($this->columnToDecode, $value);
             $this->filterSubTable($row);
         }
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:16,代码来源:SafeDecodeLabel.php

示例10: deleteRowsWithNoVisit

 private function deleteRowsWithNoVisit(DataTable $table)
 {
     foreach ($table->getRows() as $key => $row) {
         $nbVisits = Metric::getMetric($row, 'nb_visits');
         $nbActions = Metric::getMetric($row, 'nb_actions');
         if ($nbVisits == 0 && $nbActions == 0) {
             // case of keyword/website/campaign with a conversion for this day, but no visit, we don't show it
             $table->deleteRow($key);
         }
     }
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:11,代码来源:AddColumnsProcessedMetrics.php

示例11: deleteRowsWithNoVisit

 private function deleteRowsWithNoVisit(DataTable $table)
 {
     $metrics = new Metrics\Processed();
     foreach ($table->getRows() as $key => $row) {
         $nbVisits = $metrics->getColumn($row, Metrics::INDEX_NB_VISITS);
         $nbActions = $metrics->getColumn($row, Metrics::INDEX_NB_ACTIONS);
         if ($nbVisits == 0 && $nbActions == 0) {
             // case of keyword/website/campaign with a conversion for this day, but no visit, we don't show it
             $table->deleteRow($key);
         }
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:12,代码来源:AddColumnsProcessedMetrics.php

示例12: filter

 /**
  * See {@link ColumnCallbackAddColumn}.
  *
  * @param DataTable $table The table to filter.
  */
 public function filter($table)
 {
     foreach ($table->getRows() as $row) {
         $columnValues = array();
         foreach ($this->columns as $column) {
             $columnValues[] = $row->getColumn($column);
         }
         $parameters = array_merge($columnValues, $this->functionParameters);
         $value = call_user_func_array($this->functionToApply, $parameters);
         $row->setColumn($this->columnToAdd, $value);
         $this->filterSubTable($row);
     }
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:18,代码来源:ColumnCallbackAddColumn.php

示例13: filter

 /**
  * Executes the filter an adjusts all columns to fit the defined range
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     foreach ($table->getRows() as $row) {
         $value = $row->getColumn($this->columnToFilter);
         if ($value !== false) {
             if ($value < self::$minimumValue) {
                 $row->setColumn($this->columnToFilter, self::$minimumValue);
             } elseif ($value > self::$maximumValue) {
                 $row->setColumn($this->columnToFilter, self::$maximumValue);
             }
         }
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:18,代码来源:RangeCheck.php

示例14: filter

 /**
  * See {@link AddSegmentByLabelMapping}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     if (empty($this->segment) || empty($this->mapping)) {
         return;
     }
     foreach ($table->getRows() as $row) {
         $label = $row->getColumn('label');
         if (!empty($this->mapping[$label])) {
             $label = $this->mapping[$label];
             $row->setMetadata('segment', $this->segment . '==' . urlencode($label));
         }
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:18,代码来源:AddSegmentByLabelMapping.php

示例15: filter

 /**
  * See {@link ReplaceColumnNames}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     if (!isset($this->nameToAppend) || '' === $this->nameToAppend || false === $this->nameToAppend) {
         return;
     }
     foreach ($table->getRows() as $row) {
         $columns = $row->getColumns();
         foreach ($columns as $column => $value) {
             $row->deleteColumn($column);
             $row->setColumn($column . $this->nameToAppend, $value);
         }
         $this->filterSubTable($row);
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:19,代码来源:AppendNameToColumnNames.php


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