PHP Класс Piwik\Plugins\API\ProcessedReport

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( ReportsProvider $reportsProvider )
getMetadata ( $idSite, $apiModule, $apiAction, $apiParameters = [], $language = false, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false ) Loads reports metadata, then return the requested one, matching optional API parameters.
getPrettyValue ( Piwik\Metrics\Formatter $formatter, integer $idSite, string $columnName, mixed $value ) : string Prettifies a metric value based on the column name.
getProcessedReport ( $idSite, $period, $date, $apiModule, $apiAction, $segment = false, $apiParameters = false, $idGoal = false, $language = false, $showTimer = true, $hideMetricsDoc = false, $idSubtable = false, $showRawMetrics = false, $formatMetrics = null, $idDimension = false )
getReportMetadata ( integer $idSite, boolean | string $period = false, boolean | Date $date = false, boolean $hideMetricsDoc = false, boolean $showSubtableReports = false ) : array Triggers a hook to ask plugins for available Reports.
getReportMetadataByUniqueId ( $idSite, $apiMethodUniqueId )
isValidMetricForReport ( string $metric, integer $idSite, string $apiMethodUniqueId ) : boolean Verfies whether the given metric belongs to the given report.
isValidReportForSite ( integer $idSite, string $apiMethodUniqueId ) : boolean Verfies whether the given report exists for the given site.
sortReports ( array $a, array $b ) : integer API metadata are sorted by category/name, with a little tweak to replicate the standard Piwik category ordering
translateMetric ( string $metric, integer $idSite, string $apiMethodUniqueId ) : null | string Translates the given metric in case the report exists and in case the metric acutally belongs to the report.

Приватные методы

Метод Описание
aggregateReportTotalValues ( $simpleDataTable, $totals )
buildReportMetadataCacheKey ( $idSite, $period, $date, $hideMetricsDoc, $showSubtableReports )
getColumnsToKeep ( )
getColumnsToRemove ( )
getImplodedArray ( $v ) : string
handleSimpleDataTable ( integer $idSite, Piwik\DataTable\Simple $simpleDataTable, array $metadataColumns, boolean $hasDimension, boolean $returnRawMetrics = false, boolean | null $formatMetrics = null ) : array Enhance $simpleDataTable using metadata :
handleTableReport ( integer $idSite, Piwik\DataTable\Map | Piwik\DataTable\Simple $dataTable, array &$reportMetadata, boolean $showRawMetrics = false, boolean | null $formatMetrics = null ) : array Enhance a $dataTable using metadata :
hideShowMetrics ( array $columns, array $emptyColumns = [] ) : array Removes column names from an array based on the values in the hideColumns, showColumns query parameters. This is a hack that provides the ColumnDelete filter functionality in processed reports.
hideShowMetricsWithParams ( $columns, $columnsToRemove, $columnsToKeep, $emptyColumns = [] )
removeEmptyColumns ( &$columns, &$reportMetadata, $dataTable ) Removes metrics from the list of columns and the report meta data if they are marked empty in the data table meta data.

Описание методов

__construct() публичный Метод

public __construct ( ReportsProvider $reportsProvider )
$reportsProvider Piwik\Plugin\ReportsProvider

getMetadata() публичный Метод

Loads reports metadata, then return the requested one, matching optional API parameters.
public getMetadata ( $idSite, $apiModule, $apiAction, $apiParameters = [], $language = false, $period = false, $date = false, $hideMetricsDoc = false, $showSubtableReports = false )

getPrettyValue() публичный статический Метод

Prettifies a metric value based on the column name.
public static getPrettyValue ( Piwik\Metrics\Formatter $formatter, integer $idSite, string $columnName, mixed $value ) : string
$formatter Piwik\Metrics\Formatter
$idSite integer The ID of the site the metric is for (used if the column value is an amount of money).
$columnName string The metric name.
$value mixed The metric value.
Результат string

getProcessedReport() публичный Метод

public getProcessedReport ( $idSite, $period, $date, $apiModule, $apiAction, $segment = false, $apiParameters = false, $idGoal = false, $language = false, $showTimer = true, $hideMetricsDoc = false, $idSubtable = false, $showRawMetrics = false, $formatMetrics = null, $idDimension = false )

getReportMetadata() публичный Метод

Returns metadata information about each report (category, name, dimension, metrics, etc.)
public getReportMetadata ( integer $idSite, boolean | string $period = false, boolean | Date $date = false, boolean $hideMetricsDoc = false, boolean $showSubtableReports = false ) : array
$idSite integer
$period boolean | string
$date boolean | Piwik\Date
$hideMetricsDoc boolean
$showSubtableReports boolean
Результат array

getReportMetadataByUniqueId() публичный Метод

public getReportMetadataByUniqueId ( $idSite, $apiMethodUniqueId )

isValidMetricForReport() публичный Метод

Verfies whether the given metric belongs to the given report.
public isValidMetricForReport ( string $metric, integer $idSite, string $apiMethodUniqueId ) : boolean
$metric string For example 'nb_visits'
$idSite integer
$apiMethodUniqueId string For example 'MultiSites_getAll'
Результат boolean

isValidReportForSite() публичный Метод

Verfies whether the given report exists for the given site.
public isValidReportForSite ( integer $idSite, string $apiMethodUniqueId ) : boolean
$idSite integer
$apiMethodUniqueId string For example 'MultiSites_getAll'
Результат boolean

sortReports() публичный Метод

API metadata are sorted by category/name, with a little tweak to replicate the standard Piwik category ordering
public sortReports ( array $a, array $b ) : integer
$a array
$b array
Результат integer

translateMetric() публичный Метод

Translates the given metric in case the report exists and in case the metric acutally belongs to the report.
public translateMetric ( string $metric, integer $idSite, string $apiMethodUniqueId ) : null | string
$metric string For example 'nb_visits'
$idSite integer
$apiMethodUniqueId string For example 'MultiSites_getAll'
Результат null | string