PHP Class Piwik\Columns\Dimension

Since: 2.5.0
Show file Open project: piwik/piwik Class Usage Examples

Protected Properties

Property Type Description
$columnName string This will be the name of the column in the database table if a $columnType is specified.
$columnType string If a columnType is defined, we will create a column in the MySQL table having this type. Please make sure MySQL understands this type. Once you change the column type the Piwik platform will notify the user to perform an update which can sometimes take a long time so be careful when choosing the correct column type.
$segments Piwik\Plugin\Segment[] Holds an array of segment instances

Public Methods

Method Description
factory ( string $dimensionId ) : Dimension | null Creates a Dimension instance from a string ID (see {@link getId()}).
getAllDimensions ( ) : Dimension[] Gets an instance of all available visit, action and conversion dimension.
getColumnName ( ) : string Get the name of the dimension column.
getDimensions ( Plugin $plugin )
getId ( ) : string Returns a unique string ID for this dimension. The ID is built using the namespaced class name of the dimension, but is modified to be more human readable.
getModule ( ) : string Returns the name of the plugin that contains this Dimension.
getName ( ) : string Get the translated name of the dimension. Defaults to an empty string.
getSegments ( ) : Piwik\Plugin\Segment[] Get the list of configured segments.
hasColumnType ( ) : boolean Check whether the dimension has a column type configured
hasImplementedEvent ( $method ) : boolean Check whether a dimension has overwritten a specific method.

Protected Methods

Method Description
addSegment ( Piwik\Plugin\Segment $segment ) Adds a new segment. The segment type will be set to 'dimension' automatically if not already set.
configureSegments ( ) Overwrite this method to configure segments. To do so just create an instance of a {@link \Piwik\Plugin\Segment} class, configure it and call the {@link addSegment()} method. You can add one or more segments for this dimension. Example:

Method Details

addSegment() protected method

Adds a new segment. The segment type will be set to 'dimension' automatically if not already set.
protected addSegment ( Piwik\Plugin\Segment $segment )
$segment Piwik\Plugin\Segment

configureSegments() protected method

$segment = new Segment(); $segment->setSegment('exitPageUrl'); $segment->setName('Actions_ColumnExitPageURL'); $segment->setCategory('General_Visit'); $this->addSegment($segment);
protected configureSegments ( )

factory() public static method

Creates a Dimension instance from a string ID (see {@link getId()}).
public static factory ( string $dimensionId ) : Dimension | null
$dimensionId string See {@link getId()}.
return Dimension | null The created instance or null if there is no Dimension for $dimensionId or if the plugin that contains the Dimension is not loaded.

getAllDimensions() public static method

Gets an instance of all available visit, action and conversion dimension.
public static getAllDimensions ( ) : Dimension[]
return Dimension[]

getColumnName() public method

Get the name of the dimension column.
public getColumnName ( ) : string
return string

getDimensions() public static method

public static getDimensions ( Plugin $plugin )
$plugin Piwik\Plugin

getId() public method

Returns a unique string ID for this dimension. The ID is built using the namespaced class name of the dimension, but is modified to be more human readable.
public getId ( ) : string
return string eg, `"Referrers.Keywords"`

getModule() public method

Returns the name of the plugin that contains this Dimension.
public getModule ( ) : string
return string

getName() public method

Get the translated name of the dimension. Defaults to an empty string.
public getName ( ) : string
return string

getSegments() public method

Get the list of configured segments.
public getSegments ( ) : Piwik\Plugin\Segment[]
return Piwik\Plugin\Segment[]

hasColumnType() public method

Check whether the dimension has a column type configured
public hasColumnType ( ) : boolean
return boolean

hasImplementedEvent() public method

Check whether a dimension has overwritten a specific method.
public hasImplementedEvent ( $method ) : boolean
$method
return boolean

Property Details

$columnName protected property

This will be the name of the column in the database table if a $columnType is specified.
protected string $columnName
return string

$columnType protected property

If a columnType is defined, we will create a column in the MySQL table having this type. Please make sure MySQL understands this type. Once you change the column type the Piwik platform will notify the user to perform an update which can sometimes take a long time so be careful when choosing the correct column type.
protected string $columnType
return string

$segments protected property

Holds an array of segment instances
protected Segment[],Piwik\Plugin $segments
return Piwik\Plugin\Segment[]