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