PHP Class Piwik\ReportRenderer

All new Renderers must be copied in ReportRenderer and added to the $availableReportRenderers.
Inheritance: extends BaseFactory
Show file Open project: piwik/piwik Class Usage Examples

Protected Properties

Property Type Description
$idSite

Public Methods

Method Description
getAttachments ( $report, $processedReports, $prettyDate ) : array Get report attachments, ex. graph images
getRenderedReport ( ) Get rendered report
getStaticGraph ( $reportMetadata, $width, $height, $evolution, $segment )
renderFrontPage ( string $reportTitle, string $prettyDate, string $description, array $reportMetadata, array $segment ) Generate the first page.
renderReport ( array $processedReport ) Render the provided report.
sendToBrowserDownload ( string $filename ) Send rendering to browser with a 'download file' prompt
sendToBrowserInline ( string $filename ) Output rendering to browser
sendToDisk ( string $filename ) : string Save rendering to disk
setIdSite ( integer $idSite ) Sets the site id
setLocale ( string $locale ) Initialize locale settings.

Protected Methods

Method Description
getClassNameFromClassId ( $rendererType )
getInvalidClassIdExceptionMessage ( $rendererType )
getOutputPath ( $filename ) : string Return $filename with temp directory and delete file
inlineToBrowser ( $contentType, $content )
makeFilenameWithExtension ( string $filename, string $extension ) : string Append $extension to $filename
normalizeRendererType ( $rendererType )
processTableFormat ( $reportMetadata, $report, $reportColumns ) : array Convert a dimension-less report to a multi-row two-column data table
sendToBrowser ( $filename, $extension, $contentType, $content )
writeFile ( $filename, $extension, $content )

Method Details

getAttachments() abstract public method

Get report attachments, ex. graph images
abstract public getAttachments ( $report, $processedReports, $prettyDate ) : array
$report
$processedReports
$prettyDate
return array

getClassNameFromClassId() protected static method

protected static getClassNameFromClassId ( $rendererType )

getInvalidClassIdExceptionMessage() protected static method

protected static getInvalidClassIdExceptionMessage ( $rendererType )

getOutputPath() protected static method

Return $filename with temp directory and delete file
protected static getOutputPath ( $filename ) : string
$filename
return string path of file in temp directory

getRenderedReport() abstract public method

Get rendered report
abstract public getRenderedReport ( )

getStaticGraph() public static method

public static getStaticGraph ( $reportMetadata, $width, $height, $evolution, $segment )

inlineToBrowser() protected static method

protected static inlineToBrowser ( $contentType, $content )

makeFilenameWithExtension() protected static method

Append $extension to $filename
protected static makeFilenameWithExtension ( string $filename, string $extension ) : string
$filename string
$extension string
return string filename with extension

normalizeRendererType() protected static method

protected static normalizeRendererType ( $rendererType )

processTableFormat() protected static method

Convert a dimension-less report to a multi-row two-column data table
protected static processTableFormat ( $reportMetadata, $report, $reportColumns ) : array
$reportMetadata array
$report DataTable
$reportColumns array
return array DataTable $report & array $columns

renderFrontPage() abstract public method

Generate the first page.
abstract public renderFrontPage ( string $reportTitle, string $prettyDate, string $description, array $reportMetadata, array $segment )
$reportTitle string
$prettyDate string formatted date
$description string
$reportMetadata array metadata for all reports
$segment array segment applied to all reports

renderReport() abstract public method

Multiple calls to this method before calling outputRendering appends each report content.
abstract public renderReport ( array $processedReport )
$processedReport array @see API::getProcessedReport()

sendToBrowser() protected static method

protected static sendToBrowser ( $filename, $extension, $contentType, $content )

sendToBrowserDownload() abstract public method

Send rendering to browser with a 'download file' prompt
abstract public sendToBrowserDownload ( string $filename )
$filename string without path & without format extension

sendToBrowserInline() abstract public method

Output rendering to browser
abstract public sendToBrowserInline ( string $filename )
$filename string without path & without format extension

sendToDisk() abstract public method

Save rendering to disk
abstract public sendToDisk ( string $filename ) : string
$filename string without path & without format extension
return string path of file

setIdSite() public method

Sets the site id
public setIdSite ( integer $idSite )
$idSite integer

setLocale() abstract public method

If not called, locale settings defaults to 'en'
abstract public setLocale ( string $locale )
$locale string

writeFile() protected static method

protected static writeFile ( $filename, $extension, $content )

Property Details

$idSite protected property

protected $idSite