diff options
author | Thomas Steur <thomas.steur@gmail.com> | 2016-04-04 03:10:40 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@gmail.com> | 2016-04-06 13:17:27 +0300 |
commit | 3a6d626c2474b83ea5c4125fd33dfe12b9e0bf8a (patch) | |
tree | 9de2cd1d85e1f8a7211f0514f8deae2b152faa89 /core/Menu | |
parent | 780c09b144e048cc748429bc06d016354d44746e (diff) |
refs #9354 merge user and admin menu to one single menu
Diffstat (limited to 'core/Menu')
-rw-r--r-- | core/Menu/MenuAdmin.php | 29 | ||||
-rwxr-xr-x | core/Menu/MenuUser.php | 91 |
2 files changed, 16 insertions, 104 deletions
diff --git a/core/Menu/MenuAdmin.php b/core/Menu/MenuAdmin.php index 9c05734e5f..c8273ed16b 100644 --- a/core/Menu/MenuAdmin.php +++ b/core/Menu/MenuAdmin.php @@ -8,6 +8,7 @@ */ namespace Piwik\Menu; +use Piwik\Development; use Piwik\Piwik; /** @@ -33,7 +34,7 @@ use Piwik\Piwik; class MenuAdmin extends MenuAbstract { /** - * See {@link add()}. Adds a new menu item to the development section of the admin menu. + * See {@link add()}. Adds a new menu item to the manage section of the user menu. * @param string $menuName * @param array $url * @param int $order @@ -41,13 +42,13 @@ class MenuAdmin extends MenuAbstract * @api * @since 2.5.0 */ - public function addDevelopmentItem($menuName, $url, $order = 50, $tooltip = false) + public function addPersonalItem($menuName, $url, $order = 50, $tooltip = false) { - $this->addItem('CoreAdminHome_MenuDevelopment', $menuName, $url, $order, $tooltip); + $this->addItem('UsersManager_MenuPersonal', $menuName, $url, $order, $tooltip); } /** - * See {@link add()}. Adds a new menu item to the diagnostic section of the admin menu. + * See {@link add()}. Adds a new menu item to the development section of the admin menu. * @param string $menuName * @param array $url * @param int $order @@ -55,13 +56,15 @@ class MenuAdmin extends MenuAbstract * @api * @since 2.5.0 */ - public function addDiagnosticItem($menuName, $url, $order = 50, $tooltip = false) + public function addDevelopmentItem($menuName, $url, $order = 50, $tooltip = false) { - $this->addItem('CoreAdminHome_MenuDiagnostic', $menuName, $url, $order, $tooltip); + if (Development::isEnabled()) { + $this->addItem('CoreAdminHome_MenuDevelopment', $menuName, $url, $order, $tooltip); + } } /** - * See {@link add()}. Adds a new menu item to the platform section of the admin menu. + * See {@link add()}. Adds a new menu item to the diagnostic section of the admin menu. * @param string $menuName * @param array $url * @param int $order @@ -69,13 +72,13 @@ class MenuAdmin extends MenuAbstract * @api * @since 2.5.0 */ - public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false) + public function addDiagnosticItem($menuName, $url, $order = 50, $tooltip = false) { - $this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip); + $this->addItem('CoreAdminHome_MenuDiagnostic', $menuName, $url, $order, $tooltip); } /** - * See {@link add()}. Adds a new menu item to the settings section of the admin menu. + * See {@link add()}. Adds a new menu item to the platform section of the admin menu. * @param string $menuName * @param array $url * @param int $order @@ -83,9 +86,9 @@ class MenuAdmin extends MenuAbstract * @api * @since 2.5.0 */ - public function addSettingsItem($menuName, $url, $order = 50, $tooltip = false) + public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false) { - $this->addItem('General_Settings', $menuName, $url, $order, $tooltip); + $this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip); } /** @@ -99,7 +102,7 @@ class MenuAdmin extends MenuAbstract */ public function addManageItem($menuName, $url, $order = 50, $tooltip = false) { - $this->addItem('CoreAdminHome_Administration', $menuName, $url, $order, $tooltip); + $this->addItem('CoreAdminHome_MenuManage', $menuName, $url, $order, $tooltip); } /** diff --git a/core/Menu/MenuUser.php b/core/Menu/MenuUser.php deleted file mode 100755 index ac3bc295ab..0000000000 --- a/core/Menu/MenuUser.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php -/** - * Piwik - free/libre analytics platform - * - * @link http://piwik.org - * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - * - */ -namespace Piwik\Menu; - -/** - * Contains menu entries for the User menu (the menu at the very top of the page). - * Plugins can implement the `configureUserMenu()` method of the `Menu` plugin class to add, rename of remove - * items. If your plugin does not have a `Menu` class yet you can create one using `./console generate:menu`. - * - * **Example** - * - * public function configureUserMenu(MenuUser $menu) - * { - * $menu->add( - * 'MyPlugin_MyTranslatedMenuCategory', - * 'MyPlugin_MyTranslatedMenuName', - * array('module' => 'MyPlugin', 'action' => 'index'), - * Piwik::isUserHasSomeAdminAccess(), - * $order = 2 - * ); - * } - * - * @method static MenuUser getInstance() - */ -class MenuUser extends MenuAbstract -{ - - /** - * See {@link add()}. Adds a new menu item to the manage section of the user menu. - * @param string $menuName - * @param array $url - * @param int $order - * @param bool|string $tooltip - * @api - * @since 2.5.0 - */ - public function addPersonalItem($menuName, $url, $order = 50, $tooltip = false) - { - $this->addItem('UsersManager_MenuPersonal', $menuName, $url, $order, $tooltip); - } - - /** - * See {@link add()}. Adds a new menu item to the manage section of the user menu. - * @param string $menuName - * @param array $url - * @param int $order - * @param bool|string $tooltip - * @api - * @since 2.5.0 - */ - public function addManageItem($menuName, $url, $order = 50, $tooltip = false) - { - $this->addItem('CoreAdminHome_MenuManage', $menuName, $url, $order, $tooltip); - } - - /** - * See {@link add()}. Adds a new menu item to the platform section of the user menu. - * @param string $menuName - * @param array $url - * @param int $order - * @param bool|string $tooltip - * @api - * @since 2.5.0 - */ - public function addPlatformItem($menuName, $url, $order = 50, $tooltip = false) - { - $this->addItem('CorePluginsAdmin_MenuPlatform', $menuName, $url, $order, $tooltip); - } - - /** - * Triggers the Menu.User.addItems hook and returns the menu. - * - * @return Array - */ - public function getMenu() - { - if (!$this->menu) { - foreach ($this->getAllMenus() as $menu) { - $menu->configureUserMenu($this); - } - } - - return parent::getMenu(); - } -} |