當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Row::hasColumn方法代碼示例

本文整理匯總了PHP中Piwik\DataTable\Row::hasColumn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Row::hasColumn方法的具體用法?PHP Row::hasColumn怎麽用?PHP Row::hasColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik\DataTable\Row的用法示例。


在下文中一共展示了Row::hasColumn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: selectColumnToExclude

 /**
  * Sets the column to be used for Excluding low population
  *
  * @param DataTable\Row $row
  * @return int
  */
 private function selectColumnToExclude($columnToFilter, $row)
 {
     if ($row->hasColumn($columnToFilter)) {
         return $columnToFilter;
     }
     // filter_excludelowpop=nb_visits but the column name is still Metrics::INDEX_NB_VISITS in the table
     $columnIdToName = Metrics::getMappingFromNameToId();
     if (isset($columnIdToName[$columnToFilter])) {
         $column = $columnIdToName[$columnToFilter];
         if ($row->hasColumn($column)) {
             return $column;
         }
     }
     return $columnToFilter;
 }
開發者ID:diosmosis,項目名稱:piwik,代碼行數:21,代碼來源:ExcludeLowPopulation.php

示例2: selectColumnToSort

 /**
  * Sets the column to be used for sorting
  *
  * @param Row $row
  * @return int
  */
 protected function selectColumnToSort($row)
 {
     $value = $row->hasColumn($this->columnToSort);
     if ($value) {
         return $this->columnToSort;
     }
     $columnIdToName = Metrics::getMappingFromNameToId();
     // sorting by "nb_visits" but the index is Metrics::INDEX_NB_VISITS in the table
     if (isset($columnIdToName[$this->columnToSort])) {
         $column = $columnIdToName[$this->columnToSort];
         $value = $row->hasColumn($column);
         if ($value) {
             return $column;
         }
     }
     // eg. was previously sorted by revenue_per_visit, but this table
     // doesn't have this column; defaults with nb_visits
     $column = Metrics::INDEX_NB_VISITS;
     $value = $row->hasColumn($column);
     if ($value) {
         return $column;
     }
     // even though this column is not set properly in the table,
     // we select it for the sort, so that the table's internal state is set properly
     return $this->columnToSort;
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:32,代碼來源:Sort.php

示例3: getSecondaryColumnToSort

 /**
  * Detect the secondary sort column to be used for sorting
  *
  * @param Row $row
  * @param int|string $primaryColumnToSort
  * @return int
  */
 public function getSecondaryColumnToSort(Row $row, $primaryColumnToSort)
 {
     $defaultSecondaryColumn = array(Metrics::INDEX_NB_VISITS, 'nb_visits');
     if (in_array($primaryColumnToSort, $defaultSecondaryColumn)) {
         // if sorted by visits, then sort by label as a secondary column
         $column = 'label';
         $value = $row->hasColumn($column);
         if ($value !== false) {
             return $column;
         }
         return null;
     }
     if ($primaryColumnToSort !== 'label') {
         // we do not add this by default to make sure we do not sort by label as a first and secondary column
         $defaultSecondaryColumn[] = 'label';
     }
     foreach ($defaultSecondaryColumn as $column) {
         $value = $row->hasColumn($column);
         if ($value !== false) {
             return $column;
         }
     }
 }
開發者ID:piwik,項目名稱:piwik,代碼行數:30,代碼來源:Sorter.php

示例4: test_hasColumn_shouldReturnTrueEvenIfColumnValueIsNull

 public function test_hasColumn_shouldReturnTrueEvenIfColumnValueIsNull()
 {
     $this->assertFalse($this->row->hasColumn('test'));
     $this->row->setColumn('test', null);
     $this->assertTrue($this->row->hasColumn('test'));
 }
開發者ID:cemo,項目名稱:piwik,代碼行數:6,代碼來源:RowTest.php


注:本文中的Piwik\DataTable\Row::hasColumn方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。