PDF rausgenommen
This commit is contained in:
38
msd2/tracking/piwik/plugins/ExampleReport/API.php
Normal file
38
msd2/tracking/piwik/plugins/ExampleReport/API.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\ExampleReport;
|
||||
|
||||
use Piwik\DataTable;
|
||||
use Piwik\DataTable\Row;
|
||||
|
||||
/**
|
||||
* API for plugin ExampleReport
|
||||
*
|
||||
* @method static \Piwik\Plugins\ExampleReport\API getInstance()
|
||||
*/
|
||||
class API extends \Piwik\Plugin\API
|
||||
{
|
||||
|
||||
/**
|
||||
* 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 getExampleReport($idSite, $period, $date, $segment = false)
|
||||
{
|
||||
$table = new DataTable();
|
||||
|
||||
$table->addRowFromArray(array(Row::COLUMNS => array('nb_visits' => 5)));
|
||||
|
||||
return $table;
|
||||
}
|
||||
}
|
13
msd2/tracking/piwik/plugins/ExampleReport/ExampleReport.php
Normal file
13
msd2/tracking/piwik/plugins/ExampleReport/ExampleReport.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\ExampleReport;
|
||||
|
||||
class ExampleReport extends \Piwik\Plugin
|
||||
{
|
||||
}
|
19
msd2/tracking/piwik/plugins/ExampleReport/Reports/Base.php
Normal file
19
msd2/tracking/piwik/plugins/ExampleReport/Reports/Base.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
*/
|
||||
namespace Piwik\Plugins\ExampleReport\Reports;
|
||||
|
||||
use Piwik\Plugin\Report;
|
||||
|
||||
abstract class Base extends Report
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
$this->categoryId = 'ExampleCategory';
|
||||
}
|
||||
}
|
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace Piwik\Plugins\ExampleReport\Reports;
|
||||
|
||||
use Piwik\Piwik;
|
||||
use Piwik\Plugin\Report;
|
||||
use Piwik\Plugin\ViewDataTable;
|
||||
use Piwik\Plugins\Actions\Columns\ExitPageUrl;
|
||||
use Piwik\View;
|
||||
|
||||
/**
|
||||
* This class defines a new report.
|
||||
*
|
||||
* See {@link http://developer.piwik.org/api-reference/Piwik/Plugin/Report} for more information.
|
||||
*/
|
||||
class GetExampleReport extends Base
|
||||
{
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->name = Piwik::translate('ExampleReportName');
|
||||
$this->dimension = new ExitPageUrl();
|
||||
$this->documentation = Piwik::translate('ExampleReportDocumentation');
|
||||
|
||||
// This defines in which order your report appears in the mobile app, in the menu and in the list of widgets
|
||||
$this->order = 999;
|
||||
|
||||
// By default standard metrics are defined but you can customize them by defining an array of metric names
|
||||
// $this->metrics = array('nb_visits', 'nb_hits');
|
||||
|
||||
// Uncomment the next line if your report does not contain any processed metrics, otherwise default
|
||||
// processed metrics will be assigned
|
||||
// $this->processedMetrics = array();
|
||||
|
||||
// Uncomment the next line if your report defines goal metrics
|
||||
// $this->hasGoalMetrics = true;
|
||||
|
||||
// Uncomment the next line if your report should be able to load subtables. You can define any action here
|
||||
// $this->actionToLoadSubTables = $this->action;
|
||||
|
||||
// Uncomment the next line if your report always returns a constant count of rows, for instance always
|
||||
// 24 rows for 1-24hours
|
||||
// $this->constantRowsCount = true;
|
||||
|
||||
// If a subcategory is specified, the report will be displayed in the menu under this menu item
|
||||
// $this->subcategoryId = 'ExampleReportName';
|
||||
}
|
||||
|
||||
/**
|
||||
* Here you can configure how your report should be displayed. For instance whether your report supports a search
|
||||
* etc. You can also change the default request config. For instance change how many rows are displayed by default.
|
||||
*
|
||||
* @param ViewDataTable $view
|
||||
*/
|
||||
public function configureView(ViewDataTable $view)
|
||||
{
|
||||
if (!empty($this->dimension)) {
|
||||
$view->config->addTranslations(array('label' => $this->dimension->getName()));
|
||||
}
|
||||
|
||||
// $view->config->show_search = false;
|
||||
// $view->requestConfig->filter_sort_column = 'nb_visits';
|
||||
// $view->requestConfig->filter_limit = 10';
|
||||
|
||||
$view->config->columns_to_display = array_merge(array('label'), $this->metrics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Here you can define related reports that will be shown below the reports. Just return an array of related
|
||||
* report instances if there are any.
|
||||
*
|
||||
* @return \Piwik\Plugin\Report[]
|
||||
*/
|
||||
public function getRelatedReports()
|
||||
{
|
||||
return array(); // eg return array(new XyzReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* A report is usually completely automatically rendered for you but you can render the report completely
|
||||
* customized if you wish. Just overwrite the method and make sure to return a string containing the content of the
|
||||
* report. Don't forget to create the defined twig template within the templates folder of your plugin in order to
|
||||
* make it work. Usually you should NOT have to overwrite this render method.
|
||||
*
|
||||
* @return string
|
||||
public function render()
|
||||
{
|
||||
$view = new View('@ExampleReport/getExampleReport');
|
||||
$view->myData = array();
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* By default your report is available to all users having at least view access. If you do not want this, you can
|
||||
* limit the audience by overwriting this method.
|
||||
*
|
||||
* @return bool
|
||||
public function isEnabled()
|
||||
{
|
||||
return Piwik::hasUserSuperUserAccess()
|
||||
}
|
||||
*/
|
||||
}
|
13
msd2/tracking/piwik/plugins/ExampleReport/plugin.json
Normal file
13
msd2/tracking/piwik/plugins/ExampleReport/plugin.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "ExampleReport",
|
||||
"version": "0.1.0",
|
||||
"description": "Matomo Platform showcase: how to define and display a data report.",
|
||||
"theme": false,
|
||||
"authors": [
|
||||
{
|
||||
"name": "Matomo",
|
||||
"email": "",
|
||||
"homepage": ""
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user