update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
|
|
@ -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,6 +8,7 @@
|
|||
*/
|
||||
namespace Piwik\DataTable;
|
||||
|
||||
use Closure;
|
||||
use Piwik\Common;
|
||||
use Piwik\DataTable;
|
||||
use Piwik\DataTable\Renderer\Console;
|
||||
|
|
@ -15,10 +16,10 @@ use Piwik\DataTable\Renderer\Console;
|
|||
/**
|
||||
* Stores an array of {@link DataTable}s indexed by one type of {@link DataTable} metadata (such as site ID
|
||||
* or period).
|
||||
*
|
||||
*
|
||||
* DataTable Maps are returned on all queries that involve multiple sites and/or multiple
|
||||
* periods. The Maps will contain a {@link DataTable} for each site and period combination.
|
||||
*
|
||||
*
|
||||
* The Map implements some {@link DataTable} such as {@link queueFilter()} and {@link getRowsCount}.
|
||||
*
|
||||
*
|
||||
|
|
@ -73,7 +74,7 @@ class Map implements DataTableInterface
|
|||
|
||||
/**
|
||||
* Queue a filter to {@link DataTable} child of contained by this instance.
|
||||
*
|
||||
*
|
||||
* See {@link Piwik\DataTable::queueFilter()} for more information..
|
||||
*
|
||||
* @param string|Closure $className Filter name, eg. `'Limit'` or a Closure.
|
||||
|
|
@ -104,11 +105,37 @@ class Map implements DataTableInterface
|
|||
*/
|
||||
public function filter($className, $parameters = array())
|
||||
{
|
||||
foreach ($this->getDataTables() as $id => $table) {
|
||||
foreach ($this->getDataTables() as $table) {
|
||||
$table->filter($className, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a filter to all subtables contained by this instance.
|
||||
*
|
||||
* @param string|Closure $className Name of filter class or a Closure.
|
||||
* @param array $parameters Parameters to pass to the filter.
|
||||
*/
|
||||
public function filterSubtables($className, $parameters = array())
|
||||
{
|
||||
foreach ($this->getDataTables() as $table) {
|
||||
$table->filterSubtables($className, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a queued filter to all subtables contained by this instance.
|
||||
*
|
||||
* @param string|Closure $className Name of filter class or a Closure.
|
||||
* @param array $parameters Parameters to pass to the filter.
|
||||
*/
|
||||
public function queueFilterSubtables($className, $parameters = array())
|
||||
{
|
||||
foreach ($this->getDataTables() as $table) {
|
||||
$table->queueFilterSubtables($className, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array of DataTables contained by this class.
|
||||
*
|
||||
|
|
@ -142,7 +169,7 @@ class Map implements DataTableInterface
|
|||
|
||||
/**
|
||||
* Returns the last element in the Map's array.
|
||||
*
|
||||
*
|
||||
* @return DataTable|Map|false
|
||||
*/
|
||||
public function getLastRow()
|
||||
|
|
@ -161,6 +188,22 @@ class Map implements DataTableInterface
|
|||
$this->array[$label] = $table;
|
||||
}
|
||||
|
||||
public function getRowFromIdSubDataTable($idSubtable)
|
||||
{
|
||||
$dataTables = $this->getDataTables();
|
||||
|
||||
// find first datatable containing data
|
||||
foreach ($dataTables as $subTable) {
|
||||
$subTableRow = $subTable->getRowFromIdSubDataTable($idSubtable);
|
||||
|
||||
if (!empty($subTableRow)) {
|
||||
return $subTableRow;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string output of this DataTable\Map (applying the default renderer to every {@link DataTable}
|
||||
* of this DataTable\Map).
|
||||
|
|
@ -184,11 +227,31 @@ class Map implements DataTableInterface
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
public function disableRecursiveFilters()
|
||||
{
|
||||
foreach ($this->getDataTables() as $table) {
|
||||
$table->disableRecursiveFilters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
public function enableRecursiveFilters()
|
||||
{
|
||||
foreach ($this->getDataTables() as $table) {
|
||||
$table->enableRecursiveFilters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renames the given column in each contained {@link DataTable}.
|
||||
*
|
||||
* See {@link DataTable::renameColumn()}.
|
||||
*
|
||||
*
|
||||
* @param string $oldName
|
||||
* @param string $newName
|
||||
*/
|
||||
|
|
@ -203,7 +266,7 @@ class Map implements DataTableInterface
|
|||
* Deletes the specified columns in each contained {@link DataTable}.
|
||||
*
|
||||
* See {@link DataTable::deleteColumns()}.
|
||||
*
|
||||
*
|
||||
* @param array $columns The columns to delete.
|
||||
* @param bool $deleteRecursiveInSubtables This param is currently not used.
|
||||
*/
|
||||
|
|
@ -216,7 +279,7 @@ class Map implements DataTableInterface
|
|||
|
||||
/**
|
||||
* Deletes a table from the array of DataTables.
|
||||
*
|
||||
*
|
||||
* @param string $id The label associated with {@link DataTable}.
|
||||
*/
|
||||
public function deleteRow($id)
|
||||
|
|
@ -246,12 +309,14 @@ class Map implements DataTableInterface
|
|||
public function getColumn($name)
|
||||
{
|
||||
$values = array();
|
||||
|
||||
foreach ($this->getDataTables() as $table) {
|
||||
$moreValues = $table->getColumn($name);
|
||||
foreach ($moreValues as &$value) {
|
||||
$values[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
|
@ -263,19 +328,19 @@ class Map implements DataTableInterface
|
|||
* The result of this function is determined by the type of DataTable
|
||||
* this instance holds. If this DataTable\Map instance holds an array
|
||||
* of DataTables, this function will transform it from:
|
||||
*
|
||||
*
|
||||
* Label 0:
|
||||
* DataTable(row1)
|
||||
* Label 1:
|
||||
* DataTable(row2)
|
||||
*
|
||||
*
|
||||
* to:
|
||||
*
|
||||
*
|
||||
* DataTable(row1[label = 'Label 0'], row2[label = 'Label 1'])
|
||||
*
|
||||
* If this instance holds an array of DataTable\Maps, this function will
|
||||
* transform it from:
|
||||
*
|
||||
*
|
||||
* Outer Label 0: // the outer DataTable\Map
|
||||
* Inner Label 0: // one of the inner DataTable\Maps
|
||||
* DataTable(row1)
|
||||
|
|
@ -286,9 +351,9 @@ class Map implements DataTableInterface
|
|||
* DataTable(row3)
|
||||
* Inner Label 1:
|
||||
* DataTable(row4)
|
||||
*
|
||||
*
|
||||
* to:
|
||||
*
|
||||
*
|
||||
* Inner Label 0:
|
||||
* DataTable(row1[label = 'Outer Label 0'], row3[label = 'Outer Label 1'])
|
||||
* Inner Label 1:
|
||||
|
|
@ -366,11 +431,11 @@ class Map implements DataTableInterface
|
|||
|
||||
/**
|
||||
* Sums a DataTable to all the tables in this array.
|
||||
*
|
||||
*
|
||||
* _Note: Will only add `$tableToSum` if the childTable has some rows._
|
||||
*
|
||||
* See {@link Piwik\DataTable::addDataTable()}.
|
||||
*
|
||||
*
|
||||
* @param DataTable $tableToSum
|
||||
*/
|
||||
public function addDataTable(DataTable $tableToSum)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue