diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-02 06:00:06 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-05-02 06:00:06 +0400 |
commit | 97f500fe247a88455bab6e72f5c8c06ee3029be7 (patch) | |
tree | 968bef38fd87eb2804d249628cbecd6e69f9e5e9 /core/Plugin/ViewDataTable.php | |
parent | 882be3d44b36ded6324e4d8f699ec802e55bc2ac (diff) |
refs #1915 a first version of persist & restore report settings. not everything is saved yet (such as metricsToPlot) but most things are
Diffstat (limited to 'core/Plugin/ViewDataTable.php')
-rw-r--r-- | core/Plugin/ViewDataTable.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/Plugin/ViewDataTable.php b/core/Plugin/ViewDataTable.php index 069e08deab..c49aef59ba 100644 --- a/core/Plugin/ViewDataTable.php +++ b/core/Plugin/ViewDataTable.php @@ -11,6 +11,7 @@ namespace Piwik\Plugin; use Piwik\API\Request; use Piwik\Common; use Piwik\DataTable; +use Piwik\Option; use Piwik\Period; use Piwik\Piwik; use Piwik\View; @@ -175,7 +176,7 @@ abstract class ViewDataTable implements ViewInterface * Posts the {@hook ViewDataTable.configure} event which plugins can use to configure the * way reports are displayed. */ - public function __construct($controllerAction, $apiMethodToRequestDataTable) + public function __construct($controllerAction, $apiMethodToRequestDataTable, $overrideParams = array()) { list($controllerName, $controllerAction) = explode('.', $controllerAction); @@ -229,6 +230,7 @@ abstract class ViewDataTable implements ViewInterface $this->requestConfig->filter_excludelowpop_value = $function(); } + $this->overrideViewPropertiesWithParams($overrideParams); $this->overrideViewPropertiesWithQueryParams(); } @@ -399,7 +401,7 @@ abstract class ViewDataTable implements ViewInterface if (property_exists($this->requestConfig, $name)) { $this->requestConfig->$name = $this->getPropertyFromQueryParam($name, $this->requestConfig->$name); } elseif (property_exists($this->config, $name)) { - $this->config->$name = $this->getPropertyFromQueryParam($name, $this->config->$name); + $this->config->$name = $this->getPropertyFromQueryParam($name, $this->config->$name); } } @@ -456,4 +458,22 @@ abstract class ViewDataTable implements ViewInterface { return $view->config->show_all_views_icons; } + + private function overrideViewPropertiesWithParams($overrideParams) + { + if (empty($overrideParams)) { + return; + } + + foreach ($overrideParams as $key => $value) { + if (property_exists($this->requestConfig, $key)) { + $this->requestConfig->$key = $value; + } elseif (property_exists($this->config, $key)) { + $this->config->$key = $value; + } elseif ($key != 'enable_filter_excludelowpop') { + $this->config->custom_parameters[$key] = $value; + } + } + } + } |