/** * setConfig * * Store the configuration of the recommendation module. * * RecommendLinks:[ini section]:[ini name] * Display links listed in the specified section of the specified ini file; * if [ini name] is left out, it defaults to "searches." * * @param string $settings Settings from searches.ini. * * @return void */ public function setConfig($settings) { $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'RecommendLinks' : $settings[0]; $iniName = isset($settings[1]) ? $settings[1] : 'searches'; $config = $this->configLoader->get($iniName); $this->links = isset($config->{$mainSection}) ? $config->{$mainSection}->toArray() : array(); }
/** * setConfig * * Store the configuration of the recommendation module. * * @param string $settings Settings from searches.ini. * * @return void */ public function setConfig($settings) { $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'SpecifiableFacets' : $settings[0]; $iniName = isset($settings[1]) ? $settings[1] : 'searches'; $config = $this->configLoader->get($iniName); $specFacets = isset($config->{$mainSection}) ? $config->{$mainSection} : array(); foreach ($specFacets as $label => $expand) { list($baseFacet, $expFacetField, $type) = explode(':', $expand); if ($type == 'select') { $this->facetsWithSelect[] = $expFacetField; } $this->config[$baseFacet] = array('label' => $label, 'field' => $expFacetField); } }
/** * Return configuration for the patron's active library card driver. * * @param array $patron Patron * * @return bool|array False if no driver configuration was found, * or configuration. */ protected function getPatronDriverConfig($patron) { if (isset($patron['cat_username']) && ($pos = strpos($patron['cat_username'], '.')) > 0) { $source = substr($patron['cat_username'], 0, $pos); $config = $this->configReader->get($source); return is_object($config) ? $config->toArray() : []; } return false; }
/** * setConfig * * Store the configuration of the recommendation module. * * @param string $settings Settings from searches.ini. * * @return void */ public function setConfig($settings) { $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'MapSelection' : $settings[0]; $iniName = isset($settings[1]) ? $settings[1] : 'searches'; $config = $this->configLoader->get($iniName); if (isset($config->{$mainSection})) { $entries = $config->{$mainSection}; if (isset($entries->default_coordinates)) { $this->defaultCoordinates = explode(',', $entries->default_coordinates); } if (isset($entries->geo_field)) { $this->geoField = $entries->geo_field; } if (isset($entries->height)) { $this->height = $entries->height; } } }
/** * Load favorites data * Extract from a config object * * @return Array */ protected function loadInstitutionFavoriteData() { /** * Favorite institution config * * @var Config $config */ $config = $this->configManager->get('favorite-institutions'); return $config->toArray(); }
/** * Store the configuration of the recommendation module. * * @param string $settings Settings from searches.ini. * * @return void */ public function setConfig($settings) { // Save the basic parameters: $this->settings = $settings; // Parse the additional settings: $settings = explode(':', $settings); $mainSection = empty($settings[0]) ? 'Results' : $settings[0]; $iniName = isset($settings[1]) ? $settings[1] : 'facets'; // Load the desired facet information... $config = $this->configLoader->get($iniName); // All standard facets to display: $this->facets = isset($config->{$mainSection}) ? $config->{$mainSection}->toArray() : []; }
/** * Get configuration for the ILS driver. We will load an .ini file named * after the driver class and number if it exists; * otherwise we will return an empty array. * * @param string $source The source id to use for determining the * configuration file * * @return array The configuration of the driver */ protected function getDriverConfig($source) { // Determine config file name based on class name: try { $config = $this->configLoader->get($source); } catch (\Zend\Config\Exception\RuntimeException $e) { // Configuration loading failed; probably means file does not // exist -- just return an empty array in that case: $this->error("Could not load config for {$source}"); return []; } return $config->toArray(); }
/** * Return configuration for the patron's active library card driver. * * @param array $patron Patron * * @return bool|array False if no driver configuration was found, * or configuration. */ protected function getPatronDriverConfig($patron) { if (null === $this->configReader) { return false; } if (isset($patron['cat_username']) && ($pos = strpos($patron['cat_username'], '.')) > 0) { $source = substr($patron['cat_username'], 0, $pos); $config = $this->configReader->get("VoyagerRestful_{$source}"); if (!is_object($config) || $config->count() == 0) { $config = $this->configReader->get($source); } return is_object($config) ? $config->toArray() : []; } return false; }
public function __construct(\VuFind\Config\PluginManager $configLoader) { $this->config = $configLoader->get('browse'); }
/** * Constructor * * @param \VuFind\Config\PluginManager $configLoader Configuration loader * @param array $apiInfo API information */ public function __construct(\VuFind\Config\PluginManager $configLoader, $apiInfo = null) { $this->searchIni = $this->facetsIni = 'EDS'; $searchSettings = $configLoader->get($this->searchIni); parent::__construct($configLoader); $this->resultLimit = 100; $this->viewOptions = ['list|title' => 'Title View', 'list|brief' => 'Brief View', 'list|detailed' => 'Detailed View']; $this->apiInfo = $apiInfo; $this->setOptionsFromApi($searchSettings); $this->setOptionsFromConfig($searchSettings); $facetConf = $configLoader->get($this->facetsIni); if (isset($facetConf->Advanced_Facet_Settings->translated_facets) && count($facetConf->Advanced_Facet_Settings->translated_facets) > 0) { $this->setTranslatedFacets($facetConf->Advanced_Facet_Settings->translated_facets->toArray()); } }
/** * Map legacy VuFind settings into the permissions.ini setup. * * @param \VuFind\Config\PluginManager $loader Config loader * @param array $permissions Permissions to update * * @return array */ protected function addLegacySettings(\VuFind\Config\PluginManager $loader, array $permissions) { // Add admin settings if they are absent: if (!$this->permissionDefined($permissions, 'access.AdminModule')) { $config = $loader->get('config')->toArray(); $permissions['legacy.AdminModule'] = []; if (isset($config['AdminAuth']['ipRegEx'])) { $permissions['legacy.AdminModule']['ipRegEx'] = $config['AdminAuth']['ipRegEx']; } if (isset($config['AdminAuth']['userWhitelist'])) { $permissions['legacy.AdminModule']['username'] = $config['AdminAuth']['userWhitelist']; } // If no settings exist in config.ini, we grant access to everyone // by allowing both logged-in and logged-out roles. if (empty($permissions['legacy.AdminModule'])) { $permissions['legacy.AdminModule']['role'] = ['guest', 'loggedin']; } $permissions['legacy.AdminModule']['permission'] = 'access.AdminModule'; } // Add staff view setting it they are absent: if (!$this->permissionDefined($permissions, 'access.StaffViewTab')) { $permissions['legacy.StaffViewTab']['role'] = ['guest', 'loggedin']; $permissions['legacy.StaffViewTab']['permission'] = 'access.StaffViewTab'; } // Add EIT settings if they are absent: if (!$this->permissionDefined($permissions, 'access.EITModule')) { $permissions['legacy.EITModule'] = ['role' => 'loggedin', 'permission' => 'access.EITModule']; } // Add Summon settings if they are absent: // Check based on login status $defined = $this->permissionDefined($permissions, 'access.SummonExtendedResults'); if (!$defined) { $config = $loader->get('Summon'); $permissions['legacy.SummonExtendedResults'] = []; if (isset($config->Auth->check_login) && $config->Auth->check_login) { $permissions['legacy.SummonExtendedResults']['role'] = ['loggedin']; } if (isset($config->Auth->ip_range)) { $permissions['legacy.SummonExtendedResults']['ipRegEx'] = $config->Auth->ip_range; } if (!empty($permissions['legacy.SummonExtendedResults'])) { $permissions['legacy.SummonExtendedResults']['require'] = 'ANY'; $permissions['legacy.SummonExtendedResults']['permission'] = 'access.SummonExtendedResults'; } else { unset($permissions['legacy.SummonExtendedResults']); } } return $permissions; }
/** * Load all recommendation settings from the relevant ini file. Returns an * associative array where the key is the location of the recommendations (top * or side) and the value is the settings found in the file (which may be either * a single string or an array of strings). * * @param string $handler Name of handler for which to load specific settings. * * @return array associative: location (top/side/etc.) => search settings */ public function getRecommendationSettings($handler = null) { // Load the necessary settings to determine the appropriate recommendations // module: $searchSettings = $this->configLoader->get($this->getSearchIni()); // Load a type-specific recommendations setting if possible, or the default // otherwise: $recommend = []; if (null !== $handler && isset($searchSettings->TopRecommendations->{$handler})) { $recommend['top'] = $searchSettings->TopRecommendations->{$handler}->toArray(); } else { $recommend['top'] = isset($searchSettings->General->default_top_recommend) ? $searchSettings->General->default_top_recommend->toArray() : false; } if (null !== $handler && isset($searchSettings->SideRecommendations->{$handler})) { $recommend['side'] = $searchSettings->SideRecommendations->{$handler}->toArray(); } else { $recommend['side'] = isset($searchSettings->General->default_side_recommend) ? $searchSettings->General->default_side_recommend->toArray() : false; } if (null !== $handler && isset($searchSettings->NoResultsRecommendations->{$handler})) { $recommend['noresults'] = $searchSettings->NoResultsRecommendations->{$handler}->toArray(); } else { $recommend['noresults'] = isset($searchSettings->General->default_noresults_recommend) ? $searchSettings->General->default_noresults_recommend->toArray() : false; } return $recommend; }
public function __construct(\VuFind\Config\PluginManager $configLoader, IdentityResolver $identityResolver) { $this->shibbolethConfig = $configLoader->get($this::CONFIG_FILE_NAME); if (empty($this->shibbolethConfig)) { throw new AuthException("Could not load " . $this::CONFIG_FILE_NAME . ".ini configuration file."); } $this->identityResolver = $identityResolver; }
/** * Get configuration for the ILS driver. We will load an .ini file named * after the driver class if it exists; otherwise we will return an empty * array. * * @return array */ public function getDriverConfig() { // Determine config file name based on class name: $parts = explode('\\', $this->getDriverClass()); $config = $this->configReader->get(end($parts)); return is_object($config) ? $config->toArray() : []; }
/** * Initialize helper with dependencies * * @param IlsConnection $ilsConnection * @param HMAC $hmac * @param AuthManager $authManager * @param ConfigManager $configManager * @param Translator $translator * @param LocationMap $locationMap * @param BibCode $bibCodeHelper * @param Logger $swissbibLogger * @throws \Exception */ public function __construct(IlsConnection $ilsConnection, HMAC $hmac, AuthManager $authManager, IlsAuth $ilsAuth, ConfigManager $configManager, Translator $translator, LocationMap $locationMap, EbooksOnDemand $ebooksOnDemand, Availability $availability, BibCode $bibCodeHelper, Logger $swissbibLogger) { $this->ils = $ilsConnection; $this->configManager = $configManager; $this->configHoldings = $configManager->get('Holdings'); $this->hmac = $hmac; $this->authManager = $authManager; $this->ilsAuth = $ilsAuth; $this->translator = $translator; $this->locationMap = $locationMap; $this->ebooksOnDemand = $ebooksOnDemand; $this->availability = $availability; $this->bibCodeHelper = $bibCodeHelper; $this->swissbibLogger = $swissbibLogger; /** @var Config $relationConfig */ $relationConfig = $configManager->get('libadmin-groups'); // Just ignore missing config to prevent a crashing frontend if ($relationConfig->count() !== null) { $this->institution2group = $relationConfig->institutions->toArray(); $this->groupSorting = $relationConfig->groups->toArray(); } elseif (APPLICATION_ENV == 'development') { throw new \Exception('Missing config file libadmin-groups.ini. Run libadmin sync to solve this problem'); } $holdsIlsConfig = $this->ils->checkFunction('Holds'); $this->hmacKeys = $holdsIlsConfig['HMACKeys']; $this->initNetworks(); }
/** * Create the query builder. * * @return QueryBuilder */ protected function createQueryBuilder() { $specs = $this->loadSpecs(); $config = $this->config->get('config'); $defaultDismax = isset($config->Index->default_dismax_handler) ? $config->Index->default_dismax_handler : 'dismax'; $builder = new QueryBuilder($specs, $defaultDismax); // Configure builder: $search = $this->config->get($this->searchConfig); $caseSensitiveBooleans = isset($search->General->case_sensitive_bools) ? $search->General->case_sensitive_bools : true; $caseSensitiveRanges = isset($search->General->case_sensitive_ranges) ? $search->General->case_sensitive_ranges : true; $helper = new LuceneSyntaxHelper($caseSensitiveBooleans, $caseSensitiveRanges); $builder->setLuceneHelper($helper); return $builder; }
/** * Constructor * * @param \VuFind\Config\PluginManager $configLoader Configuration loader * @param array $apiInfo API information */ public function __construct(\VuFind\Config\PluginManager $configLoader, $apiInfo = null) { $this->searchIni = 'EDS'; $searchSettings = $configLoader->get($this->searchIni); parent::__construct($configLoader); $this->viewOptions = ['list|title' => 'Title View', 'list|brief' => 'Brief View', 'list|detailed' => 'Detailed View']; $this->apiInfo = $apiInfo; $this->setOptionsFromApi($searchSettings); $this->setOptionsFromConfig($searchSettings); }
public function __construct(\VuFind\Config\PluginManager $configLoader, UserTable $userTableGateway) { $this->shibbolethConfig = $configLoader->get(static::CONFIG_FILE_NAME); if (empty($this->shibbolethConfig)) { throw new AuthException("Could not load " . static::CONFIG_FILE_NAME . ".ini configuration file."); } $this->userTableGateway = $userTableGateway; }
/** * Create the similar records query builder. * * @return SimilarBuilder */ protected function createSimilarBuilder() { return new SimilarBuilder($this->config->get($this->searchConfig), $this->uniqueKey); }