public function configureReportingMenu(MenuReporting $menu) { $idSite = Common::getRequestVar('idSite', null, 'int'); $site = new Site($idSite); if ($site->isEcommerceEnabled()) { $ecommerceParams = array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER); $menu->addItem('Goals_Ecommerce', '', array(), 24); $menu->addItem('Goals_Ecommerce', 'General_Overview', $this->urlForAction('ecommerceReport', $ecommerceParams), 1); $menu->addItem('Goals_Ecommerce', 'Goals_EcommerceLog', $this->urlForAction('ecommerceLogReport'), 2); $menu->addItem('Goals_Ecommerce', 'Goals_Products', $this->urlForAction('products', $ecommerceParams), 3); $menu->addItem('Goals_Ecommerce', 'Ecommerce_Sales', $this->urlForAction('sales', $ecommerceParams), 4); } }
public function configureReportingMenu(MenuReporting $menu) { $menu->addItem('Dashboard_Dashboard', '', $this->urlForAction('embeddedIndex', array('idDashboard' => 1)), 5); if (!Piwik::isUserIsAnonymous()) { $login = Piwik::getCurrentUserLogin(); $dashboard = new Dashboard(); $dashboards = $dashboard->getAllDashboards($login); $pos = 0; foreach ($dashboards as $dashboard) { $menu->addItem('Dashboard_Dashboard', $dashboard['name'], $this->urlForAction('embeddedIndex', array('idDashboard' => $dashboard['iddashboard'])), $pos); $pos++; } } }
public function configureReportingMenu(MenuReporting $menu) { $idSite = $this->getIdSite(); $goals = API::getInstance()->getGoals($idSite); $mainGoalMenu = 'Goals_Goals'; if (count($goals) == 0) { $linkToAddNewGoal = $this->urlForAction('addNewGoal', array('idGoal' => null)); $menu->addItem($mainGoalMenu, '', $linkToAddNewGoal, 25); $menu->addItem($mainGoalMenu, 'Goals_AddNewGoal', $linkToAddNewGoal, 1); return; } $order = 1; $url = $this->urlForAction('index', array('idGoal' => null)); $menu->addItem($mainGoalMenu, '', $url, 25); $menu->addItem($mainGoalMenu, 'General_Overview', $url, ++$order); $group = new Group(); foreach ($goals as $goal) { $subMenuName = str_replace('%', '%%', Translate::clean($goal['name'])); $params = $this->urlForAction('goalReport', array('idGoal' => $goal['idgoal'])); $tooltip = sprintf('%s (id = %d)', $subMenuName, $goal['idgoal']); if (count($goals) > 3) { $group->add($subMenuName, $params, $tooltip); } else { $menu->addItem($mainGoalMenu, $subMenuName, $params, ++$order, $tooltip); } } if (count($goals) > 3) { $menu->addGroup($mainGoalMenu, 'Goals_ChooseGoal', $group, ++$order, $tooltip = false); } $menu->addItem($mainGoalMenu, 'Goals_ManageGoals', $this->urlForAction('editGoals'), ++$order); }
public function configureReportingMenu(MenuReporting $menu) { $idSite = Common::getRequestVar('idSite', null, 'int'); $goals = API::getInstance()->getGoals($idSite); $mainGoalMenu = $this->getGoalCategoryName($idSite); $site = new Site($idSite); if (count($goals) == 0) { $action = $site->isEcommerceEnabled() ? 'ecommerceReport' : 'addNewGoal'; $url = $this->urlForAction($action, array('idGoal' => $site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null)); $menu->addItem($mainGoalMenu, '', $url, 25); if ($site->isEcommerceEnabled()) { $menu->addItem($mainGoalMenu, 'Goals_Ecommerce', $this->urlForAction('ecommerceReport', array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER)), 1); } $menu->addItem($mainGoalMenu, 'Goals_AddNewGoal', $this->urlForAction('addNewGoal')); } else { $action = $site->isEcommerceEnabled() ? 'ecommerceReport' : 'index'; $url = $this->urlForAction($action, array('idGoal' => $site->isEcommerceEnabled() ? Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER : null)); $menu->addItem($mainGoalMenu, '', $url, 25); if ($site->isEcommerceEnabled()) { $menu->addItem($mainGoalMenu, 'Goals_Ecommerce', $this->urlForAction('ecommerceReport', array('idGoal' => Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER)), 1); } $menu->addItem($mainGoalMenu, 'Goals_GoalsOverview', array('module' => 'Goals', 'action' => 'index'), 2); $group = new Group(); foreach ($goals as $goal) { $subMenuName = str_replace('%', '%%', Translate::clean($goal['name'])); $params = $this->urlForAction('goalReport', array('idGoal' => $goal['idgoal'])); $tooltip = sprintf('%s (id = %d)', $subMenuName, $goal['idgoal']); if (count($goals) <= 3) { $menu->addItem($mainGoalMenu, $subMenuName, $params, 50, $tooltip); } else { $group->add($subMenuName, $params, $tooltip); } } if (count($goals) > 3) { $menu->addGroup($mainGoalMenu, 'Goals_ChooseGoal', $group, $orderId = 50, $tooltip = false); } } }
public function configureReportingMenu(MenuReporting $menu) { $menu->registerMenuIcon('CampaignDetailed_Adwords', 'icon-chart-bar'); $menu->addItem('CampaignDetailed_Adwords', '', array(), 20); $menu->addItem('CampaignDetailed_Adwords', 'General_Overview', $this->urlForAction('index'), 1); }
private function addDefaultDashboard(MenuReporting $menu) { $menu->addItem('Dashboard_Dashboard', 'Dashboard_Dashboard', $this->urlForAction('embeddedIndex', array('idDashboard' => 1))); }
/** * By default a menu item will be added to the reporting menu if a {@link $menuTitle} is set. If you want to * customize the way the item is added or modify any other behavior you can overwrite this method. For instance * in case you need to add additional url properties beside module and action which are added by default. * @param \Piwik\Menu\MenuReporting $menu * @api */ public function configureReportingMenu(MenuReporting $menu) { if ($this->menuTitle) { $action = $this->getMenuControllerAction(); if ($this->isEnabled()) { $menu->addItem($this->category, $this->menuTitle, array('module' => $this->module, 'action' => $action), $this->order); } } }
private function addSubMenu(MenuReporting $menu, $subMenu, $action, $order) { $menu->addItem('UI Framework', $subMenu, $this->urlForAction($action), $order); }