From 253b165e621953efcb692f985036e217920ba696 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 19 Jun 2014 03:37:17 +0200 Subject: added possibility to pass a report instance to renderReport() in controller, fixed a bug in menu where the sorting was wrong in case the first added menu item of a category was a submenu entry, made sure it is possible for plugin Menu classes to rename/modify report menu entries, created some reports for live plugin, centralized no permission to view report check and made it possible to overwrite this message for each report --- core/Menu/MenuAbstract.php | 23 +++++++++++++++-------- core/Menu/MenuReporting.php | 7 ++++--- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'core/Menu') diff --git a/core/Menu/MenuAbstract.php b/core/Menu/MenuAbstract.php index 3f624b117f..cbd5c5a798 100644 --- a/core/Menu/MenuAbstract.php +++ b/core/Menu/MenuAbstract.php @@ -126,13 +126,17 @@ abstract class MenuAbstract extends Singleton */ private function buildMenuItem($menuName, $subMenuName, $url, $order = 50, $tooltip = false) { - if (!isset($this->menu[$menuName]) || empty($subMenuName)) { - $this->menu[$menuName]['_url'] = $url; - if (empty($subMenuName)) { - $this->menu[$menuName]['_order'] = $order; - } - $this->menu[$menuName]['_name'] = $menuName; - $this->menu[$menuName]['_hasSubmenu'] = false; + if (!isset($this->menu[$menuName])) { + $this->menu[$menuName] = array( + '_hasSubmenu' => false, + '_order' => $order + ); + } + + if (empty($subMenuName)) { + $this->menu[$menuName]['_url'] = $url; + $this->menu[$menuName]['_order'] = $order; + $this->menu[$menuName]['_name'] = $menuName; $this->menu[$menuName]['_tooltip'] = $tooltip; } if (!empty($subMenuName)) { @@ -141,7 +145,10 @@ abstract class MenuAbstract extends Singleton $this->menu[$menuName][$subMenuName]['_name'] = $subMenuName; $this->menu[$menuName][$subMenuName]['_tooltip'] = $tooltip; $this->menu[$menuName]['_hasSubmenu'] = true; - $this->menu[$menuName]['_tooltip'] = $tooltip; + + if (!array_key_exists('_tooltip', $this->menu[$menuName])) { + $this->menu[$menuName]['_tooltip'] = $tooltip; + } } } diff --git a/core/Menu/MenuReporting.php b/core/Menu/MenuReporting.php index 67f95bb8a6..d704134510 100644 --- a/core/Menu/MenuReporting.php +++ b/core/Menu/MenuReporting.php @@ -68,13 +68,14 @@ class MenuReporting extends MenuAbstract */ Piwik::postEvent('Menu.Reporting.addItems', array()); + foreach (Report::getAllReports() as $report) { + $report->configureReportingMenu($this); + } + foreach ($this->getAvailableMenus() as $menu) { $menu->configureReportingMenu($this); } - foreach (Report::getAllReports() as $report) { - $report->configureReportingMenu($this); - } } return parent::getMenu(); -- cgit v1.2.3