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-10 06:28:00 +0400
committerThomas Steur <thomas.steur@gmail.com>2013-10-10 06:28:00 +0400
commit1c50e2119051f5c684a8ceb20312fbd51c661509 (patch)
tree69894694f6c8befdc44d8aa28b70be0d515b6b0b /plugins/ExampleVisualization
parent1274a7ebdf8fd88b5afaf34f103016c7d3378a95 (diff)
added a first example visualization
Diffstat (limited to 'plugins/ExampleVisualization')
-rw-r--r--plugins/ExampleVisualization/ExampleVisualization.php34
-rw-r--r--plugins/ExampleVisualization/README.md18
-rw-r--r--plugins/ExampleVisualization/SimpleTable.php32
-rw-r--r--plugins/ExampleVisualization/images/table.pngbin0 -> 151 bytes
-rw-r--r--plugins/ExampleVisualization/plugin.json16
-rw-r--r--plugins/ExampleVisualization/templates/simpleTable.twig26
6 files changed, 126 insertions, 0 deletions
diff --git a/plugins/ExampleVisualization/ExampleVisualization.php b/plugins/ExampleVisualization/ExampleVisualization.php
new file mode 100644
index 0000000000..9aa6b363c6
--- /dev/null
+++ b/plugins/ExampleVisualization/ExampleVisualization.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ * @category Piwik_Plugins
+ * @package SimpleTableVisualizationExample
+ */
+namespace Piwik\Plugins\ExampleVisualization;
+
+use Piwik\Plugin;
+
+/**
+ * @package SimpleTableVisualizationExample
+ */
+class ExampleVisualization extends Plugin
+{
+ /**
+ * @see Piwik_Plugin::getListHooksRegistered
+ */
+ public function getListHooksRegistered()
+ {
+ return array(
+ 'Visualization.addVisualizations' => 'getAvailableVisualizations'
+ );
+ }
+
+ public function getAvailableVisualizations(&$visualizations)
+ {
+ $visualizations[] = __NAMESPACE__ . '\\SimpleTable';
+ }
+}
diff --git a/plugins/ExampleVisualization/README.md b/plugins/ExampleVisualization/README.md
new file mode 100644
index 0000000000..79c04726ff
--- /dev/null
+++ b/plugins/ExampleVisualization/README.md
@@ -0,0 +1,18 @@
+# Piwik SimpleTableVisualizationExample Plugin
+
+## Description
+
+Example for generating a simple visualization.
+
+## FAQ
+
+__My question?__
+My answer
+
+## Changelog
+
+Here goes the changelog text.
+
+## Support
+
+Please direct any feedback to ... \ No newline at end of file
diff --git a/plugins/ExampleVisualization/SimpleTable.php b/plugins/ExampleVisualization/SimpleTable.php
new file mode 100644
index 0000000000..27f34bb004
--- /dev/null
+++ b/plugins/ExampleVisualization/SimpleTable.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ * @category Piwik_Plugins
+ * @package TreemapVisualization
+ */
+
+namespace Piwik\Plugins\ExampleVisualization;
+
+use Piwik\ViewDataTable\Visualization;
+
+/**
+ * Simple Visualization Example.
+ */
+class SimpleTable extends Visualization
+{
+ const TEMPLATE_FILE = '@ExampleVisualization/simpleTable.twig';
+ const FOOTER_ICON_TITLE = 'Simple Table';
+ const FOOTER_ICON = 'plugins/ExampleVisualization/images/table.png';
+
+ /**
+ * You do not have to implement the init method. It is just an example how to assign view variables.
+ */
+ public function init()
+ {
+ $this->vizTitle = 'MyAwesomeTitle';
+ }
+} \ No newline at end of file
diff --git a/plugins/ExampleVisualization/images/table.png b/plugins/ExampleVisualization/images/table.png
new file mode 100644
index 0000000000..ab0814775d
--- /dev/null
+++ b/plugins/ExampleVisualization/images/table.png
Binary files differ
diff --git a/plugins/ExampleVisualization/plugin.json b/plugins/ExampleVisualization/plugin.json
new file mode 100644
index 0000000000..30d7d51150
--- /dev/null
+++ b/plugins/ExampleVisualization/plugin.json
@@ -0,0 +1,16 @@
+{
+ "name": "ExampleVisualization",
+ "version": "0.1.0",
+ "description": "Example for generating a simple visualization",
+ "theme": false,
+ "license": "GPL-3.0+",
+ "keywords": ["visualization", "example", "table"],
+ "homepage": "http://piwik.org",
+ "authors": [
+ {
+ "name": "The Piwik Team",
+ "email": "hello@piwik.org",
+ "homepage": "http://piwik.org"
+ }
+ ]
+} \ No newline at end of file
diff --git a/plugins/ExampleVisualization/templates/simpleTable.twig b/plugins/ExampleVisualization/templates/simpleTable.twig
new file mode 100644
index 0000000000..6cb0fdadd8
--- /dev/null
+++ b/plugins/ExampleVisualization/templates/simpleTable.twig
@@ -0,0 +1,26 @@
+<div>
+ <h2>{{ vizTitle }}</h2>
+
+ <table class="dataTable">
+ <thead>
+ <tr>
+ {% for name,value in dataTable.getFirstRow.getColumns %}
+ {% if name in properties.translations|keys %}
+ <th>{{ properties.translations[name]|translate }}</th>
+ {% else %}
+ <th>{{ name }}</th>
+ {% endif %}
+ {% endfor %}
+ </tr>
+ </thead>
+ <tbody>
+ {% for tableRow in dataTable.getRows %}
+ <tr>
+ {% for column in tableRow.getColumns %}
+ <td>{{ column|truncate(50)|raw }}</td>
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div> \ No newline at end of file