本文整理汇总了PHP中Piwik_DataTable::getFirstRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_DataTable::getFirstRow方法的具体用法?PHP Piwik_DataTable::getFirstRow怎么用?PHP Piwik_DataTable::getFirstRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_DataTable
的用法示例。
在下文中一共展示了Piwik_DataTable::getFirstRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getColumnsToDisplay
/**
* Returns columns names to display, in order.
* If no columns were specified to be displayed, return all columns found in the first row.
* @param array PHP array conversion of the data table
* @return array
*/
public function getColumnsToDisplay()
{
if (empty($this->columnsToDisplay)) {
return array_keys($this->dataTable->getFirstRow()->getColumns());
}
$this->columnsToDisplay = array_filter($this->columnsToDisplay);
return $this->columnsToDisplay;
}
示例2: getRenderedDataTable
/**
* Apply the specified renderer to the DataTable
*
* @param Piwik_DataTable $dataTable
* @return string
*/
protected function getRenderedDataTable($dataTable)
{
$format = strtolower($this->outputFormat);
// if asked for original dataStructure
if ($format == 'original') {
// if the original dataStructure is a simpleDataTable
// and has only one column, we return the value
if ($dataTable instanceof Piwik_DataTable_Simple) {
$columns = $dataTable->getFirstRow()->getColumns();
if (count($columns) == 1) {
$values = array_values($columns);
return $values[0];
}
}
// by default "original" data is not serialized
if ($this->caseRendererPHPSerialize($defaultSerialize = 0)) {
$dataTable = serialize($dataTable);
}
return $dataTable;
}
$method = Piwik_Common::getRequestVar('method', '', 'string', $this->request);
$renderer = Piwik_DataTable_Renderer::factory($format);
$renderer->setTable($dataTable);
$renderer->setRenderSubTables(Piwik_Common::getRequestVar('expanded', false, 'int', $this->request));
$renderer->setHideIdSubDatableFromResponse(Piwik_Common::getRequestVar('hideIdSubDatable', false, 'int', $this->request));
if ($format == 'php') {
$renderer->setSerialize($this->caseRendererPHPSerialize());
$renderer->setPrettyDisplay(Piwik_Common::getRequestVar('prettyDisplay', false, 'int', $this->request));
} else {
if ($format == 'html') {
$renderer->setTableId($this->request['method']);
} else {
if ($format == 'csv' || $format == 'tsv') {
$renderer->setConvertToUnicode(Piwik_Common::getRequestVar('convertToUnicode', true, 'int', $this->request));
}
}
}
// prepare translation of column names
if ($format == 'html' || $format == 'csv' || $format == 'tsv' || ($format = 'rss')) {
$renderer->setApiMethod($method);
$renderer->setIdSite(Piwik_Common::getRequestVar('idSite', false, 'int', $this->request));
$renderer->setTranslateColumnNames(Piwik_Common::getRequestVar('translateColumnNames', false, 'int', $this->request));
}
return $renderer->render();
}