當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。