Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2013-10-11 05:39:04 +0400
committerThomas Steur <thomas.steur@gmail.com>2013-10-11 05:39:04 +0400
commit06f935b507de21d5cb327777e8ebbf8bc428cbc4 (patch)
tree77a22f17fd52192948edecc448bd5c4462307f81 /plugins/ExampleVisualization
parent0c6f2c7c66c2a82aeb2e8a7004277a6282ed0890 (diff)
trying to use some hooks for visualization, properties are now handled in request/view data objects without any logic, not sure if it works, still an experiment, probably does not work for custom visualization properties
Diffstat (limited to 'plugins/ExampleVisualization')
-rw-r--r--plugins/ExampleVisualization/SimpleTable.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/plugins/ExampleVisualization/SimpleTable.php b/plugins/ExampleVisualization/SimpleTable.php
index 27f34bb004..0ec31af005 100644
--- a/plugins/ExampleVisualization/SimpleTable.php
+++ b/plugins/ExampleVisualization/SimpleTable.php
@@ -11,7 +11,10 @@
namespace Piwik\Plugins\ExampleVisualization;
+use Piwik\DataTable;
use Piwik\ViewDataTable\Visualization;
+use Piwik\Visualization\Config;
+use Piwik\Visualization\Request;
/**
* Simple Visualization Example.
@@ -29,4 +32,42 @@ class SimpleTable extends Visualization
{
$this->vizTitle = 'MyAwesomeTitle';
}
+
+ public function configureVisualization(Config $properties)
+ {
+ // Configure how your visualization should look like, for instance you can disable search
+ // $properties->show_search = false
+ }
+
+ public function beforeLoadDataTable(Request $request, Config $properties)
+ {
+ // Here you can change the request that is sent to the API, for instance
+ // $requestProperties->filter_sort_order = 'desc';
+ }
+
+ public function beforeGenericFiltersAreAppliedToLoadedDataTable($dataTable, Config $properties, Request $request)
+ {
+ // this hook is executed before generic filters like "filter_limit" and "filter_offset" are applied
+ // Usage:
+ // $dateTable->filter($nameOrClosure);
+ }
+
+ public function afterGenericFiltersAreAppliedToLoadedDataTable($dataTable, Config $properties, Request $request)
+ {
+ // this hook is executed after generic filters like "filter_limit" and "filter_offset" are applied
+ // Usage:
+ // $dateTable->filter($nameOrClosure, $parameters);
+ }
+
+ /**
+ * @param DataTable|DataTable\Map $dataTable
+ * @param \Piwik\Visualization\Config $properties
+ * @param \Piwik\Visualization\Request $request
+ */
+ public function afterAllFilteresAreApplied($dataTable, Config $properties, Request $request)
+ {
+ // this hook is executed after the data table is loaded and after all filteres are applied.
+ // format your data here that you want to pass to the view
+ // $this->myCustomViewVariable = $dataTable->getRows();
+ }
} \ No newline at end of file