本文整理汇总了PHP中Datatable::addRow方法的典型用法代码示例。如果您正苦于以下问题:PHP Datatable::addRow方法的具体用法?PHP Datatable::addRow怎么用?PHP Datatable::addRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datatable
的用法示例。
在下文中一共展示了Datatable::addRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getBannerstatistics
/**
* Another example method that returns a data table.
* @param int $idSite
* @param string $period
* @param string $date
* @param bool|string $segment
* @return DataTable
*/
public function getBannerstatistics($idSite, $period, $date, $segment = false, $idSubtable = false, $filter_limit = 10, $filter_sort_column = 'impressions', $filter_sort_order = 'desc', $filter_pattern = null)
{
$params = array('idSite' => $idSite, 'period' => $period, 'date' => $date, 'segment' => $segment, 'filter_limit' => $filter_limit, 'filter_sort_column' => $filter_sort_column, 'filter_sort_order' => $filter_sort_order, 'filter_pattern' => $filter_pattern);
if ($idSubtable) {
return $this->bannerStats($idSubtable, $params);
}
$contentNames = \Piwik\API\Request::processRequest('Contents.getContentNames', $params);
$bannerTable = new Datatable();
//$period = $dataTable->getMetadata(DataTableFactory::TABLE_METADATA_PERIOD_INDEX);
//$bannerTable->setMetadataValues($contentNames->getAllTableMetadata());
foreach ($contentNames->getRows() as $contentName) {
$bannerName = $contentName->getColumn('label');
$row = new Row(array(Row::COLUMNS => array('Name' => $bannerName, 'Visits' => $contentName->getColumn('nb_visits'), 'Impressions' => $contentName->getColumn('nb_impressions'), 'Interactions' => $contentName->getColumn('nb_interactions'), 'Conversion rate' => $contentName->getColumn('interaction_rate')), Row::DATATABLE_ASSOCIATED => $bannerName));
$bannerTable->addRow($row);
}
return $bannerTable;
}