/** * Gets the path to the dir where the export files should be placed. * * @return string */ public function getExportFilesDirPath() { $editorOptions = OpenSKOS_Application_BootstrapAccess::getOption('editor'); if (isset($editorOptions['export']['filesPath'])) { $mainDirPath = $editorOptions['export']['filesPath']; } else { $mainDirPath = APPLICATION_PATH . '/../public/data/export'; } $mainDirPath = rtrim($mainDirPath, '/') . '/'; return $mainDirPath; }
/** * Gets a list of concepts matching the search options. * * @param array $searchOptions * @return array An array with the labels of the schemes */ public function searchConcepts($searchOptions) { $editorOptions = OpenSKOS_Application_BootstrapAccess::getOption('editor'); $availableOptions = Editor_Forms_SearchOptions::getAvailableSearchOptions(); $availableOptions['conceptSchemes'] = $this->getAllConceptSchemeUriTitlesMap(); $query = OpenSKOS_Solr_Queryparser_Editor::factory()->parse($searchOptions, $editorOptions['languages'], $availableOptions, $this->_getCurrentTenant()); // Pagination $queryParams = array(); if (isset($searchOptions['start']) && !empty($searchOptions['start'])) { $queryParams['start'] = $searchOptions['start']; } if (isset($searchOptions['rows']) && !empty($searchOptions['rows'])) { $queryParams['rows'] = $searchOptions['rows']; } //@TODO: implement language specific sort by using prefLabelSort@... Solr fields $queryParams['sort'] = 'prefLabelSort asc'; $response = Api_Models_Concepts::factory()->setQueryParams($queryParams)->getConcepts($query); $response = $response['response']; $result = array(); $result['numFound'] = $response['numFound']; $result['data'] = array(); if (isset($response['start'])) { $result['start'] = $response['start']; } if ($response['numFound'] > 0) { foreach ($response['docs'] as &$record) { $result['data'][] = new Api_Models_Concept($record); } } return $result; }
/** * @return array */ protected function setConceptLanguages() { //@FIXME it's a good idea to have a settings class that deals with .ini parameters, verification & default values. $editorSettings = OpenSKOS_Application_BootstrapAccess::getOption('editor'); $languages = array(); $this->_conceptLanguages = array(); if (isset($editorSettings['languages'])) { $languages = $editorSettings['languages']; } foreach ($languages as $languageCode => $languageName) { foreach (self::$languageSensitiveClasses as $class) { foreach (self::$classes[$class] as $fieldName) { if (isset($this[$fieldName . '@' . $languageCode])) { $this->_conceptLanguages[] = $languageCode; break; } } } } $this->_conceptLanguages = array_unique($this->_conceptLanguages); return $this->_conceptLanguages; }
public function getConceptsBaseUri() { if (isset($this->conceptsBaseUrl) && !empty($this->conceptsBaseUrl)) { return $this->conceptsBaseUrl; } else { $editorOptions = OpenSKOS_Application_BootstrapAccess::getOption('editor'); if (isset($editorOptions['conceptSchemesDefaultBaseUri'])) { return $editorOptions['conceptSchemesDefaultBaseUri']; } else { return ''; } } }