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

View File

@ -479,22 +479,6 @@ class User
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
*
@ -504,12 +488,12 @@ class User
*/
public function getNavigation($type)
{
$config = $this->loadNavigationConfig();
$config = Config::navigation($type === 'dashboard-pane' ? 'dashlet' : $type);
$config->getConfigObject()->setKeyColumn('name');
if ($type === 'dashboard-pane') {
$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
$panes[$dashletConfig->pane][$dashletName] = $dashletConfig->url;
}
@ -525,7 +509,7 @@ class User
);
}
} else {
$navigation = Navigation::fromConfig($config->select()->where('type', $type));
$navigation = Navigation::fromConfig($config);
}
return $navigation;