本文整理汇总了PHP中Piwik_DataTable::getColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::getColumn方法的具体用法?PHP Piwik_DataTable::getColumn怎么用?PHP Piwik_DataTable::getColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable
的用法示例。
在下文中一共展示了Piwik_DataTable::getColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_missingColumnValues_shouldAppearLast_afterSortDesc
public function test_missingColumnValues_shouldAppearLast_afterSortDesc()
{
$table = new Piwik_DataTable();
$table->addRowsFromArray(array(array(Piwik_DataTable_Row::COLUMNS => array('label' => 'nintendo', 'count' => 1)), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'ask', 'count' => 2)), array(Piwik_DataTable_Row::COLUMNS => array('label' => 'amazing')), Piwik_DataTable::ID_SUMMARY_ROW => array(Piwik_DataTable_Row::COLUMNS => array('label' => 'summary', 'count' => 10))));
$filter = new Piwik_DataTable_Filter_Sort($table, 'count', 'desc');
$expectedOrder = array('ask', 'nintendo', 'amazing', 'summary');
$this->assertEqual($table->getColumn('label'), $expectedOrder);
}
示例2: addVisitsPercentColumn
/**
* Utility function that adds a visit percent column to a data table,
* regardless of whether the data table is an data table array or just
* a data table.
*
* @param Piwik_DataTable $dataTable The data table to modify.
*/
private static function addVisitsPercentColumn($dataTable)
{
if ($dataTable instanceof Piwik_DataTable_Array) {
foreach ($dataTable->getArray() as $table) {
self::addVisitsPercentColumn($table);
}
} else {
$totalVisits = array_sum($dataTable->getColumn(Piwik_Archive::INDEX_NB_VISITS));
$dataTable->queueFilter('ColumnCallbackAddColumnPercentage', array('nb_visits_percentage', 'nb_visits', $totalVisits));
}
}