2021-07-15 14:27:23 +02:00
|
|
|
<?PHP
|
|
|
|
/**
|
|
|
|
* Contains a class listing central object repositories which may share contents
|
|
|
|
* with museum-digital.
|
|
|
|
*
|
|
|
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
|
|
*/
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class listing syndication sources.
|
|
|
|
*/
|
|
|
|
final class MDObjectSyndicationSet extends MDValueSet {
|
|
|
|
|
|
|
|
const REPOSITORIES = [
|
|
|
|
|
|
|
|
'ddb' => [
|
|
|
|
'url' => 'https://www.deutsche-digitale-bibliothek.de/',
|
|
|
|
'object_prefix' => 'https://www.deutsche-digitale-bibliothek.de/item/',
|
|
|
|
'org_prefix' => 'https://www.deutsche-digitale-bibliothek.de/organization/',
|
|
|
|
'id_is_int' => false,
|
|
|
|
],
|
|
|
|
'europeana' => [
|
|
|
|
'url' => 'https://www.europeana.eu/',
|
|
|
|
'object_prefix' => 'https://www.europeana.eu/en/item/',
|
|
|
|
'org_prefix' => null,
|
|
|
|
'id_is_int' => false,
|
|
|
|
],
|
2021-07-23 16:02:34 +02:00
|
|
|
'smb-digital' => [
|
|
|
|
'url' => 'http://www.smb-digital.de/',
|
2022-06-24 11:06:33 +02:00
|
|
|
'object_prefix' => 'https://recherche.smb.museum/detail/',
|
2021-07-23 16:02:34 +02:00
|
|
|
'org_prefix' => null,
|
|
|
|
'id_is_int' => true,
|
|
|
|
],
|
2021-07-25 10:30:05 +02:00
|
|
|
'kalliope-verbund' => [
|
|
|
|
'url' => 'https://kalliope-verbund.info/',
|
|
|
|
'object_prefix' => 'https://kalliope-verbund.info/',
|
|
|
|
'org_prefix' => 'https://kalliope-verbund.info/isil?isil.id=',
|
|
|
|
'id_is_int' => false,
|
|
|
|
],
|
2021-07-15 14:27:23 +02:00
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a correctly formed search URL for a given object in a given
|
|
|
|
* repository, optionally naming the institution.
|
|
|
|
*
|
|
|
|
* @param string $repo Repository to search in.
|
|
|
|
* @param string $instId Remote ID of the institution to search for.
|
|
|
|
* @param string $search_value Search string.
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2021-07-15 16:56:54 +02:00
|
|
|
public static function getSearchUrlForObject(string $repo, string $instId, string $search_value):string {
|
2021-07-15 14:27:23 +02:00
|
|
|
|
|
|
|
switch ($repo) {
|
|
|
|
case 'ddb':
|
|
|
|
return "https://www.deutsche-digitale-bibliothek.de/searchresults?query=" . \urlencode($search_value) . "&facetValues[]=" . \urlencode("provider_id=" . $instId);
|
|
|
|
default:
|
|
|
|
throw new MDpageParameterNotFromListException("Search URLs can only be generated for the following repositories: ddb");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-07-15 16:56:54 +02:00
|
|
|
/**
|
|
|
|
* Function for checking the availability of a provided repository in the
|
|
|
|
* list of known repositories.
|
|
|
|
*
|
|
|
|
* @param string $repo Repository name to check.
|
|
|
|
*
|
|
|
|
* @return string|boolean
|
|
|
|
*/
|
|
|
|
final public static function checkRepositoryIsKnown(string $repo) {
|
|
|
|
if (isset(self::REPOSITORIES[$repo])) {
|
2021-07-15 17:13:08 +02:00
|
|
|
return $repo;
|
2021-07-15 16:56:54 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-07-15 14:27:23 +02:00
|
|
|
/**
|
|
|
|
* Gets a sorted list of the entries in a translated version.
|
|
|
|
*
|
|
|
|
* @param MDTlLoader $tlLoader Translation loader.
|
|
|
|
*
|
|
|
|
* @return array<string>
|
|
|
|
*/
|
|
|
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
|
|
|
|
|
|
|
return parent::getTlSortedList($tlLoader, array_keys(self::REPOSITORIES), "syndication_repos", "syndication_repos");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|