/** * Load and return the shared navigation of the given type * * @param string $type * * @return Navigation */ public function getSharedNavigation($type) { $config = Config::navigation($type === 'dashboard-pane' ? 'dashlet' : $type); if ($type === 'dashboard-pane') { $panes = array(); foreach ($config as $dashletName => $dashletConfig) { if ($this->hasAccessToSharedNavigationItem($dashletConfig)) { // TODO: Throw ConfigurationError if pane or url is missing $panes[$dashletConfig->pane][$dashletName] = $dashletConfig->url; } } $navigation = new Navigation(); foreach ($panes as $paneName => $dashlets) { $navigation->addItem($paneName, array('type' => 'dashboard-pane', 'dashlets' => $dashlets)); } } else { $items = array(); foreach ($config as $name => $typeConfig) { if ($this->hasAccessToSharedNavigationItem($typeConfig)) { $items[$name] = $typeConfig; } } $navigation = Navigation::fromConfig($items); } return $navigation; }
/** * Load and return this user's configured navigation of the given type * * @param string $type * * @return Navigation */ public function getNavigation($type) { $config = $this->loadNavigationConfig(); $config->getConfigObject()->setKeyColumn('name'); if ($type === 'dashboard-pane') { $panes = array(); foreach ($config->select()->where('type', 'dashlet') as $dashletName => $dashletConfig) { // TODO: Throw ConfigurationError if pane or url is missing $panes[$dashletConfig->pane][$dashletName] = $dashletConfig->url; } $navigation = new Navigation(); foreach ($panes as $paneName => $dashlets) { $navigation->addItem($paneName, array('type' => 'dashboard-pane', 'dashlets' => $dashlets)); } } else { $navigation = Navigation::fromConfig($config->select()->where('type', $type)); } return $navigation; }