本文整理匯總了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));
}
}