diff options
Diffstat (limited to 'plugins/ExampleUI')
-rw-r--r-- | plugins/ExampleUI/Controller.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/ExampleUI/Controller.php b/plugins/ExampleUI/Controller.php index d4dd15c3b3..5dd0e9bb52 100644 --- a/plugins/ExampleUI/Controller.php +++ b/plugins/ExampleUI/Controller.php @@ -46,7 +46,7 @@ class Controller extends \Piwik\Plugin\Controller $view = new View('@ExampleUI/evolutiongraph'); $this->setPeriodVariablesView($view); - $view->evolutionGraph = $this->getEvolutionGraph(array('server1', 'server2')); + $view->evolutionGraph = $this->getEvolutionGraph(array(), array('server1', 'server2')); return $view->render(); } @@ -78,17 +78,23 @@ class Controller extends \Piwik\Plugin\Controller return $view->render(); } - public function getEvolutionGraph(array $columns = array()) + public function getEvolutionGraph(array $columns = array(), array $defaultColumns = array()) { if (empty($columns)) { - $columns = Common::getRequestVar('columns'); - $columns = Piwik::getArrayFromApiParameter($columns); + $columns = Common::getRequestVar('columns', false); + if (false !== $columns) { + $columns = Piwik::getArrayFromApiParameter($columns); + } } $view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, __FUNCTION__, $columns, $selectableColumns = array('server1', 'server2'), 'My documentation', 'ExampleUI.getTemperaturesEvolution'); $view->requestConfig->filter_sort_column = 'label'; + if (empty($view->config->columns_to_display) && !empty($defaultColumns)) { + $view->config->columns_to_display = $defaultColumns; + } + return $this->renderView($view); } |