1
0
قرینه از https://github.com/matomo-org/matomo.git synced 2025-08-22 06:57:53 +00:00
Files
matomo/plugins/ExampleReport/Reports/GetExampleReport.php
Stefan Giehl 75290a04f4 Use https URLs (#23072)
* Use https URLs

* Build vue files

* use matomo.org instead of piwik.org in some links

* updates expected UI test file

---------

Co-authored-by: innocraft-automation <innocraft-automation@users.noreply.github.com>
2025-02-27 16:34:08 +01:00

108 خطوط
3.7 KiB
PHP

<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\ExampleReport\Reports;
use Piwik\Piwik;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\Actions\Columns\ExitPageUrl;
/**
* This class defines a new report.
*
* See {@link https://developer.matomo.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)
{
// $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()
}
*/
}