/** * {@inheritdoc} */ public function init() { parent::init(); $this->itemTypeConfig = Navigation::getItemTypeConfiguration(); }
/** * Return the path to the configuration file for the given navigation item type and user * * @param string $type * @param string $username * * @return string * * @throws IcingaException In case the given type is unknown */ protected static function getNavigationConfigPath($type, $username = null) { $itemTypeConfig = Navigation::getItemTypeConfiguration(); if (!isset($itemTypeConfig[$type])) { throw new IcingaException('Invalid navigation item type %s provided', $type); } if (isset($itemTypeConfig[$type]['config'])) { $filename = $itemTypeConfig[$type]['config'] . '.ini'; } else { $filename = $type . 's.ini'; } return static::resolvePath(($username ? 'preferences' . DIRECTORY_SEPARATOR . $username : '******') . DIRECTORY_SEPARATOR . $filename); }
/** * Return the path to the configuration file for the given navigation item type and user * * @param string $type * @param string $username * * @return string * * @throws IcingaException In case the given type is unknown */ protected static function getNavigationConfigPath($type, $username = null) { $itemTypeConfig = Navigation::getItemTypeConfiguration(); if (!isset($itemTypeConfig[$type])) { throw new IcingaException('Invalid navigation item type %s provided', $type); } if (isset($itemTypeConfig[$type]['config'])) { $filename = $itemTypeConfig[$type]['config'] . '.ini'; } else { $filename = $type . 's.ini'; } if ($username) { $path = static::resolvePath(implode(DIRECTORY_SEPARATOR, array('preferences', $username, $filename))); if (realpath($path) === false) { $path = static::resolvePath(implode(DIRECTORY_SEPARATOR, array('preferences', strtolower($username), $filename))); } } else { $path = static::resolvePath('navigation' . DIRECTORY_SEPARATOR . $filename); } return $path; }