本文整理汇总了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;
}
示例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;
}
示例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;
}
}
}
示例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'));
}