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

ExampleUI.php « ExampleUI « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 98a8e469ab41317e11f9ed53b2c38efa0b216b9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 */

namespace Piwik\Plugins\ExampleUI;
use Piwik\Menu\MenuMain;
use Piwik\Menu\MenuTop;

/**
 */
class ExampleUI extends \Piwik\Plugin
{
    /**
     * @see Piwik_Plugin::getListHooksRegistered
     */
    public function getListHooksRegistered()
    {
        return array(
            'Menu.Reporting.addItems' => 'addReportingMenuItems',
            'Menu.Top.addItems'       => 'addTopMenuItems',
        );
    }

    function addReportingMenuItems()
    {
        MenuMain::getInstance()->add('UI Framework', '', array('module' => 'ExampleUI', 'action' => 'dataTables'), true, 30);

        $this->addSubMenu('Data tables', 'dataTables', 1);
        $this->addSubMenu('Bar graph', 'barGraph', 2);
        $this->addSubMenu('Pie graph', 'pieGraph', 3);
        $this->addSubMenu('Tag clouds', 'tagClouds', 4);
        $this->addSubMenu('Sparklines', 'sparklines', 5);
        $this->addSubMenu('Evolution Graph', 'evolutionGraph', 6);

        if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('TreemapVisualization')) {
            $this->addSubMenu('Treemap', 'treemap', 7);
        }
    }

    function addTopMenuItems()
    {
        $urlParams = array('module' => 'ExampleUI', 'action' => 'notifications');
        MenuTop::getInstance()->addEntry('UI Notifications', $urlParams, $displayedForCurrentUser = true, $order = 3);
    }

    private function addSubMenu($subMenu, $action, $order)
    {
        MenuMain::getInstance()->add('UI Framework', $subMenu, array('module' => 'ExampleUI', 'action' => $action), true, $order);
    }
}