forked from museum-digital/MDAllowedValueSets
Compare commits
23 Commits
7d42e416b3
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
be6a6c412e
|
|||
| d92e29ddd0 | |||
|
79f13ee9c5
|
|||
|
7f882de3ae
|
|||
|
d255317d84
|
|||
|
834d06b70a
|
|||
|
8a1c33fbc3
|
|||
|
c693fff212
|
|||
|
bb4640ae2c
|
|||
|
a01cf57162
|
|||
|
88c357c00f
|
|||
|
07434d41b1
|
|||
|
9a45e7bbf4
|
|||
|
51ae4c4737
|
|||
|
49ebf6fd63
|
|||
|
28ca68d0d7
|
|||
|
c680cd0f9a
|
|||
|
efbb62c6ae
|
|||
|
2fc774430c
|
|||
|
611e0bf54f
|
|||
|
a93d763ebb
|
|||
|
4bd9e010f9
|
|||
|
16440620e0
|
+1
-1
Submodule l18n updated: c7d1a5e1bd...38eb44046b
@@ -84,6 +84,9 @@ final class MDEventsSet extends MDValueSet {
|
|||||||
// Array enthält Ereignistypen, die auf Korrespondenzen hinweisen
|
// Array enthält Ereignistypen, die auf Korrespondenzen hinweisen
|
||||||
public const EVENTS_CORRESPONDENCE = [11, 13];
|
public const EVENTS_CORRESPONDENCE = [11, 13];
|
||||||
|
|
||||||
|
// List of array types that contain ownership information.
|
||||||
|
public const EVENTS_OWNERSHIP_RELATED = [40, 41, 42, 43, 49, 50, 56, 57, 58];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants for event types without places, times, actors
|
* Constants for event types without places, times, actors
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ final class MDNodaRepositoriesSet extends MDValueSet {
|
|||||||
public const REPOSITORIES_TAG = [
|
public const REPOSITORIES_TAG = [
|
||||||
'aat',
|
'aat',
|
||||||
'ackerbau',
|
'ackerbau',
|
||||||
|
'avefi',
|
||||||
'allgemein',
|
'allgemein',
|
||||||
'col',
|
'col',
|
||||||
'bne',
|
'bne',
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ final class MDObjectPositionsSet extends MDValueSet {
|
|||||||
'rear_side',
|
'rear_side',
|
||||||
'rear_left', 'rear_top_left', 'rear_top', 'rear_top_right', 'rear_right', 'rear_bottom_right', 'rear_bottom', 'rear_bottom_left', 'rear_center',
|
'rear_left', 'rear_top_left', 'rear_top', 'rear_top_right', 'rear_right', 'rear_bottom_right', 'rear_bottom', 'rear_bottom_left', 'rear_center',
|
||||||
'underside', 'topside',
|
'underside', 'topside',
|
||||||
'edge', 'inside', 'other',
|
'edge', 'inside', 'other', 'mock_title',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,162 @@
|
|||||||
|
<?PHP
|
||||||
|
/**
|
||||||
|
* Represents a type of contribution to an appointment.
|
||||||
|
*
|
||||||
|
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||||
|
*/
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a type of contribution to an appointment.
|
||||||
|
*/
|
||||||
|
enum MDAppointmentContributorRole implements MDValueEnumInterface, JsonSerializable {
|
||||||
|
|
||||||
|
case organizer;
|
||||||
|
case presenter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on a string.
|
||||||
|
*
|
||||||
|
* @param string $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDAppointmentContributorRole
|
||||||
|
*/
|
||||||
|
public static function fromString(string $input):MDAppointmentContributorRole {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
"organizer" => self::organizer,
|
||||||
|
"presenter" => self::presenter,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown appointment contributor role"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on an integer.
|
||||||
|
*
|
||||||
|
* @param integer $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDAppointmentContributorRole
|
||||||
|
*/
|
||||||
|
public static function fromInt(int $input):MDAppointmentContributorRole {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
0 => self::organizer,
|
||||||
|
1 => self::presenter,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown appointment contributor role"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available names.
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
|
public static function caseNames():array {
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$cases = self::cases();
|
||||||
|
foreach ($cases as $case) {
|
||||||
|
$output[] = $case->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an unsorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "appointment_contributor_roles", "appointment_contributor_roles");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a sorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "appointment_contributor_roles", "appointment_contributor_roles");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available names.
|
||||||
|
*
|
||||||
|
* @return array<integer>
|
||||||
|
*/
|
||||||
|
public static function caseInts():array {
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$cases = self::cases();
|
||||||
|
foreach ($cases as $case) {
|
||||||
|
$output[] = $case->toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns integer representation of object record status.
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function toInt():int {
|
||||||
|
|
||||||
|
return match($this) {
|
||||||
|
self::organizer => 0,
|
||||||
|
self::presenter => 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns canonical string representation of object record status.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function toString():string {
|
||||||
|
|
||||||
|
return match($this) {
|
||||||
|
self::organizer => 'organizer',
|
||||||
|
self::presenter => 'presenter',
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the current value in translation.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTledName(MDTlLoader $tlLoader):string {
|
||||||
|
|
||||||
|
return $tlLoader->tl("appointment_contributor_roles", "appointment_contributor_roles", $this->name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the option to serialize as a string during json_encode().
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function jsonSerialize():string {
|
||||||
|
|
||||||
|
return $this->name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
<?PHP
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a type of appointment documentation image.
|
||||||
|
*/
|
||||||
|
enum MDAppointmentImageCategory implements MDValueEnumInterface, JsonSerializable {
|
||||||
|
|
||||||
|
case advertising_material;
|
||||||
|
case photo_documentation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on a string.
|
||||||
|
*
|
||||||
|
* @param string $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDAppointmentImageCategory
|
||||||
|
*/
|
||||||
|
public static function fromString(string $input):MDAppointmentImageCategory {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
'advertising_material' => self::advertising_material,
|
||||||
|
'photo_documentation' => self::photo_documentation,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown attendance status"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available names.
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
|
public static function caseNames():array {
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$cases = self::cases();
|
||||||
|
foreach ($cases as $case) {
|
||||||
|
$output[] = $case->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an unsorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "appointment_image_category", "appointment_image_category");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a sorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "appointment_image_category", "appointment_image_category");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the current value in translation.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTledName(MDTlLoader $tlLoader):string {
|
||||||
|
|
||||||
|
return $tlLoader->tl("appointment_image_category", "appointment_image_category", $this->name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the option to serialize as a string during json_encode().
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function jsonSerialize():string {
|
||||||
|
|
||||||
|
return $this->name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
<?PHP
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an allowed hoster for videos of events.
|
||||||
|
*/
|
||||||
|
enum MDAppointmentRecordingHoster implements MDValueEnumInterface, JsonSerializable {
|
||||||
|
|
||||||
|
case archive_org;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on a string.
|
||||||
|
*
|
||||||
|
* @param string $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDAppointmentRecordingHoster
|
||||||
|
*/
|
||||||
|
public static function fromString(string $input):MDAppointmentRecordingHoster {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
'archive_org' => self::archive_org,
|
||||||
|
'Archive.org' => self::archive_org,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown hoster"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function toString():string {
|
||||||
|
return match($this) {
|
||||||
|
self::archive_org => 'Archive.org',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available names.
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
|
public static function caseNames():array {
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$cases = self::cases();
|
||||||
|
foreach ($cases as $case) {
|
||||||
|
$output[] = $case->toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an unsorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "appointment_recording_hoster", "appointment_recording_hoster");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a sorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "appointment_recording_hoster", "appointment_recording_hoster");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the current value in translation.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTledName(MDTlLoader $tlLoader):string {
|
||||||
|
|
||||||
|
return $tlLoader->tl("appointment_recording_hoster", "appointment_recording_hoster", $this->toString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the option to serialize as a string during json_encode().
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function jsonSerialize():string {
|
||||||
|
|
||||||
|
return $this->toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
<?PHP
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an allowed type of recording for events / appointments.
|
||||||
|
*/
|
||||||
|
enum MDAppointmentRecordingType implements MDValueEnumInterface, JsonSerializable {
|
||||||
|
|
||||||
|
case video;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on a string.
|
||||||
|
*
|
||||||
|
* @param string $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDAppointmentRecordingType
|
||||||
|
*/
|
||||||
|
public static function fromString(string $input):MDAppointmentRecordingType {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
'video' => self::video,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown appointment recording type"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available names.
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
|
public static function caseNames():array {
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$cases = self::cases();
|
||||||
|
foreach ($cases as $case) {
|
||||||
|
$output[] = $case->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an unsorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "appointment_recording_types", "appointment_recording_types");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a sorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "appointment_recording_types", "appointment_recording_types");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the current value in translation.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTledName(MDTlLoader $tlLoader):string {
|
||||||
|
|
||||||
|
return $tlLoader->tl("appointment_recording_types", "appointment_recording_types", $this->name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the option to serialize as a string during json_encode().
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function jsonSerialize():string {
|
||||||
|
|
||||||
|
return $this->name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,4 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/**
|
|
||||||
* Represents a type of attendance status for events / appointments: offline or online.
|
|
||||||
*
|
|
||||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
|
||||||
*/
|
|
||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
<?PHP
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a sort order option in DB queries (ASC, DESC).
|
||||||
|
*/
|
||||||
|
enum MDDbQueryAscDesc implements MDValueEnumInterface, JsonSerializable {
|
||||||
|
|
||||||
|
case ASC;
|
||||||
|
case DESC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on a string.
|
||||||
|
*
|
||||||
|
* @param string $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDDbQueryAscDesc
|
||||||
|
*/
|
||||||
|
public static function fromString(string $input):MDDbQueryAscDesc {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
'asc' => self::ASC,
|
||||||
|
'ASC' => self::ASC,
|
||||||
|
'desc' => self::DESC,
|
||||||
|
'DESC' => self::DESC,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown sort order"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value of this type based on an integer.
|
||||||
|
*
|
||||||
|
* @param integer $input Input to get a value from.
|
||||||
|
*
|
||||||
|
* @return MDDbQueryAscDesc
|
||||||
|
*/
|
||||||
|
public static function fromInt(int $input):MDDbQueryAscDesc {
|
||||||
|
|
||||||
|
return match($input) {
|
||||||
|
1 => self::ASC,
|
||||||
|
2 => self::DESC,
|
||||||
|
default => throw new MDpageParameterNotFromListException("Unknown sort order"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all available names.
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
|
public static function caseNames():array {
|
||||||
|
|
||||||
|
$output = [];
|
||||||
|
|
||||||
|
$cases = self::cases();
|
||||||
|
foreach ($cases as $case) {
|
||||||
|
$output[] = $case->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an integer representation of the collective (for storage in DB).
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function toInt():int {
|
||||||
|
|
||||||
|
return match($this) {
|
||||||
|
self::ASC => 1,
|
||||||
|
self::DESC => 2,
|
||||||
|
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the SQL representation of the entity.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function toDbName():string {
|
||||||
|
|
||||||
|
return match ($this) {
|
||||||
|
self::ASC => 'ASC',
|
||||||
|
self::DESC => 'DESC',
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an unsorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "query_asc_desc", "query_asc_desc");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a sorted list of the entries in a translated version.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||||
|
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "query_asc_desc", "query_asc_desc");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the current value in translation.
|
||||||
|
*
|
||||||
|
* @param MDTlLoader $tlLoader Translation loader.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getTledName(MDTlLoader $tlLoader):string {
|
||||||
|
|
||||||
|
return $tlLoader->tl("query_asc_desc", "query_asc_desc", $this->name);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the option to serialize as a string during json_encode().
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function jsonSerialize():string {
|
||||||
|
|
||||||
|
return $this->name;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,10 +26,14 @@ enum MDGender implements MDValueEnumInterface, JsonSerializable {
|
|||||||
public static function fromString(string $input):MDGender {
|
public static function fromString(string $input):MDGender {
|
||||||
|
|
||||||
return match($input) {
|
return match($input) {
|
||||||
|
"0",
|
||||||
"" => self::none,
|
"" => self::none,
|
||||||
"none" => self::none,
|
"none" => self::none,
|
||||||
|
"1",
|
||||||
"female" => self::female,
|
"female" => self::female,
|
||||||
|
"2",
|
||||||
"male" => self::male,
|
"male" => self::male,
|
||||||
|
"3",
|
||||||
"other" => self::other,
|
"other" => self::other,
|
||||||
default => throw new MDpageParameterNotFromListException("Unknown gender"),
|
default => throw new MDpageParameterNotFromListException("Unknown gender"),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,6 +49,16 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
case length_blade;
|
case length_blade;
|
||||||
case height_blade;
|
case height_blade;
|
||||||
case width_blade;
|
case width_blade;
|
||||||
|
case length_handle;
|
||||||
|
case height_handle;
|
||||||
|
case width_handle;
|
||||||
|
case length_scabbard;
|
||||||
|
case height_scabbard;
|
||||||
|
case width_scabbard;
|
||||||
|
|
||||||
|
case length_label;
|
||||||
|
case height_label;
|
||||||
|
case width_label;
|
||||||
|
|
||||||
case number_of_sheets;
|
case number_of_sheets;
|
||||||
case number_of_double_pages;
|
case number_of_double_pages;
|
||||||
@@ -61,6 +71,22 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
case width_of_base;
|
case width_of_base;
|
||||||
case diameter_of_base;
|
case diameter_of_base;
|
||||||
|
|
||||||
|
case height_image_mount_inner;
|
||||||
|
case height_image_mount_outer;
|
||||||
|
case width_image_mount_inner;
|
||||||
|
case width_image_mount_outer;
|
||||||
|
|
||||||
|
case height_plate;
|
||||||
|
case width_plate;
|
||||||
|
|
||||||
|
case length_packaging;
|
||||||
|
case height_packaging;
|
||||||
|
case width_packaging;
|
||||||
|
|
||||||
|
case length_box;
|
||||||
|
case height_box;
|
||||||
|
case width_box;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a value of this type based on a string.
|
* Returns a value of this type based on a string.
|
||||||
*
|
*
|
||||||
@@ -104,6 +130,15 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
'length_blade' => self::length_blade,
|
'length_blade' => self::length_blade,
|
||||||
'height_blade' => self::height_blade,
|
'height_blade' => self::height_blade,
|
||||||
'width_blade' => self::width_blade,
|
'width_blade' => self::width_blade,
|
||||||
|
'length_handle' => self::length_handle,
|
||||||
|
'height_handle' => self::height_handle,
|
||||||
|
'width_handle' => self::width_handle,
|
||||||
|
'length_scabbard' => self::length_scabbard,
|
||||||
|
'height_scabbard' => self::height_scabbard,
|
||||||
|
'width_scabbard' => self::width_scabbard,
|
||||||
|
'length_label' => self::length_label,
|
||||||
|
'height_label' => self::height_label,
|
||||||
|
'width_label' => self::width_label,
|
||||||
'number_of_sheets' => self::number_of_sheets,
|
'number_of_sheets' => self::number_of_sheets,
|
||||||
'number_of_double_pages' => self::number_of_double_pages,
|
'number_of_double_pages' => self::number_of_double_pages,
|
||||||
'number_of_standalone_sheets' => self::number_of_standalone_sheets,
|
'number_of_standalone_sheets' => self::number_of_standalone_sheets,
|
||||||
@@ -113,6 +148,18 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
'height_of_base' => self::height_of_base,
|
'height_of_base' => self::height_of_base,
|
||||||
'width_of_base' => self::width_of_base,
|
'width_of_base' => self::width_of_base,
|
||||||
'diameter_of_base' => self::diameter_of_base,
|
'diameter_of_base' => self::diameter_of_base,
|
||||||
|
'height_image_mount_inner' => self::height_image_mount_inner,
|
||||||
|
'height_image_mount_outer' => self::height_image_mount_outer,
|
||||||
|
'width_image_mount_inner' => self::width_image_mount_inner,
|
||||||
|
'width_image_mount_outer' => self::width_image_mount_outer,
|
||||||
|
'height_plate' => self::height_plate,
|
||||||
|
'width_plate' => self::width_plate,
|
||||||
|
'length_packaging' => self::length_packaging,
|
||||||
|
'height_packaging' => self::height_packaging,
|
||||||
|
'width_packaging' => self::width_packaging,
|
||||||
|
'length_box' => self::length_box,
|
||||||
|
'height_box' => self::height_box,
|
||||||
|
'width_box' => self::width_box,
|
||||||
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -170,6 +217,27 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
40 => self::height_of_base,
|
40 => self::height_of_base,
|
||||||
41 => self::width_of_base,
|
41 => self::width_of_base,
|
||||||
42 => self::diameter_of_base,
|
42 => self::diameter_of_base,
|
||||||
|
43 => self::length_handle,
|
||||||
|
44 => self::height_handle,
|
||||||
|
45 => self::width_handle,
|
||||||
|
46 => self::length_scabbard,
|
||||||
|
47 => self::height_scabbard,
|
||||||
|
48 => self::width_scabbard,
|
||||||
|
49 => self::length_label,
|
||||||
|
50 => self::height_label,
|
||||||
|
51 => self::width_label,
|
||||||
|
52 => self::height_image_mount_inner,
|
||||||
|
53 => self::height_image_mount_outer,
|
||||||
|
54 => self::width_image_mount_inner,
|
||||||
|
55 => self::width_image_mount_outer,
|
||||||
|
56 => self::height_plate,
|
||||||
|
57 => self::width_plate,
|
||||||
|
58 => self::length_packaging,
|
||||||
|
59 => self::height_packaging,
|
||||||
|
60 => self::width_packaging,
|
||||||
|
61 => self::length_box,
|
||||||
|
62 => self::height_box,
|
||||||
|
63 => self::width_box,
|
||||||
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -247,6 +315,27 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::height_of_base => self::height,
|
self::height_of_base => self::height,
|
||||||
self::width_of_base => self::width,
|
self::width_of_base => self::width,
|
||||||
self::diameter_of_base => self::diameter,
|
self::diameter_of_base => self::diameter,
|
||||||
|
self::length_handle => self::length,
|
||||||
|
self::height_handle => self::height,
|
||||||
|
self::width_handle => self::width,
|
||||||
|
self::length_scabbard => self::length,
|
||||||
|
self::height_scabbard => self::height,
|
||||||
|
self::width_scabbard => self::width,
|
||||||
|
self::length_label => self::length,
|
||||||
|
self::height_label => self::height,
|
||||||
|
self::width_label => self::width,
|
||||||
|
self::height_image_mount_inner => self::height,
|
||||||
|
self::height_image_mount_outer => self::height,
|
||||||
|
self::width_image_mount_inner => self::width,
|
||||||
|
self::width_image_mount_outer => self::width,
|
||||||
|
self::height_plate => self::height,
|
||||||
|
self::width_plate => self::width,
|
||||||
|
self::length_packaging => self::length,
|
||||||
|
self::height_packaging => self::height,
|
||||||
|
self::width_packaging => self::width,
|
||||||
|
self::length_box => self::length,
|
||||||
|
self::height_box => self::height,
|
||||||
|
self::width_box => self::width,
|
||||||
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -302,6 +391,27 @@ enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::height_of_base => 40,
|
self::height_of_base => 40,
|
||||||
self::width_of_base => 41,
|
self::width_of_base => 41,
|
||||||
self::diameter_of_base => 42,
|
self::diameter_of_base => 42,
|
||||||
|
self::length_handle => 43,
|
||||||
|
self::height_handle => 44,
|
||||||
|
self::width_handle => 45,
|
||||||
|
self::length_scabbard => 46,
|
||||||
|
self::height_scabbard => 47,
|
||||||
|
self::width_scabbard => 48,
|
||||||
|
self::length_label => 49,
|
||||||
|
self::height_label => 50,
|
||||||
|
self::width_label => 51,
|
||||||
|
self::height_image_mount_inner => 52,
|
||||||
|
self::height_image_mount_outer => 53,
|
||||||
|
self::width_image_mount_inner => 54,
|
||||||
|
self::width_image_mount_outer => 55,
|
||||||
|
self::height_plate => 56,
|
||||||
|
self::width_plate => 57,
|
||||||
|
self::length_packaging => 58,
|
||||||
|
self::height_packaging => 59,
|
||||||
|
self::width_packaging => 60,
|
||||||
|
self::length_box => 61,
|
||||||
|
self::height_box => 62,
|
||||||
|
self::width_box => 63,
|
||||||
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
case allgemein; // General link to a good source
|
case allgemein; // General link to a good source
|
||||||
case aat;
|
case aat;
|
||||||
case ackerbau;
|
case ackerbau;
|
||||||
|
case avefi;
|
||||||
case bne;
|
case bne;
|
||||||
case bnf;
|
case bnf;
|
||||||
case col;
|
case col;
|
||||||
@@ -57,6 +58,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
'AAT-ID',
|
'AAT-ID',
|
||||||
'aat' => self::aat,
|
'aat' => self::aat,
|
||||||
'ackerbau' => self::ackerbau,
|
'ackerbau' => self::ackerbau,
|
||||||
|
'avefi' => self::avefi,
|
||||||
'bne' => self::bne,
|
'bne' => self::bne,
|
||||||
'bnf' => self::bnf,
|
'bnf' => self::bnf,
|
||||||
'col',
|
'col',
|
||||||
@@ -156,6 +158,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => 'allgemein', // General link to a good source
|
self::allgemein => 'allgemein', // General link to a good source
|
||||||
self::aat => 'aat',
|
self::aat => 'aat',
|
||||||
self::ackerbau => 'ackerbau',
|
self::ackerbau => 'ackerbau',
|
||||||
|
self::avefi => 'avefi',
|
||||||
self::bne => 'bne',
|
self::bne => 'bne',
|
||||||
self::bnf => 'bnf',
|
self::bnf => 'bnf',
|
||||||
self::col => 'col',
|
self::col => 'col',
|
||||||
@@ -199,6 +202,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => 'General', // General link to a good source
|
self::allgemein => 'General', // General link to a good source
|
||||||
self::aat => 'Art & Architecture Thesaurus (AAT)',
|
self::aat => 'Art & Architecture Thesaurus (AAT)',
|
||||||
self::ackerbau => 'Ackerbau-Thesaurus',
|
self::ackerbau => 'Ackerbau-Thesaurus',
|
||||||
|
self::avefi => 'AVefi',
|
||||||
self::bne => 'Biblioteca Nacional de España (BNE)',
|
self::bne => 'Biblioteca Nacional de España (BNE)',
|
||||||
self::bnf => 'Bibliothèque nationale de France (BNF)',
|
self::bnf => 'Bibliothèque nationale de France (BNF)',
|
||||||
self::col => 'Catalogue of Life',
|
self::col => 'Catalogue of Life',
|
||||||
@@ -242,6 +246,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => '',
|
self::allgemein => '',
|
||||||
self::aat => 'https://vocab.getty.edu/page/aat/',
|
self::aat => 'https://vocab.getty.edu/page/aat/',
|
||||||
self::ackerbau => 'https://term.museum-digital.de/ackerbau/tag/',
|
self::ackerbau => 'https://term.museum-digital.de/ackerbau/tag/',
|
||||||
|
self::avefi => 'https://hdl.handle.net/',
|
||||||
self::bne => 'http://datos.bne.es/persona/',
|
self::bne => 'http://datos.bne.es/persona/',
|
||||||
self::bnf => "https://catalogue.bnf.fr/ark:/12148/cb",
|
self::bnf => "https://catalogue.bnf.fr/ark:/12148/cb",
|
||||||
self::col => 'https://www.catalogueoflife.org/data/taxon/',
|
self::col => 'https://www.catalogueoflife.org/data/taxon/',
|
||||||
@@ -304,6 +309,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
self::allgemein => 'https://www.google.de/search?q=' . urlencode($searchTerm),
|
self::allgemein => 'https://www.google.de/search?q=' . urlencode($searchTerm),
|
||||||
self::aat => 'https://www.getty.edu/vow/AATServlet?english=N&find=' . urlencode($searchTerm) . '&page=1¬e=',
|
self::aat => 'https://www.getty.edu/vow/AATServlet?english=N&find=' . urlencode($searchTerm) . '&page=1¬e=',
|
||||||
self::ackerbau => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|ackerbau',
|
self::ackerbau => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|ackerbau',
|
||||||
|
self::avefi => 'https://www.av-efi.net/search?query=' . urlencode($searchTerm),
|
||||||
self::bne => 'http://datos.bne.es/persona/' . urlencode($searchTerm),
|
self::bne => 'http://datos.bne.es/persona/' . urlencode($searchTerm),
|
||||||
self::bnf => 'https://catalogue.bnf.fr/resultats-auteur.do?nomAuteur=' . urlencode($searchTerm) . '+&filtre=1&pageRech=rau',
|
self::bnf => 'https://catalogue.bnf.fr/resultats-auteur.do?nomAuteur=' . urlencode($searchTerm) . '+&filtre=1&pageRech=rau',
|
||||||
self::col => 'https://www.catalogueoflife.org/data/search?q=' . urlencode($searchTerm),
|
self::col => 'https://www.catalogueoflife.org/data/search?q=' . urlencode($searchTerm),
|
||||||
@@ -422,6 +428,28 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates an AVefi ID. AVefi IDs are not numeric.
|
||||||
|
*
|
||||||
|
* @param string $id ID to validate.
|
||||||
|
*
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
|
private static function validateAvefiId(string $id):string|false {
|
||||||
|
|
||||||
|
if (str_contains($id, 'https://www.av-efi.net/')) {
|
||||||
|
$id = str_replace('https://www.av-efi.net/res/', '', $id);
|
||||||
|
}
|
||||||
|
if (str_contains($id, 'https://hdl.handle.net/')) {
|
||||||
|
$id = str_replace('https://hdl.handle.net/', '', $id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr_count($id, '/') !== 1) return false;
|
||||||
|
|
||||||
|
return $id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a BNE ID, returning a string or false. The BNE is basically equalivalent to the
|
* Validates a BNE ID, returning a string or false. The BNE is basically equalivalent to the
|
||||||
* GND, just that the X character can be prepended to the number.
|
* GND, just that the X character can be prepended to the number.
|
||||||
@@ -746,11 +774,13 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
public static function validateBnfId(string $id):string|false {
|
public static function validateBnfId(string $id):string|false {
|
||||||
|
|
||||||
if (!is_numeric(substr($id, -1))) {
|
if (!is_numeric(substr($id, -1))) {
|
||||||
$validation = self::validateNumericId(substr($id, 0, -1), ["https://catalogue.bnf.fr/ark:/12148/cb"]);
|
$id = self::validateNumericId(substr($id, 0, -1), ["https://catalogue.bnf.fr/ark:/12148/cb"]) . substr($id, -1);
|
||||||
}
|
}
|
||||||
else $validation = self::validateNumericId($id, ["https://catalogue.bnf.fr/ark:/12148/cb"]);
|
else $id = self::validateNumericId($id, ["https://catalogue.bnf.fr/ark:/12148/cb"]);
|
||||||
|
|
||||||
if ($validation === false) return false;
|
if ($id === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $id;
|
return $id;
|
||||||
|
|
||||||
@@ -776,12 +806,13 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
'https://vocab.getty.edu/page/aat/',
|
'https://vocab.getty.edu/page/aat/',
|
||||||
]),
|
]),
|
||||||
self::ackerbau => self::validateNumericId($id, ['https://term.museum-digital.de/ackerbau/tag/']),
|
self::ackerbau => self::validateNumericId($id, ['https://term.museum-digital.de/ackerbau/tag/']),
|
||||||
|
self::avefi => self::validateAvefiId($id),
|
||||||
self::bne => self::validateBneId($id, ['http://datos.bne.es/persona/', 'https://datos.bne.es/persona/']),
|
self::bne => self::validateBneId($id, ['http://datos.bne.es/persona/', 'https://datos.bne.es/persona/']),
|
||||||
self::bnf => self::validateBnfId($id),
|
self::bnf => self::validateBnfId($id),
|
||||||
self::col => self::validateColId($id),
|
self::col => self::validateColId($id),
|
||||||
self::cona => self::validateNumericId($id, ['http://vocab.getty.edu/page/cona/', 'https://vocab.getty.edu/page/cona/']),
|
self::cona => self::validateNumericId($id, ['http://vocab.getty.edu/page/cona/', 'https://vocab.getty.edu/page/cona/']),
|
||||||
self::editionhumboldtdigital => self::validateGndId($id, ['https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/']),
|
self::editionhumboldtdigital => self::validateGndId($id, ['https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/']),
|
||||||
self::gnd => self::validateGndId($id, ['http://d-nb.info/gnd/', 'https://d-nb.info/gnd/', 'https://explore.gnd.network/gnd/']),
|
self::gnd => self::validateGndId($id, ['http://d-nb.info/gnd/', 'https://d-nb.info/gnd/', 'https://explore.gnd.network/gnd/', 'htps://d-nb.info/gnd/']),
|
||||||
self::grobsystematik => self::validateNumericId($id, ['https://term.museum-digital.de/grobsystematik/tag/']),
|
self::grobsystematik => self::validateNumericId($id, ['https://term.museum-digital.de/grobsystematik/tag/']),
|
||||||
self::iconclass => self::validateIconclassId($id),
|
self::iconclass => self::validateIconclassId($id),
|
||||||
self::klbb => self::validateNumericId($id, ['https://www.kl-bb.de/artist/', 'https://www.kl-bb.de/?page=actor&subPage=']),
|
self::klbb => self::validateNumericId($id, ['https://www.kl-bb.de/artist/', 'https://www.kl-bb.de/?page=actor&subPage=']),
|
||||||
@@ -813,6 +844,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
]),
|
]),
|
||||||
self::viaf => self::validateNumericId($id, [
|
self::viaf => self::validateNumericId($id, [
|
||||||
'https://viaf.org/viaf/',
|
'https://viaf.org/viaf/',
|
||||||
|
'https://viaf.org/de/viaf/',
|
||||||
'http://viaf.org/viaf/',
|
'http://viaf.org/viaf/',
|
||||||
]),
|
]),
|
||||||
self::wikidata => self::validateWikidataId($id),
|
self::wikidata => self::validateWikidataId($id),
|
||||||
@@ -846,7 +878,12 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
public static function getUnsortedList(MDTlLoader $tlLoader):array {
|
||||||
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "attendance_status_set", "attendance_status_set");
|
|
||||||
|
$output = [];
|
||||||
|
foreach (self::cases() as $case) {
|
||||||
|
$output[$case->name] = $case->toFullName();
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -858,7 +895,10 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
* @return array<string, string>
|
* @return array<string, string>
|
||||||
*/
|
*/
|
||||||
public static function getSortedList(MDTlLoader $tlLoader):array {
|
public static function getSortedList(MDTlLoader $tlLoader):array {
|
||||||
return MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "attendance_status_set", "attendance_status_set");
|
|
||||||
|
$out = self::getUnsortedList($tlLoader);
|
||||||
|
asort($out);
|
||||||
|
return $out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,7 +911,7 @@ enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
|
|||||||
*/
|
*/
|
||||||
public function getTledName(MDTlLoader $tlLoader):string {
|
public function getTledName(MDTlLoader $tlLoader):string {
|
||||||
|
|
||||||
return $tlLoader->tl("attendance_status_set", "attendance_status_set", $this->name);
|
return $this->toFullName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,34 @@ final class MDNodaRepositoryTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data provider for validating AVefi IDs.
|
||||||
|
*
|
||||||
|
* @return Generator<string, array{0: string|false, 1: string}>
|
||||||
|
*/
|
||||||
|
public static function avefiIdForValidationProvider():Generator {
|
||||||
|
|
||||||
|
yield "Full URL, https" => ["21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8", "https://www.av-efi.net/res/21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8"];
|
||||||
|
yield "ID" => ["21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8", "21.11155/D80067AB-B4F5-4139-8D78-540D8BC001B8"];
|
||||||
|
yield "Broken input / XX503494safdsaf;3" => [false, "XX503494safdsaf;3"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure validating references to the AVefi works.
|
||||||
|
*
|
||||||
|
* @param string|false $expected Expected output.
|
||||||
|
* @param string $inputString Input string.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
#[DataProvider('avefiIdForValidationProvider')]
|
||||||
|
public function testAvefiIdValidation(string|false $expected, string $inputString):void {
|
||||||
|
|
||||||
|
self::assertEquals($expected, MDNodaRepository::avefi->validateId($inputString));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data provider for validating BNE IDs.
|
* Data provider for validating BNE IDs.
|
||||||
*
|
*
|
||||||
@@ -77,6 +105,17 @@ final class MDNodaRepositoryTest extends TestCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data provider for validating BNE IDs.
|
||||||
|
*
|
||||||
|
* @return Generator<string, array{0: string|false, 1: string}>
|
||||||
|
*/
|
||||||
|
public static function bnfIdForValidationProvider():Generator {
|
||||||
|
|
||||||
|
yield "Broken input / duplicate https" => [false, "https://catalogue.bnf.fr/ark:/12148/cbhttps://catalogue.bnf.fr/ark:/12148/cbhttps://catalogue.bnf.fr/ark:/12148/cb104183522"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data provider for validating GND IDs.
|
* Data provider for validating GND IDs.
|
||||||
*
|
*
|
||||||
@@ -257,6 +296,7 @@ final class MDNodaRepositoryTest extends TestCase {
|
|||||||
public static function viafIdForValidationProvider():Generator {
|
public static function viafIdForValidationProvider():Generator {
|
||||||
|
|
||||||
yield "Full URL, http / 248941990" => ["248941990", "http://viaf.org/viaf/248941990"];
|
yield "Full URL, http / 248941990" => ["248941990", "http://viaf.org/viaf/248941990"];
|
||||||
|
yield "Full URL, https, de / 34470968" => ["34470968", "https://viaf.org/de/viaf/34470968"];
|
||||||
yield "Full URL, https / 248941990" => ["248941990", "https://viaf.org/viaf/248941990"];
|
yield "Full URL, https / 248941990" => ["248941990", "https://viaf.org/viaf/248941990"];
|
||||||
yield "Full URL, https / 42893419" => ["42893419", "https://viaf.org/viaf/42893419"];
|
yield "Full URL, https / 42893419" => ["42893419", "https://viaf.org/viaf/42893419"];
|
||||||
yield "Full URL, https / 86145857811423020454" => ["86145857811423020454", "https://viaf.org/viaf/86145857811423020454"];
|
yield "Full URL, https / 86145857811423020454" => ["86145857811423020454", "https://viaf.org/viaf/86145857811423020454"];
|
||||||
|
|||||||
Reference in New Issue
Block a user