当前位置: 首页>>代码示例>>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;未经允许,请勿转载。