diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 08:01:08 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 09:57:54 +0400 |
commit | a10eb83bfc85221b0afaedccfae881a55639d782 (patch) | |
tree | 9e47d643ec36a610cb9a327a85d7e64dea196cbc /core/DataTable.php | |
parent | b969dc796fe9a0116ef7481d009ef10c2ca7dc0a (diff) |
Refs #4200, make DataTable:: private & add public methods necessary, tweaking some filter docs, and remove AddConstantMetadata filter.
Diffstat (limited to 'core/DataTable.php')
-rw-r--r-- | core/DataTable.php | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/core/DataTable.php b/core/DataTable.php index 792ccbf6f5..cc367d98cd 100644 --- a/core/DataTable.php +++ b/core/DataTable.php @@ -38,7 +38,7 @@ require_once PIWIK_INCLUDE_PATH . '/core/Common.php'; * Every row has an ID. The ID is either the index of the row or [ID_SUMMARY_ROW](#ID_SUMMARY_ROW). * * DataTables are hierarchical data structures. Each row can also contain an additional - * nested sub-DataTable. + * nested sub-DataTable (commonly referred to as a 'subtable'). * * Both DataTables and DataTable rows can hold **metadata**. _DataTable metadata_ is information * regarding all the data, such as the site or period that the data is for. _Row metadata_ @@ -298,7 +298,7 @@ class DataTable implements DataTableInterface * * @var array */ - public $metadata = array(); + private $metadata = array(); /** * Maximum number of rows allowed in this datatable (including the summary row). @@ -1369,6 +1369,28 @@ class DataTable implements DataTableInterface } /** + * Sets several metadata values by name. + * + * @param array $values Array mapping metadata names with metadata values. + */ + public function setMetadataValues($values) + { + foreach ($values as $name => $value) { + $this->metadata[$name] = $value; + } + } + + /** + * Sets metadata erasing existing values. + * + * @param array $values Array mapping metadata names with metadata values. + */ + public function setAllTableMetadata($metadata) + { + $this->metadata = $metadata; + } + + /** * Sets the maximum number of rows allowed in this datatable (including the summary * row). If adding more then the allowed number of rows is attempted, the extra * rows are summed to the summary row. |