Skip to content

Commit 4cbb6e4

Browse files
author
Erik Huelsmann
committed
Address issue #15 - menu doesn't appear.
1 parent b2a79d7 commit 4cbb6e4

File tree

3 files changed

+69
-5
lines changed

3 files changed

+69
-5
lines changed

IPv6Usage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
*/
2020
class IPv6Usage extends \Piwik\Plugin
2121
{
22+
2223
public function getListHooksRegistered()
2324
{
2425
return array(
25-
'Tracker.newVisitorInformation' => 'logIPv6Info',
26-
'WidgetsList.addWidgets' => 'addWidgets',
27-
'API.getReportMetadata' => 'getReportMetadata',
28-
'Menu.Reporting.addItems' => 'addMenu'
26+
'Tracker.newVisitorInformation' => 'logIPv6Info'
2927
);
3028
}
3129

@@ -80,10 +78,12 @@ public function addWidgets()
8078
WidgetsList::add('General_Visitors', 'IPv6Usage_WidgetProtocolDescription', 'IPv6Usage', 'getIPv6UsageGraph');
8179
}
8280

81+
/*
8382
public function addMenu()
8483
{
85-
MenuMain::getInstance()->add('General_Visitors', 'IPv6 Usage', array('module' => 'IPv6Usage', 'action' => 'index'));
84+
MenuMain::getInstance()->addVisitorsItem('Visitors','IPv6 Usage', array('module' => 'IPv6Usage', 'action' => 'index'));
8685
}
86+
*/
8787

8888
/**
8989
* @param array $visitorInfo

Menu.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
/**
3+
* Piwik - free/libre analytics platform
4+
*
5+
* @link http://piwik.org
6+
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7+
*
8+
*/
9+
namespace Piwik\Plugins\IPv6Usage;
10+
11+
use Piwik\Menu\MenuReporting;
12+
13+
/**
14+
* This class allows you to add, remove or rename menu items.
15+
* To configure a menu (such as Admin Menu, Reporting Menu, User Menu...) simply call the corresponding methods as
16+
* described in the API-Reference http://developer.piwik.org/api-reference/Piwik/Menu/MenuAbstract
17+
*/
18+
class Menu extends \Piwik\Plugin\Menu
19+
{
20+
public function configureReportingMenu(MenuReporting $menu)
21+
{
22+
$menu->addVisitorsItem('IPv6 Usage', $this->urlForAction('index'), $order = 100);
23+
}
24+
}

Widgets.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Piwik - free/libre analytics platform
4+
*
5+
* @link http://piwik.org
6+
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7+
*
8+
*/
9+
namespace Piwik\Plugins\IPv6Usage;
10+
11+
use Piwik\View;
12+
use Piwik\WidgetsList;
13+
14+
/**
15+
* This class allows you to add your own widgets to the Piwik platform. In case you want to remove widgets from another
16+
* plugin please have a look at the "configureWidgetsList()" method.
17+
* To configure a widget simply call the corresponding methods as described in the API-Reference:
18+
* http://developer.piwik.org/api-reference/Piwik/Plugin\Widgets
19+
*/
20+
class Widgets extends \Piwik\Plugin\Widgets
21+
{
22+
/**
23+
* Here you can define the category the widget belongs to. You can reuse any existing widget category or define
24+
* your own category.
25+
* @var string
26+
*/
27+
protected $category = 'IPv6 Usage';
28+
29+
/**
30+
* Here you can add one or multiple widgets. You can add a widget by calling the method "addWidget()" and pass the
31+
* name of the widget as well as a method name that should be called to render the widget. The method can be
32+
* defined either directly here in this widget class or in the controller in case you want to reuse the same action
33+
* for instance in the menu etc.
34+
*/
35+
protected function init()
36+
{
37+
$this->addWidget('IPv6 Usage', $method = 'getIPv6UsageGraph');
38+
$this->addWidget('IPv6 Evolution', $method = 'getIPv6UsageEvolutionGraph');
39+
}
40+
}

0 commit comments

Comments
 (0)