public function configureReportingMenu(MenuReporting $menu) { $menu->add('Dashboard_Dashboard', '', array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => 1), true, 5); if (!Piwik::isUserIsAnonymous()) { $login = Piwik::getCurrentUserLogin(); $dashboard = new Dashboard(); $dashboards = $dashboard->getAllDashboards($login); $pos = 0; foreach ($dashboards as $dashboard) { $menu->add('Dashboard_Dashboard', $dashboard['name'], array('module' => 'Dashboard', 'action' => 'embeddedIndex', 'idDashboard' => $dashboard['iddashboard']), true, $pos); $pos++; } } }
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++; } } }
/** * Get the dashboard layout for the current user (anonymous or logged user) * * @param int $idDashboard * * @return string $layout */ protected function getLayout($idDashboard) { if (Piwik::isUserIsAnonymous()) { $session = new SessionNamespace("Dashboard"); if (!isset($session->dashboardLayout)) { return $this->dashboard->getDefaultLayout(); } $layout = $session->dashboardLayout; } else { $layout = $this->dashboard->getLayoutForUser(Piwik::getCurrentUserLogin(), $idDashboard); } if (!empty($layout)) { $layout = $this->dashboard->removeDisabledPluginFromLayout($layout); } if (empty($layout)) { $layout = $this->dashboard->getDefaultLayout(); } return $layout; }