update Piwik to version 2.16 (fixes #91)

This commit is contained in:
oliver 2016-04-10 18:55:57 +02:00
commit d885a4baa9
5833 changed files with 418860 additions and 226988 deletions

View file

@ -1,6 +1,6 @@
<?php
/**
* Piwik - Open source web analytics
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
@ -8,53 +8,53 @@
*/
namespace Piwik\ViewDataTable;
use Piwik\Common;
/**
* Contains base request properties for {@link Piwik\Plugin\ViewDataTable} instances. Manipulating
* these properties will change the way a {@link Piwik\Plugin\ViewDataTable} loads report data.
*
*
* <a name="client-side-parameters-desc"></a>
* **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.
*
*
* <a name="overridable-properties-desc"></a>
* **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}
* 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
* {
* /**
@ -66,16 +66,16 @@ use Piwik\Common;
* * 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'));
* }
* }
*
*
* @api
*/
class RequestConfig
@ -88,7 +88,12 @@ class RequestConfig
'filter_excludelowpop_value',
'filter_pattern',
'filter_column',
'filter_offset'
'filter_offset',
'flat',
'expanded',
'pivotBy',
'pivotByColumn',
'pivotByColumnLimit'
);
/**
@ -104,7 +109,12 @@ class RequestConfig
'filter_excludelowpop',
'filter_excludelowpop_value',
'disable_generic_filters',
'disable_queued_filters'
'disable_queued_filters',
'flat',
'expanded',
'pivotBy',
'pivotByColumn',
'pivotByColumnLimit'
);
/**
@ -130,6 +140,21 @@ class RequestConfig
*/
public $filter_limit = false;
/**
* If set to true, the returned data will contain the flattened view of the table data set.
* The children of all first level rows will be aggregated under one row.
*
* Default value: false
*/
public $flat = false;
/**
* If set to true, the returned data will contain the first level results, as well as all sub-tables.
*
* Default value: false
*/
public $expanded = false;
/**
* The number of items from the start of the data set that should be ignored.
*
@ -213,6 +238,29 @@ class RequestConfig
*/
public $idSubtable = false;
/**
* Dimension ID to pivot by. See {@link Piwik\DataTable\Filter\PivotByDimension} for more info.
*
* @var string
*/
public $pivotBy = false;
/**
* The column to display in a pivot table, eg, `'nb_visits'`. See {@link Piwik\DataTable\Filter\PivotByDimension}
* for more info.
*
* @var string
*/
public $pivotByColumn = false;
/**
* The maximum number of columns to display in a pivot table. See {@link Piwik\DataTable\Filter\PivotByDimension}
* for more info.
*
* @var int
*/
public $pivotByColumnLimit = false;
public function getProperties()
{
return get_object_vars($this);
@ -221,7 +269,7 @@ class RequestConfig
/**
* Marks request properties as client side properties. [Read this](#client-side-properties-desc)
* to learn more.
*
*
* @param array $propertyNames List of property names, eg, `array('disable_queued_filters', 'filter_column')`.
*/
public function addPropertiesThatShouldBeAvailableClientSide(array $propertyNames)
@ -234,7 +282,7 @@ class RequestConfig
/**
* Marks display properties as overridable. [Read this](#overridable-properties-desc) to
* learn more.
*
*
* @param array $propertyNames List of property names, eg, `array('disable_queued_filters', 'filter_column')`.
*/
public function addPropertiesThatCanBeOverwrittenByQueryParams(array $propertyNames)
@ -244,7 +292,7 @@ class RequestConfig
}
}
public function setDefaultSort($columnsToDisplay, $hasNbUniqVisitors)
public function setDefaultSort($columnsToDisplay, $hasNbUniqVisitors, $actualColumns)
{
// default sort order to visits/visitors data
if ($hasNbUniqVisitors && in_array('nb_uniq_visitors', $columnsToDisplay)) {
@ -253,38 +301,19 @@ class RequestConfig
$this->filter_sort_column = 'nb_visits';
}
// if the default sort column does not exist, sort by the first non-label column
if (!in_array($this->filter_sort_column, $actualColumns)) {
foreach ($actualColumns as $column) {
if ($column != 'label') {
$this->filter_sort_column = $column;
break;
}
}
}
$this->filter_sort_order = 'desc';
}
/**
* Returns `true` if queued filters have been disabled, `false` if otherwise.
*
* @return bool
*/
public function areQueuedFiltersDisabled()
{
return isset($this->disable_queued_filters) && $this->disable_queued_filters;
}
/**
* Returns `true` if generic filters have been disabled, `false` if otherwise.
*
* @return bool
*/
public function areGenericFiltersDisabled()
{
// if disable_generic_filters query param is set to '1', generic filters are disabled
if (Common::getRequestVar('disable_generic_filters', '0', 'string') == 1) {
return true;
}
if (isset($this->disable_generic_filters) && true === $this->disable_generic_filters) {
return true;
}
return false;
}
public function getApiModuleToRequest()
{
list($module, $method) = explode('.', $this->apiMethodToRequestDataTable);