Hi all, I’ve been using Piwik for some weeks to try out if it fits my needs. I’ve created custom plugin widgets which use a custom table in the piwik table. Everything works how I want (graphs, tables etc).
Now I want these tables and graphs in a report. But I’m doing something wrong because I only get tables in the reports with columns I don’t supply in my Piwik_DataTable.
In “\piwik\plugins\UserSettings\UserSettings.php”: I have added a seperate array
array( 'UserSettings_VisitorSettings',
'TestUI Graph',
'TestUI',
'getAppViews',
'Views'),
Which calls this function:
class Piwik_TestUI_API
{
public function getAppViews()
{
$views = array();
$value = 10;
for ($i = 0; $i < 10; $i++)
{
$views[$i] = $value++;
}
// convert this array to a DataTable object
$dataTable = new Piwik_DataTable();
$dataTable->addRowsFromArrayWithIndexLabel($views);
return $dataTable;
}
}
The report outputted is a table (possible to do graphs?) with the columns ‘Views’ (which has the values of my filled table), and irrelevant columns: ‘Visits’, ‘Unique visitors’, ‘Actions’, etc.
So my questions are:
Why are these columns added? And how do I get rid of it. These are not defined in the Piwik_DataTable.
How can I make a report that looks the same as the widget only outputted to for example PDF?