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