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


PHP DataTable::setLabelsHaveChanged方法代码示例

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


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

示例1: filter

 /**
  * See {@link GroupBy}.
  *
  * @param DataTable $table
  */
 public function filter($table)
 {
     /** @var Row[] $groupByRows */
     $groupByRows = array();
     $nonGroupByRowIds = array();
     foreach ($table->getRowsWithoutSummaryRow() as $rowId => $row) {
         $groupByColumnValue = $row->getColumn($this->groupByColumn);
         $groupByValue = $groupByColumnValue;
         // reduce the group by column of this row
         if ($this->reduceFunction) {
             $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;
         }
     }
     if ($this->groupByColumn === 'label') {
         $table->setLabelsHaveChanged();
     }
     // delete the unneeded rows.
     $table->deleteRows($nonGroupByRowIds);
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:36,代码来源:GroupBy.php

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


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