User: Drop method loadNavigationConfig()

refs #10246
This commit is contained in:
Johannes Meyer 2015-09-30 11:38:14 +02:00
parent befbc6cd6a
commit 037fee298b
2 changed files with 5 additions and 23 deletions

View File

@ -401,8 +401,7 @@ class NavigationConfigForm extends ConfigForm
if ($ownerName === $this->getUser()->getUsername()) { if ($ownerName === $this->getUser()->getUsername()) {
$exists = $this->getUserConfig()->hasSection($name); $exists = $this->getUserConfig()->hasSection($name);
} else { } else {
$owner = new User($ownerName); $exists = Config::navigation($itemConfig->type, $ownerName)->hasSection($name);
$exists = $owner->loadNavigationConfig()->hasSection($name);
} }
} else { } else {
$exists = (bool) $this->getShareConfig() $exists = (bool) $this->getShareConfig()
@ -537,8 +536,7 @@ class NavigationConfigForm extends ConfigForm
if (! $itemConfig->owner || $itemConfig->owner === $this->getUser()->getUsername()) { if (! $itemConfig->owner || $itemConfig->owner === $this->getUser()->getUsername()) {
$config = $this->getUserConfig(); $config = $this->getUserConfig();
} else { } else {
$owner = new User($itemConfig->owner); $config = Config::navigation($itemConfig->type, $itemConfig->owner);
$config = $owner->loadNavigationConfig();
} }
foreach ($children as $child) { foreach ($children as $child) {

View File

@ -479,22 +479,6 @@ class User
return false; return false;
} }
/**
* Load and return this user's navigation configuration
*
* @return Config
*/
public function loadNavigationConfig()
{
return Config::fromIni(
Config::resolvePath('preferences')
. DIRECTORY_SEPARATOR
. $this->getUsername()
. DIRECTORY_SEPARATOR
. 'navigation.ini'
);
}
/** /**
* Load and return this user's configured navigation of the given type * Load and return this user's configured navigation of the given type
* *
@ -504,12 +488,12 @@ class User
*/ */
public function getNavigation($type) public function getNavigation($type)
{ {
$config = $this->loadNavigationConfig(); $config = Config::navigation($type === 'dashboard-pane' ? 'dashlet' : $type);
$config->getConfigObject()->setKeyColumn('name'); $config->getConfigObject()->setKeyColumn('name');
if ($type === 'dashboard-pane') { if ($type === 'dashboard-pane') {
$panes = array(); $panes = array();
foreach ($config->select()->where('type', 'dashlet') as $dashletName => $dashletConfig) { foreach ($config as $dashletName => $dashletConfig) {
// TODO: Throw ConfigurationError if pane or url is missing // TODO: Throw ConfigurationError if pane or url is missing
$panes[$dashletConfig->pane][$dashletName] = $dashletConfig->url; $panes[$dashletConfig->pane][$dashletName] = $dashletConfig->url;
} }
@ -525,7 +509,7 @@ class User
); );
} }
} else { } else {
$navigation = Navigation::fromConfig($config->select()->where('type', $type)); $navigation = Navigation::fromConfig($config);
} }
return $navigation; return $navigation;