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


PHP Row::getColumn方法代码示例

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


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

示例1: flattenRow

 /**
  * @param Row $row
  * @param DataTable $dataTable
  * @param string $labelPrefix
  * @param bool $parentLogo
  */
 private function flattenRow(Row $row, DataTable $dataTable, $labelPrefix = '', $parentLogo = false)
 {
     $label = $row->getColumn('label');
     if ($label !== false) {
         $label = trim($label);
         if (substr($label, 0, 1) == '/' && $this->recursiveLabelSeparator == '/') {
             $label = substr($label, 1);
         }
         $label = $labelPrefix . $label;
         $row->setColumn('label', $label);
     }
     $logo = $row->getMetadata('logo');
     if ($logo === false && $parentLogo !== false) {
         $logo = $parentLogo;
         $row->setMetadata('logo', $logo);
     }
     $subTable = $this->loadSubtable($dataTable, $row);
     $row->removeSubtable();
     if ($subTable === null) {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 0);
         }
         $dataTable->addRow($row);
     } else {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 1);
             $dataTable->addRow($row);
         }
         $prefix = $label . $this->recursiveLabelSeparator;
         foreach ($subTable->getRows() as $row) {
             $this->flattenRow($row, $dataTable, $prefix, $logo);
         }
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:40,代码来源:Flattener.php

示例2: getColumnValue

 private function getColumnValue(Row $row)
 {
     $value = $row->getColumn($this->config->primaryColumnToSort);
     if ($value === false || is_array($value)) {
         return null;
     }
     return $value;
 }
开发者ID:piwik,项目名称:piwik,代码行数:8,代码来源:Sorter.php

示例3: getColumn

 /**
  * Returns column from a given row.
  * Will work with 2 types of datatable
  * - raw datatables coming from the archive DB, which columns are int indexed
  * - datatables processed resulting of API calls, which columns have human readable english names
  *
  * @param Row|array $row
  * @param int $columnIdRaw see consts in Archive::
  * @param bool|array $mappingIdToName
  * @return mixed  Value of column, false if not found
  */
 public function getColumn($row, $columnIdRaw, $mappingIdToName = false)
 {
     if (empty($mappingIdToName)) {
         $mappingIdToName = Metrics::$mappingFromIdToName;
     }
     $columnIdReadable = $mappingIdToName[$columnIdRaw];
     if ($row instanceof Row) {
         $raw = $row->getColumn($columnIdRaw);
         if ($raw !== false) {
             return $raw;
         }
         return $row->getColumn($columnIdReadable);
     }
     if (isset($row[$columnIdRaw])) {
         return $row[$columnIdRaw];
     }
     if (isset($row[$columnIdReadable])) {
         return $row[$columnIdReadable];
     }
     return false;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:32,代码来源:Base.php

示例4: sort

 public function sort(Row $a, Row $b)
 {
     foreach ($this->columnsToCheck as $column) {
         if ($column) {
             $valA = $a->getColumn($column);
             $valB = $b->getColumn($column);
             $sort = $this->sortVal($valA, $valB);
             if (isset($sort)) {
                 return $sort;
             }
         }
     }
     return 0;
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:14,代码来源:OrderBy.php

示例5: flattenRow

 /**
  * @param Row $row
  * @param DataTable $dataTable
  * @param string $labelPrefix
  * @param bool $parentLogo
  */
 private function flattenRow(Row $row, $rowId, DataTable $dataTable, $labelPrefix = '', $parentLogo = false)
 {
     $label = $row->getColumn('label');
     if ($label !== false) {
         $label = trim($label);
         if ($this->recursiveLabelSeparator == '/') {
             if (substr($label, 0, 1) == '/') {
                 $label = substr($label, 1);
             } elseif ($rowId === DataTable::ID_SUMMARY_ROW && $labelPrefix && $label != DataTable::LABEL_SUMMARY_ROW) {
                 $label = ' - ' . $label;
             }
         }
         $label = $labelPrefix . $label;
         $row->setColumn('label', $label);
     }
     $logo = $row->getMetadata('logo');
     if ($logo === false && $parentLogo !== false) {
         $logo = $parentLogo;
         $row->setMetadata('logo', $logo);
     }
     /** @var DataTable $subTable */
     $subTable = $row->getSubtable();
     if ($subTable) {
         $subTable->applyQueuedFilters();
         $row->deleteMetadata('idsubdatatable_in_db');
     } else {
         $subTable = $this->loadSubtable($dataTable, $row);
     }
     $row->removeSubtable();
     if ($subTable === null) {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 0);
         }
         $dataTable->addRow($row);
     } else {
         if ($this->includeAggregateRows) {
             $row->setMetadata('is_aggregate', 1);
             $dataTable->addRow($row);
         }
         $prefix = $label . $this->recursiveLabelSeparator;
         foreach ($subTable->getRows() as $rowId => $row) {
             $this->flattenRow($row, $rowId, $dataTable, $prefix, $logo);
         }
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:51,代码来源:Flattener.php

示例6: getRowFromTable

 private function getRowFromTable(DataTable $table, DataTable\Row $row)
 {
     return $table->getRowFromLabel($row->getColumn('label'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:4,代码来源:Insight.php

示例7: enrichWithUniqueVisitorsMetric

 protected function enrichWithUniqueVisitorsMetric(Row $row)
 {
     // skip unique visitors metrics calculation if calculating for multiple sites is disabled
     if (!$this->getParams()->isSingleSite() && $this->skipUniqueVisitorsCalculationForMultipleSites) {
         return;
     }
     if ($row->getColumn('nb_uniq_visitors') === false && $row->getColumn('nb_users') === false) {
         return;
     }
     if (!SettingsPiwik::isUniqueVisitorsEnabled($this->getParams()->getPeriod()->getLabel())) {
         $row->deleteColumn('nb_uniq_visitors');
         $row->deleteColumn('nb_users');
         return;
     }
     $metrics = array(Metrics::INDEX_NB_USERS);
     if ($this->getParams()->isSingleSite()) {
         $uniqueVisitorsMetric = Metrics::INDEX_NB_UNIQ_VISITORS;
     } else {
         if (!SettingsPiwik::isSameFingerprintAcrossWebsites()) {
             throw new Exception("Processing unique visitors across websites is enabled for this instance,\n                            but to process this metric you must first set enable_fingerprinting_across_websites=1\n                            in the config file, under the [Tracker] section.");
         }
         $uniqueVisitorsMetric = Metrics::INDEX_NB_UNIQ_FINGERPRINTS;
     }
     $metrics[] = $uniqueVisitorsMetric;
     $uniques = $this->computeNbUniques($metrics);
     // see edge case as described in https://github.com/piwik/piwik/issues/9357 where uniq_visitors might be higher
     // than visits because we archive / process it after nb_visits. Between archiving nb_visits and nb_uniq_visitors
     // there could have been a new visit leading to a higher nb_unique_visitors than nb_visits which is not possible
     // by definition. In this case we simply use the visits metric instead of unique visitors metric.
     $visits = $row->getColumn('nb_visits');
     if ($visits !== false && $uniques[$uniqueVisitorsMetric] !== false) {
         $uniques[$uniqueVisitorsMetric] = min($uniques[$uniqueVisitorsMetric], $visits);
     }
     $row->setColumn('nb_uniq_visitors', $uniques[$uniqueVisitorsMetric]);
     $row->setColumn('nb_users', $uniques[Metrics::INDEX_NB_USERS]);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:36,代码来源:ArchiveProcessor.php

示例8: getElementToReplace

 /**
  * Returns the element that should be replaced
  *
  * @param Row $row
  * @param string $columnToFilter
  * @return mixed
  */
 protected function getElementToReplace($row, $columnToFilter)
 {
     return $row->getColumn($columnToFilter);
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:11,代码来源:ColumnCallbackReplace.php

示例9: getReferrerSummaryForVisit

 /**
  * Returns a summary for a visit's referral.
  *
  * @param Row $visit
  * @return bool|mixed|string
  * @ignore
  */
 public static function getReferrerSummaryForVisit($visit)
 {
     $referrerType = $visit->getColumn('referrerType');
     if ($referrerType === false || $referrerType == 'direct') {
         $result = Piwik::translate('Referrers_DirectEntry');
     } else {
         if ($referrerType == 'search') {
             $result = $visit->getColumn('referrerName');
             $keyword = $visit->getColumn('referrerKeyword');
             if ($keyword !== false && $keyword != APIReferrers::getKeywordNotDefinedString()) {
                 $result .= ' (' . $keyword . ')';
             }
         } else {
             if ($referrerType == 'campaign') {
                 $result = Piwik::translate('Referrers_ColumnCampaign') . ' (' . $visit->getColumn('referrerName') . ')';
             } else {
                 $result = $visit->getColumn('referrerName');
             }
         }
     }
     return $result;
 }
开发者ID:TensorWrenchOSS,项目名称:piwik,代码行数:29,代码来源:API.php

示例10: enrichWithUniqueVisitorsMetric

 protected function enrichWithUniqueVisitorsMetric(Row $row)
 {
     // skip unique visitors metrics calculation if calculating for multiple sites is disabled
     if (!$this->getParams()->isSingleSite() && $this->skipUniqueVisitorsCalculationForMultipleSites) {
         return;
     }
     if ($row->getColumn('nb_uniq_visitors') === false && $row->getColumn('nb_users') === false) {
         return;
     }
     if (!SettingsPiwik::isUniqueVisitorsEnabled($this->getParams()->getPeriod()->getLabel())) {
         $row->deleteColumn('nb_uniq_visitors');
         $row->deleteColumn('nb_users');
         return;
     }
     $metrics = array(Metrics::INDEX_NB_USERS);
     if ($this->getParams()->isSingleSite()) {
         $uniqueVisitorsMetric = Metrics::INDEX_NB_UNIQ_VISITORS;
     } else {
         if (!SettingsPiwik::isSameFingerprintAcrossWebsites()) {
             throw new Exception("Processing unique visitors across websites is enabled for this instance,\n                            but to process this metric you must first set enable_fingerprinting_across_websites=1\n                            in the config file, under the [Tracker] section.");
         }
         $uniqueVisitorsMetric = Metrics::INDEX_NB_UNIQ_FINGERPRINTS;
     }
     $metrics[] = $uniqueVisitorsMetric;
     $uniques = $this->computeNbUniques($metrics);
     $row->setColumn('nb_uniq_visitors', $uniques[$uniqueVisitorsMetric]);
     $row->setColumn('nb_users', $uniques[Metrics::INDEX_NB_USERS]);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:28,代码来源:ArchiveProcessor.php

示例11: getColumnValue

 protected function getColumnValue(Row $row)
 {
     $value = $row->getColumn($this->columnToSort);
     if ($value === false || is_array($value)) {
         return null;
     }
     return $value;
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:8,代码来源:Sort.php

示例12: aggregateRowWithLabel

 /**
  * Aggregates the $row columns to this table.
  *
  * $row must have a column "label". The $row will be summed to this table's row with the same label.
  *
  * @param $row
  * @params null|array $columnAggregationOps
  * @throws \Exception
  */
 protected function aggregateRowWithLabel(Row $row, $columnAggregationOps)
 {
     $labelToLookFor = $row->getColumn('label');
     if ($labelToLookFor === false) {
         throw new Exception("Label column not found in the table to add in addDataTable()");
     }
     $rowFound = $this->getRowFromLabel($labelToLookFor);
     if ($rowFound === false) {
         if ($labelToLookFor === self::LABEL_SUMMARY_ROW) {
             $this->addSummaryRow($row);
         } else {
             $this->addRow($row);
         }
     } else {
         $rowFound->sumRow($row, $copyMeta = true, $columnAggregationOps);
         // if the row to add has a subtable whereas the current row doesn't
         // we simply add it (cloning the subtable)
         // if the row has the subtable already
         // then we have to recursively sum the subtables
         $subTable = $row->getSubtable();
         if ($subTable) {
             $subTable->metadata[self::COLUMN_AGGREGATION_OPS_METADATA_NAME] = $columnAggregationOps;
             $rowFound->sumSubtable($subTable);
         }
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:35,代码来源:DataTable.php

示例13: sumRowMetadata

 /**
  * Sums the metadata in `$rowToSum` with the metadata in `$this` row.
  *
  * @param Row $rowToSum
  */
 public function sumRowMetadata($rowToSum)
 {
     if (!empty($rowToSum->c[self::METADATA]) && !$this->isSummaryRow()) {
         // We shall update metadata, and keep the metadata with the _most visits or pageviews_, rather than first or last seen
         $visits = max($rowToSum->getColumn(Metrics::INDEX_PAGE_NB_HITS) || $rowToSum->getColumn(Metrics::INDEX_NB_VISITS), $rowToSum->getColumn('nb_actions') || $rowToSum->getColumn('nb_visits'));
         if ($visits && $visits > $this->maxVisitsSummed || empty($this->c[self::METADATA])) {
             $this->maxVisitsSummed = $visits;
             $this->c[self::METADATA] = $rowToSum->c[self::METADATA];
         }
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:16,代码来源:Row.php

示例14: getPastRowFromCurrent

 /**
  * public for Insights use.
  */
 public function getPastRowFromCurrent(Row $row)
 {
     return $this->pastData->getRowFromLabel($row->getColumn('label'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:EvolutionMetric.php

示例15: mergeChildren_checkRow

 private function mergeChildren_checkRow(Row $row, $expectedLabel, $expectedColumnValue)
 {
     $this->assertEquals($expectedLabel, $row->getColumn('label'));
     $this->assertEquals($expectedColumnValue, $row->getColumn('col1'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:5,代码来源:MapTest.php


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