PHP Class Piwik\ViewDataTable\RequestConfig

**Client Side Parameters** Client side parameters are request properties that should be passed on to the browser so client side JavaScript can use them. These properties will also be passed to the server with every AJAX request made. Only affects ViewDataTables that output HTML. **Overridable Properties** Overridable properties are properties that can be set via the query string. If a request has a query parameter that matches an overridable property, the property will be set to the query parameter value. **Reusing base properties** Many of the properties in this class only have meaning for the {@link Piwik\Plugin\Visualization} class, but can be set for other visualizations that extend {@link Piwik\Plugin\ViewDataTable} directly. Visualizations that extend {@link Piwik\Plugin\ViewDataTable} directly and want to re-use these properties must make sure the properties are used in the exact same way they are used in {@link Piwik\Plugin\Visualization}. **Defining new request properties** If you are creating your own visualization and want to add new request properties for it, extend this class and add your properties as fields. Properties are marked as client side parameters by calling the {@link addPropertiesThatShouldBeAvailableClientSide()} method. Properties are marked as overridable by calling the {@link addPropertiesThatCanBeOverwrittenByQueryParams()} method. ### Example **Defining new request properties** class MyCustomVizRequestConfig extends RequestConfig { ** * My custom property. It is overridable. *\/ public $my_custom_property = false; ** * Another custom property. It is available client side. *\/ public $another_custom_property = true; public function __construct() { parent::__construct(); $this->addPropertiesThatShouldBeAvailableClientSide(array('another_custom_property')); $this->addPropertiesThatCanBeOverwrittenByQueryParams(array('my_custom_property')); } }
Show file Open project: piwik/piwik Class Usage Examples

Public Properties

Property Type Description
$apiMethodToRequestDataTable string returns 'Plugin.apiMethodName' used for this ViewDataTable, eg. 'Actions.getPageUrls'
$clientSideParameters The list of request parameters that are 'Client Side Parameters'.
$disable_generic_filters Whether to run generic filters on the DataTable before rendering or not.
$disable_queued_filters _NOTE: Priority queued filters are always run._ Default value: false
$expanded Default value: false
$filter_column The column to apply a filter pattern to.
$filter_excludelowpop Default value: false
$filter_excludelowpop_value Closure | string Default value: false
$filter_limit Default value: false
$filter_offset Default value: 0
$filter_pattern A regex pattern to use to filter the DataTable before it is shown.
$filter_sort_column Default value: If the report contains nb_uniq_visitors and nb_uniq_visitors is a displayed column, then the default value is 'nb_uniq_visitors'. Otherwise, it is 'nb_visits'.
$filter_sort_order Default value: 'desc'
$flat The children of all first level rows will be aggregated under one row. Default value: false
$idSubtable boolean | integer If the current dataTable refers to a subDataTable (eg. keywordsBySearchEngineId for id=X) this variable is set to the Id
$overridableProperties The list of ViewDataTable properties that can be overriden by query parameters.
$pivotBy string Dimension ID to pivot by. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
$pivotByColumn string The column to display in a pivot table, eg, 'nb_visits'. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
$pivotByColumnLimit integer The maximum number of columns to display in a pivot table. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
$request_parameters_to_modify E.g. array('idSite' => ..., 'period' => 'month') Default value: array()

Public Methods

Method Description
addPropertiesThatCanBeOverwrittenByQueryParams ( array $propertyNames ) Marks display properties as overridable. Read this to learn more.
addPropertiesThatShouldBeAvailableClientSide ( array $propertyNames ) Marks request properties as client side properties. Read this to learn more.
getApiMethodToRequest ( )
getApiModuleToRequest ( )
getProperties ( )
setDefaultSort ( $columnsToDisplay, $hasNbUniqVisitors, $actualColumns )

Method Details

addPropertiesThatCanBeOverwrittenByQueryParams() public method

Marks display properties as overridable. Read this to learn more.
public addPropertiesThatCanBeOverwrittenByQueryParams ( array $propertyNames )
$propertyNames array List of property names, eg, `array('disable_queued_filters', 'filter_column')`.

addPropertiesThatShouldBeAvailableClientSide() public method

Marks request properties as client side properties. Read this to learn more.
public addPropertiesThatShouldBeAvailableClientSide ( array $propertyNames )
$propertyNames array List of property names, eg, `array('disable_queued_filters', 'filter_column')`.

getApiMethodToRequest() public method

getApiModuleToRequest() public method

getProperties() public method

public getProperties ( )

setDefaultSort() public method

public setDefaultSort ( $columnsToDisplay, $hasNbUniqVisitors, $actualColumns )

Property Details

$apiMethodToRequestDataTable public property

returns 'Plugin.apiMethodName' used for this ViewDataTable, eg. 'Actions.getPageUrls'
public string $apiMethodToRequestDataTable
return string

$clientSideParameters public property

The list of request parameters that are 'Client Side Parameters'.
public $clientSideParameters

$disable_generic_filters public property

Whether to run generic filters on the DataTable before rendering or not.
See also: Piwik\API\DataTableGenericFilter Default value: false
public $disable_generic_filters

$disable_queued_filters public property

_NOTE: Priority queued filters are always run._ Default value: false
public $disable_queued_filters

$expanded public property

Default value: false
public $expanded

$filter_column public property

The column to apply a filter pattern to.
See also: also self::FILTER_PATTERN Default value: false
public $filter_column

$filter_excludelowpop public property

Default value: false
public $filter_excludelowpop

$filter_excludelowpop_value public property

Default value: false
public Closure|string $filter_excludelowpop_value
return Closure | string

$filter_limit public property

Default value: false
public $filter_limit

$filter_offset public property

Default value: 0
public $filter_offset

$filter_pattern public property

A regex pattern to use to filter the DataTable before it is shown.
See also: also self::FILTER_PATTERN_COLUMN Default value: false
public $filter_pattern

$filter_sort_column public property

Default value: If the report contains nb_uniq_visitors and nb_uniq_visitors is a displayed column, then the default value is 'nb_uniq_visitors'. Otherwise, it is 'nb_visits'.
public $filter_sort_column

$filter_sort_order public property

Default value: 'desc'
public $filter_sort_order

$flat public property

The children of all first level rows will be aggregated under one row. Default value: false
public $flat

$idSubtable public property

If the current dataTable refers to a subDataTable (eg. keywordsBySearchEngineId for id=X) this variable is set to the Id
public bool|int $idSubtable
return boolean | integer

$overridableProperties public property

The list of ViewDataTable properties that can be overriden by query parameters.
public $overridableProperties

$pivotBy public property

Dimension ID to pivot by. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
public string $pivotBy
return string

$pivotByColumn public property

The column to display in a pivot table, eg, 'nb_visits'. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
public string $pivotByColumn
return string

$pivotByColumnLimit public property

The maximum number of columns to display in a pivot table. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
public int $pivotByColumnLimit
return integer

$request_parameters_to_modify public property

E.g. array('idSite' => ..., 'period' => 'month') Default value: array()
public $request_parameters_to_modify