Compare commits

...

268 Commits

Author SHA1 Message Date
29cfcfccb3 Update translation files, add Telugu translation 2025-06-30 18:27:05 +02:00
ddfdf97e5b Fix typo in comment 2025-06-26 01:34:26 +02:00
61487fb8e6 Update translation files 2025-06-18 17:49:26 +02:00
81ab95c047 Add own-language names of some Asian languages 2025-06-13 17:35:00 +02:00
86f6a6c26d Update translation files 2025-05-08 16:52:12 +02:00
da950073e9 Add https:// variant for iconclass 2025-05-08 16:17:43 +02:00
29879ac02f Add new event types
- Production of material
- Mentioned place
- Mentioned time
- Received ownership
- Transfered ownershi
2025-05-05 22:56:07 +02:00
5ec93ba619 Add enums for loan types, exhiibition contributor roles 2025-04-04 17:20:16 +02:00
1403f75447 Add new measurement type for diameter of frame 2025-03-19 15:20:46 +01:00
04c378675c Add new measurement types for min / max length, width, etc.
Close #35
2025-03-19 15:03:29 +01:00
60483d897b Disallow setting anything but actors for mentioned events in MDEventsSet 2025-03-14 18:24:59 +01:00
a0348b135a Update MDNodaRepository 2025-03-12 02:44:20 +01:00
45d7c3d455 Map http://d-nb.info/ to the GND 2025-03-11 17:43:43 +01:00
22a30fd52b Update translation files 2025-03-03 17:46:29 +01:00
2e9d0aeff3 Update translation files 2025-02-20 16:07:23 +01:00
9fb9e45893 Add language: Crimean Tatar 2025-02-18 17:43:27 +01:00
4d16367266 Update translation files 2025-02-14 18:16:32 +01:00
1b922ce973 Update translation files 2025-02-14 17:36:48 +01:00
b01fb98108 Merge branch 'master' of gitea:museum-digital/MDAllowedValueSets 2025-02-14 10:33:08 +01:00
12689d24fa Add bootstrapping for tests, parse additional wikidata ID format 2025-02-14 10:32:25 +01:00
7f22538085 Add Kannada spelling for Kannada for language selection 2025-02-13 13:17:27 +01:00
9d139f9154 Update translation files 2025-02-13 00:23:22 +01:00
fb92b6b84c Update translation files 2025-02-12 19:47:41 +01:00
426e6b11ac Update translation files 2025-02-03 17:41:04 +01:00
eec67dd866 Update translation files 2025-01-31 23:23:00 +01:00
61edc14240 Update years covered in license 2025-01-22 15:18:55 +01:00
dbd15ea26b Update translation files 2025-01-22 15:07:18 +01:00
1b34e49ff8 Add number of sheets as a unit for number of parts 2025-01-14 11:12:40 +01:00
709a5d5cc3 Update translation files 2025-01-12 21:49:09 +01:00
f1d0435eef Add new, more specific measurement types 2024-12-18 17:00:13 +01:00
abb41ed32c Update translation files 2024-12-10 22:06:24 +01:00
3c2d1ca856 Update translation files 2024-12-09 23:19:01 +01:00
d0b325e73e Add marking type "drawn", more specific marking positions mainly on rear side 2024-12-09 14:57:45 +01:00
8c73338758 Update translation files 2024-12-01 22:28:09 +01:00
f938c66ab6 Prevent using general URL field in MDNodaRepository::fromUrl() 2024-11-28 09:28:43 +01:00
7fc57353a8 Extend MDMeasurement with surrounding enums to cover measurements of
objects
2024-11-21 21:46:24 +01:00
fa8bc6dac0 Extend list of languages by nds / Niederdeutsch 2024-11-15 17:21:27 +01:00
f8a8fd901c Add language Plattdeutsch 2024-11-14 17:52:57 +01:00
5142a57cfe Add enum for controlling source types 2024-11-06 16:19:58 +01:00
71e05e7eab Update translation files 2024-10-21 01:24:17 +02:00
333340da3e Improve validation of ORCID IDs 2024-10-03 16:36:01 +02:00
d22db5bd95 Add enum to control levels of redaction in controlled vocabularies 2024-09-27 17:08:08 +02:00
f19973d20e Remove noda repository MBL, add list of full names to the vocabs for
improved frontend display

Close #33
2024-09-25 14:33:45 +02:00
dc1c72aeda Use /entity/ links for referencing Wikidata over /wiki/; allow linking
from GND explorer

Close #32
2024-09-12 17:06:30 +02:00
bdb9bb16f5 Allow wikidata IDs exceeding the size of INT32 2024-08-10 17:05:44 +02:00
7826b7d891 Fix missing parameter being passed on 2024-07-30 00:53:30 +02:00
be2da00759 Use ->toString() over ->name in json serialization of MDGender,
MDLicense

This is important for backwards compatibility
2024-07-30 00:51:04 +02:00
47763d1998 Fix error messages 2024-07-29 17:50:36 +02:00
99e0f9b655 Implement enums for genders and licenses
See #31, see #30
2024-07-29 13:59:17 +02:00
32a1e8b1be Remove noda repository wikipedia, use GND Explorer for lookups/searches
in external norm data repository GND

Close #28, close #29
2024-07-19 00:59:37 +02:00
db46255f87 Add contributor role "movement trainer" 2024-07-08 16:42:32 +02:00
c560a5581f Extend list of series contributor roles 2024-06-19 23:02:17 +02:00
d3ff111750 Add basic institution category: univ. collection 2024-06-17 15:44:29 +02:00
e55e4c210a Add enums for roles of places and times linked to series 2024-06-12 00:12:12 +02:00
25e5e954b4 Set explicit visibility on class constants 2024-06-11 22:15:59 +02:00
8c8ead0a02 Update translation files 2024-06-02 00:58:42 +02:00
3ecbb1f774 Update translation files 2024-05-24 19:38:15 +02:00
c907c1b085 Add function for loading collection areas from array 2024-05-23 00:35:57 +02:00
69c2c7cbf9 Update translation files 2024-05-22 21:41:54 +02:00
9ddb461491 Extend MDRequirementsSet with max file size allowed for PDFs 2024-05-17 10:29:17 +02:00
9c80957709 Add object/marking position "inside"
Close #16
2024-05-11 03:55:50 +02:00
d68c114905 Add new enums for object document type, institution categorization
Close #24, close #25, close #26, close #27
2024-05-10 16:22:50 +02:00
493ef9f721 Add function MDSeriesContributorRole::fromInt() 2024-05-08 00:58:48 +02:00
6772476f9b Add new enum for covering series contribution types for actors 2024-05-07 18:31:50 +02:00
4c1916247b Update translation files 2024-05-07 18:31:19 +02:00
c63692fb6c Update translation files 2024-05-03 11:12:12 +02:00
ed7feb8963 Add new space type: outdoor area 2024-04-23 13:58:50 +02:00
11f36fa202 Update translation files 2024-04-18 14:45:13 +02:00
3717bc9da2 Add start and default dates for times in MDRequirementsSet 2024-04-17 11:30:54 +02:00
8d126d112d Update translation files 2024-03-26 15:53:05 +01:00
22f5efddd5 Update translation files 2024-03-25 19:40:24 +01:00
2259012d42 Add new event types: subject of & emerged
Close #22, close #23
2024-03-25 16:29:20 +01:00
0aef8c3116 Map VIAF (capital letters) to MDNodaRepository::viaf 2024-02-28 13:02:32 +01:00
9c65921f5c Update translation files 2024-01-29 21:17:54 +01:00
497807267b Update translation files 2024-01-18 01:51:10 +01:00
6c8ca3ac8e Rename object record status "deleted" to "archived" 2024-01-14 03:19:08 +01:00
ad237490a3 Update translation files 2024-01-12 19:12:01 +01:00
10b9c58a1b Add MDObjectRecordStatus to track record status 2024-01-12 18:52:21 +01:00
65bbd03e2e Update translation files 2024-01-05 18:51:03 +01:00
c371d1d821 Update translation files 2023-12-30 22:39:30 +01:00
91ccbd6683 Disallow PNGs for exhibition and appointment images 2023-12-23 00:12:15 +01:00
22e9ce56a3 Add new currency ua-UAK / Ukrainian karbovanets 2023-12-04 01:24:15 +01:00
7912066f71 Remove trailing slashes from vocabulary links delivered as URLs 2023-12-01 16:45:49 +01:00
dcfba67422 Allow different sub-vocabs of NDP-IKMK for places 2023-11-30 22:29:25 +01:00
c43cc7e42a Allow Wikipedia links from the Chinese Wikipedia 2023-11-26 23:53:50 +01:00
71d34b37ca Also allow Ukrainian Wikipedia 2023-11-14 04:28:20 +01:00
8e0be0f80c Improve identification of lcsh links marked as loc links 2023-11-10 03:10:00 +01:00
be2f42677b Add new check type: Check of object's location 2023-11-02 00:49:13 +01:00
1108398437 Add functions for listing event actor names, time names, place names 2023-10-29 01:27:32 +02:00
1dedb86d5b Fix another invalid output value in MDMeasurementType 2023-10-19 17:20:38 +02:00
06b2d13c6f Fix expected return class 2023-10-19 17:10:21 +02:00
d2dd24baee Extend list of repository names accepted for referring to the different
MDNodaRepository cases
2023-10-19 16:11:37 +02:00
7c7fb58a0d Add MDMeasurementType for listing available measurement types 2023-10-19 03:27:07 +02:00
f14d7edc6e Add tests to ensure invalid IDs are not validated 2023-10-18 22:42:49 +02:00
8f32c30fbd Handle large numbers in GND IDs 2023-10-18 22:35:31 +02:00
c57d180aa1 Remove superfluous throw new exception 2023-10-18 02:06:06 +02:00
d9f3f875e0 Write prettier exception messages 2023-10-16 22:39:46 +02:00
1d1a690e0f Remove whitespaces from vocabulary links, add dedicated exception for
lcsh links that are actually loc links
2023-10-16 16:44:33 +02:00
da6e40282d Improve comments in MDEventsSet 2023-10-15 18:31:52 +02:00
68f453f5f3 Throw dedicated exceptions in MDNodaRepository 2023-10-15 18:30:18 +02:00
d6e3c3208b Make MDInvalidNodaLinkLocIdIsSh a final class 2023-10-15 16:14:21 +02:00
fe73fc7267 Add exceptions special to this repo 2023-10-15 16:13:53 +02:00
ea5a186e8f Explicitly make constants of MDEventsSet public 2023-10-15 13:29:12 +02:00
3fb3ee4edd Map d-nb.de/info to GND 2023-10-15 03:07:59 +02:00
446dd78bec Map WIKIDATA to MDNodaRepository::wikidata 2023-10-13 17:21:02 +02:00
4e3877a4fb Extend list of mapped noda repository names 2023-10-13 17:16:14 +02:00
887f06f70e Add new damage type: desiccation 2023-10-12 22:54:01 +02:00
d295e16049 Better validate Wikipedia links 2023-09-26 01:30:40 +02:00
609931eb26 Add kl-bb as possible controlled vocabulary for actors 2023-09-25 00:05:27 +02:00
2f765e183e Add MDCopyrightCollective to represent those 2023-09-12 01:13:54 +02:00
0f64939def Properly validate PIM IDs
Close #20
2023-09-01 12:30:47 +02:00
f79afa4ed7 Add function MDNodaLink->getEntityLink (wrapper around
mdnodarepository->getEntityLink)
2023-08-29 17:24:11 +02:00
9bca8f400e Add lowercase ndb/adb to list of readable noda repository names 2023-08-09 16:31:03 +02:00
7fb7bb83c1 Improve validation of noda repository links 2023-08-03 17:20:03 +02:00
c082ca685f Fix indentation 2023-07-31 19:42:21 +02:00
651362c65e Use correct function call for validating BNE IDs 2023-07-27 19:41:39 +02:00
9e44fcac49 Allow BNE IDs starting with XX 2023-07-27 19:24:16 +02:00
f5673c69fd Allow https links to the library of congress subject headings 2023-07-27 01:43:54 +02:00
0e86361968 Fix overly strict validation for npg, ndl 2023-07-25 22:33:57 +02:00
17f1e162f8 Add double quotes around invalid ID in error message given in
MDNodaLink
2023-07-25 22:31:18 +02:00
8090b95f49 Categorize event types 27, 28 (recorded, sung) 2023-07-24 14:30:06 +02:00
8e81d31466 Categorize event type 33 / "was mentioned" 2023-07-19 19:06:26 +02:00
f73c729dff Allow for non-numeric nomisma IDs 2023-07-19 15:59:13 +02:00
d47490f217 Categorize event type "first description" 2023-07-19 10:20:24 +02:00
8684933c9c Add function getUrlPrefix() to MDNodaRepository 2023-07-17 02:16:32 +02:00
06cc1d4c10 Split linkable noda repositories for IKMK / NDP for actors and places 2023-07-16 11:45:05 +02:00
1de413b3fb Update LICENSE date 2023-06-24 00:22:46 +02:00
b55ea34950 Update translation files 2023-06-01 16:50:57 +02:00
628acd4b53 Update translation files 2023-05-15 14:15:57 +02:00
f9366b686e Add tag relation type display_subject 2023-05-10 12:06:15 +02:00
c3d4f3f03a Fix type issues in PHPDoc comments 2023-05-07 23:37:57 +02:00
a437f1b57b Add MDTagRelationType 2023-05-07 23:24:00 +02:00
077eaeb3e3 Update translation files 2023-05-04 20:11:51 +02:00
9b6534de4e Update marking type sets, adding type "painted" 2023-04-25 16:29:14 +02:00
0698b6e487 Merge branch 'master' of gitea:museum-digital/MDAllowedValueSets 2023-04-16 19:42:27 +02:00
8e151e793f Closer approximate a fix for the validation of GND IDs 2023-04-16 19:41:55 +02:00
10aedafad1 Parse "GND" to MDNodaRepository::gnd 2023-04-16 03:23:23 +02:00
fbc50d8198 Finish writing list of search URLs for noda repositores 2023-04-16 02:56:48 +02:00
82a8805363 Fix bug in MDNodaRepository's fromString and toDbName 2023-04-16 02:45:56 +02:00
25f6694a92 Add enum MDNodaRepository and class MDNodaLink for the overarching data
structure
2023-04-16 02:06:11 +02:00
d090d82dc2 Add minimal phpstan config 2023-04-16 02:05:59 +02:00
47ee414559 Allow webp image uploads 2023-04-14 13:40:17 +02:00
617fee2604 Update translation files 2023-04-11 12:34:11 +02:00
e0e1d649be Remove superfluous parameter comment 2023-04-09 17:41:27 +02:00
33cc6fc1b3 Fix PHP validation pattern for Hungarian Statistical Office 2023-04-09 13:22:48 +02:00
06a39eb147 Add enum for categorizing external repos 2023-04-09 01:37:39 +02:00
5c77d57b74 Update translation files 2023-03-26 00:21:16 +01:00
ccb8bae102 Add new currency: Swiss franc 2023-03-23 13:54:04 +01:00
9986380f47 Update translation files 2023-03-15 16:07:00 +01:00
e97aac918e Disable superfluous match cases 2023-02-28 21:45:06 +01:00
ff263705b2 Add new title types: professional jargon and sociolect 2023-02-27 19:13:06 +01:00
39f5aab33d Update translation files 2023-02-19 19:00:53 +01:00
eab910b704 Add enum MDUserAccountAction enumerating actions that accounts may be
put under externally
2023-02-13 17:36:10 +01:00
49f78e24b4 Update translation files 2023-02-10 01:00:06 +01:00
1954d3e391 Update translation files 2023-02-02 21:18:08 +01:00
99cf6bf552 Add enum MDTransportMethod 2023-01-31 18:43:02 +01:00
63895258ad Add functions for getting JSON-LD representations of
MDAppointmentCancellationStatus and MDAttendanceStatus
2023-01-25 00:16:31 +01:00
aa16c859c8 Update translation files 2023-01-23 22:43:16 +01:00
d7373eb39a Update translation files 2023-01-22 16:10:45 +01:00
7d952366de Fix file comments 2023-01-12 22:49:26 +01:00
978ed93c56 Update translation files 2023-01-11 05:52:52 +01:00
23a5ff677e Fix typo in class name 2023-01-03 01:36:21 +01:00
be01725a6f Add MDTimingInterval for controlling intervals at which (for now)
autogenerated reports can be timed in musdb
2023-01-03 01:33:16 +01:00
663edea4db Add custom report targets exhibitions and loans 2022-12-31 02:03:29 +01:00
dc977c0ff6 Fix function return comment 2022-12-30 15:24:56 +01:00
59e85ac02c Fix return types 2022-12-30 05:11:41 +01:00
91a3ee9c6b CustomReportFormat does not implement MDValueEnumInterface 2022-12-30 00:05:05 +01:00
830bbd1103 Add enums for handling custom reports in musdb 2022-12-29 23:16:27 +01:00
0f1458e7d4 Add enums for appointments' attendence status and cancellation status 2022-12-26 00:52:22 +01:00
15e983411b Fix invalid return type in MDObjectDamageStatus 2022-12-21 19:29:50 +01:00
4ac43ec62b Add enums for object damage status and type 2022-12-21 18:45:13 +01:00
fb0146cde6 Add enum for object check types
See museum-digital/musdb#724
2022-12-17 22:48:59 +01:00
a79b239b27 Add MDDisposalMethodSet for ways to dispose of objects 2022-12-17 00:12:53 +01:00
decbe56787 Update translation files 2022-12-16 23:20:58 +01:00
737824e83f Fix broken reference to class constant in MDColorsSet 2022-12-16 22:45:35 +01:00
be67089b74 Add translations for color set; options for getting unsorted color,
gender lists
2022-12-14 16:11:49 +01:00
a19f18a193 Add sets for gender and object form 2022-12-14 01:22:19 +01:00
abf69a00af Add third party ownership as an option for object status 2022-11-29 18:22:19 +01:00
f6257838b4 Use own name for languages rather than English one
For now this only comes for languages in which a translation of musdb
exists.
2022-11-17 18:32:07 +01:00
b2a5e4caa3 Update translation files 2022-11-17 18:17:31 +01:00
824a86d715 Update translation files 2022-11-08 22:21:44 +01:00
c7795fdc56 Update currencies set with Rubles and Hrywnja 2022-10-31 21:27:23 +01:00
dfd3b5b346 Add currency GBP 2022-10-31 15:44:27 +01:00
b45bf0e197 Add process type discussion 2022-10-28 00:27:15 +02:00
fd6843dd20 Update translation files 2022-10-27 17:54:34 +02:00
b788cf3d72 Add currency french franc
See museum-digital/musdb#609
2022-10-24 16:36:09 +02:00
c80ecfe752 Deprecate MDDataHistorySubjectsSet 2022-10-22 16:16:30 +02:00
b9955203eb Add more precise return param comments 2022-10-22 03:25:09 +02:00
f9444e288f Update translation files 2022-10-21 04:53:38 +02:00
a24c57395f Add controlled list of todo status 2022-10-20 15:12:55 +02:00
b4611a6e22 Add function to check if a process type has a dedicated data type
representing it
2022-10-16 16:41:55 +02:00
b6dcffdea4 Make MDProcessType JSON serializable 2022-10-16 01:13:33 +02:00
42a02c186a Add enum for process types in the museum 2022-10-15 23:21:23 +02:00
cc1a23c2fd Add new controlled list for types of processes happening in a museum 2022-10-15 15:13:26 +02:00
e3d7f056b7 Update translation files 2022-10-13 22:52:32 +02:00
982db371c1 Add new event types donated + inherited for provenance information 2022-10-13 22:48:16 +02:00
023d5d0ba9 Fix constant names for object status 2022-10-09 23:52:56 +02:00
8256231b9c Add controlled lists for loan types and object (ownership) status 2022-10-09 22:02:43 +02:00
a75954ffae Update git submodules 2022-10-05 21:48:31 +02:00
536422049b Update translation files 2022-10-05 15:46:27 +02:00
b058adb58e Add dashboard sections for possible musdb app token usages 2022-09-28 02:16:07 +02:00
8f75641150 Fix broken reference 2022-09-27 01:50:49 +02:00
8a04c9d3e0 Add MDSpaceTypesSet and MDSpaceAccessStatusSet 2022-09-27 01:10:11 +02:00
4e4211cc02 Allow setting musdb access tokens for logging to spaces 2022-09-26 14:34:48 +02:00
0660d3225f Update translation variables 2022-09-07 16:42:21 +02:00
1c1c4a8b1e Allow uploading PNG files for object images (the PNGs shall be converted
to JPG)
2022-09-02 21:19:22 +02:00
f65ec3fe14 Explicitly list inch and feet as available length units 2022-09-02 01:03:41 +02:00
78e4edab74 Add inch and feet as allowed units 2022-09-02 01:01:16 +02:00
a86a37e888 Translate most variables to Russian 2022-08-23 17:25:44 +02:00
015f53e4ff Update translation files 2022-08-07 00:12:09 +02:00
4ad756e19d Add enum MDAppTokenSection 2022-07-24 01:23:41 +02:00
d0cf8d26b3 Update repo path of SMB digital / recherche SMB 2022-06-24 14:32:26 +02:00
adec263e5c Move syndicated copies to SMB digital to recherche / SMB 2022-06-24 11:06:33 +02:00
3f3be7dae2 Update translation files 2022-05-28 22:31:58 +02:00
b0f5756d33 Add Austro-Hungarian crowns as a currency 2022-05-15 03:16:09 +02:00
70dea64c3c Add magenta.de to list of blocked mail domains 2022-03-12 17:58:20 +01:00
987ebc99ed Update translation files 2022-03-10 16:12:22 +01:00
f64d34d577 Update hungarian translation files 2022-03-09 22:52:27 +01:00
249d42339d Add new marking type "cast", e.g. for iron casting 2022-02-18 15:21:27 +01:00
d9c03d78cd Add marking type "scarified" 2022-02-18 14:51:16 +01:00
f6c5808817 Add marking types "punched" and "hallmarked" 2022-02-18 13:55:48 +01:00
3387c5a292 Add new marking type "nailed" 2022-02-18 13:35:42 +01:00
793a8e08ad Add marking type riveted 2022-02-18 03:17:51 +01:00
01435df405 Add marking type "burnt in" 2022-02-18 03:00:48 +01:00
d061814751 Add marking type "screwed" (on) 2022-02-18 02:51:17 +01:00
e3c77bb556 Add marking type "sewn" 2022-02-18 02:31:24 +01:00
ae49dc2aa4 Add marking type "embroidered" 2022-02-18 02:11:06 +01:00
eefba3ddc2 Fix reference to wrong constant name 2022-02-15 01:23:05 +01:00
e1681976c4 Add translation files for new value sets 2022-02-13 19:43:35 +01:00
af10f52738 Add value sets for event / appointment status, attendance mode, and appointment and
exhibition contributor roles
2022-02-13 18:40:44 +01:00
91bf28ae96 Add source types unpublished and patent 2022-02-09 02:13:10 +01:00
0ff654b3f9 Add MDBlockedMailserverSet for blocking mail servers 2022-01-24 23:14:32 +01:00
dacebedd48 Add unified minimum and max year in MDRequirementsSet 2022-01-07 16:01:00 +01:00
783fe29fc9 Add list of allowed file types in a ZIP for 3D objects 2022-01-04 02:56:32 +01:00
16f0621a9a Use gramms and millimeters as base weight and length units 2021-12-20 02:25:17 +01:00
262972eb54 Add conversion funcs for length (to micrometer), weights (to milligramm) 2021-12-20 01:23:26 +01:00
9801f1a35f Add MDNodaRepositoriesSet to gather linkable noda repositories for tags,
places, actors
2021-12-11 01:07:56 +01:00
276420017d Add some more Hungarian translations 2021-10-22 17:18:02 +02:00
1ac18b9d4c Add list of available licenses without their links 2021-10-21 15:38:00 +02:00
08385bef21 Add a list of all allowed language codes 2021-10-21 14:08:56 +02:00
3e58dce1e3 Add allowed value set for closer location (e.g. for archeological
objects)
2021-10-21 01:38:17 +02:00
ee24739002 Add missing newlines between constants in MDEventsSet and
MDRequirementsSet
2021-10-11 15:11:15 +02:00
ca5be31efb Add generic other name variants to list of accepted name variant types 2021-10-10 14:08:06 +02:00
7718cd3aa2 Update translation files 2021-10-09 17:08:38 +02:00
fecf25d72c Add translation option to MDResearchStatusSet 2021-10-09 15:05:45 +02:00
35b713f1c9 Add controlled list of research status (for now for actors) 2021-10-09 14:07:35 +02:00
4daf580355 Add controlled list of conservation status 2021-10-07 16:08:31 +02:00
c3dfdbb5ac Add civil name as a name variant type
Close #6
2021-10-06 13:05:28 +02:00
913fcbbaea Add artist name as an actor variant type 2021-09-24 17:45:12 +02:00
7f6c723095 Add actor name variant type "nickname" 2021-09-24 10:49:01 +02:00
db240f9d3d Add MDActorVariantTypesSet for controlling variant types for actor names 2021-08-19 00:44:15 +02:00
ce35fd35cd Add new constant MDRequirementsSet::MAX_AGE_AFTER_USER_INVITE to
streamline max age of unvalidated accounts before automatic deletion
2021-07-27 16:37:46 +02:00
1b1d2cb6eb Add kalliope to MDObjectSyndicationSet 2021-07-25 10:30:05 +02:00
a2753781f9 Add SMB-digital to MDObjectSyndicationSet 2021-07-23 16:02:34 +02:00
c06729f477 Add expected mime types for different types of contents in
MDRequirementsSet
2021-07-20 03:33:30 +02:00
d5bc140889 Add MDRequirementsSet to list commonly used requirements 2021-07-20 00:12:34 +02:00
1905450776 Fix typing bug 2021-07-15 17:13:08 +02:00
3ea3a9f2c0 Fix bug in and add validity check in MDObjectSyndicationSet 2021-07-15 16:56:54 +02:00
c4ac0f0fb4 Add class MDObjectSyndicationSet to list other repositories for museum
objects
2021-07-15 14:27:23 +02:00
e208308c8d Add marking type "glued" 2021-07-12 15:34:59 +02:00
0f6a49c2f9 License code under MIT
Close #4
2021-04-09 13:25:00 +02:00
e331d8fd2c Add array for ISO639-2b language codes 2021-04-05 23:25:27 +02:00
fa593c4be1 Add controlled list of data history subjects
Close #3
2021-03-25 13:51:35 +01:00
208d39cc30 Add constant for default phone type (work) 2021-03-13 02:01:39 +01:00
401d557b66 Add controlled, translatable list of phone types 2021-03-13 01:18:54 +01:00
55ad6530dd Add controlled list of colors for categorizing images 2021-03-12 22:25:03 +01:00
77ae0327c1 Add controlled lists of recording types and external hosting options 2021-03-12 20:35:49 +01:00
1abb36691f Add variables for default metadata and image license 2021-03-10 23:45:17 +01:00
96 changed files with 8556 additions and 65 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-2025 museum-digital
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -8,3 +8,11 @@ museum-digital.
- Licenses
- Languages
## Enums
As of PHP 8.1, PHP now supports enums. A new folder has been added in /src/enums to gather those types of new entries, that can be better expressed using enums at no direct loss (mainly in listing translated options).
## License
This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for the full license text.

View File

@ -0,0 +1,18 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case a controlled vocabulary is to be linked using an invalid ID.
*/
class MDInvalidNodaLinkException extends MDgenericInvalidInputsException {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
return 'Inputs are not valid.';
}
}

View File

@ -0,0 +1,20 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case a library of congress subject headings link refers
* to the other authority files of the Library of Congress.
*/
final class MDInvalidNodaLinkLcshIdIsGeneralLoc extends MDInvalidNodaLinkException {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
return 'Inputs are not valid.';
}
}

View File

@ -0,0 +1,21 @@
<?PHP
declare(strict_types = 1);
/**
* Exception thrown in case a library of congress link refers to the subject
* headings (subject headings are a dedicated, full vocabulary according to
* md's definition).
*/
final class MDInvalidNodaLinkLocIdIsSh extends MDInvalidNodaLinkException {
/**
* Error message.
*
* @return string
*/
public function errorMessage() {
//error message
return 'Inputs are not valid.';
}
}

2
l18n

Submodule l18n updated: 2c74a458f3...b032391f23

8
phpstan.neon Normal file
View File

@ -0,0 +1,8 @@
parameters:
level: 8
paths:
- src
scanDirectories:
- ../MDTlLoader
- ../MDErrorReporter
- ../MD_STD

14
phpunit.xml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd" backupGlobals="false" beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="true" bootstrap="tests/bootstrap.php" cacheResult="false" colors="true" enforceTimeLimit="true" failOnWarning="true" processIsolation="true" stopOnError="true" stopOnFailure="true" stopOnIncomplete="true" stopOnSkipped="true" stopOnRisky="true" testdox="false" timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60" cacheDirectory=".phpunit.cache" backupStaticProperties="false" requireCoverageMetadata="false" beStrictAboutCoverageMetadata="false">
<testsuites>
<testsuite name="tests">
<directory>tests/</directory>
</testsuite>
</testsuites>
<coverage/>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>

View File

@ -0,0 +1,40 @@
<?PHP
/**
* Class containing available types for actor name variants. E.g. birth names,
* married names, etc.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available types for actor name variants. E.g. birth names,
* married names, etc.
*/
final class MDActorVariantTypesSet extends MDValueSet {
public const ACTOR_VARIANT_TYPES = [
'',
'birth_name',
'civil_name',
'married_name',
'monastic_name',
'pseudonym',
'regnal_name',
'nickname',
'artist_name',
'generic_other_name',
];
/**
* Returns a translated list of name variants.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getActorVariantTypesTLed(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::ACTOR_VARIANT_TYPES, "actor_variant_types_set", "actor_variant_types_set");
}
}

View File

@ -0,0 +1,38 @@
<?PHP
/**
* Contains a class for controlling the list of available attendance modes
* to appointment / event.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available attendance modes.
*/
final class MDAppointmentAttendanceModeSet extends MDValueSet {
public const MODES = [
'offline',
'online',
'mixed',
];
public const MODES_TO_SCHEMA_ORG = [
'offline' => 'https://schema.org/OfflineEventAttendanceMode',
'online' => 'https://schema.org/OnlineEventAttendanceMode',
'mixed' => 'https://schema.org/MixedEventAttendanceMode',
];
/**
* Gets a 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, self::MODES, "appointment_attendance_modes", "appointment_attendance_modes");
}
}

View File

@ -0,0 +1,31 @@
<?PHP
/**
* Contains a class for controlling the list of available contributor types
* to appointment / event.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available contributor roles.
*/
final class MDAppointmentContributorsSet extends MDValueSet {
public const AVAILABLE_ROLES = [
'organizer',
'presenter',
];
/**
* Gets a 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, self::AVAILABLE_ROLES, "appointment_contributor_roles", "appointment_contributor_roles");
}
}

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDAppointmentRecordingSet extends MDValueSet {
const AVAILABLE_RECORDING_TYPES = ['video'];
const EXTERNAL_SOURCES = ['Archive.org' => 'https://archive.org/details/'];
public const AVAILABLE_RECORDING_TYPES = ['video'];
public const EXTERNAL_SOURCES = ['Archive.org' => 'https://archive.org/details/'];
}

View File

@ -0,0 +1,39 @@
<?PHP
/**
* Contains a class for controlling the list of available statuses to appointment / event.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available status.
*/
final class MDAppointmentStatusSet extends MDValueSet {
public const STATUS = [
'scheduled',
'cancelled',
'moved_online',
'postponed',
];
public const STATUS_TO_SCHEMA_ORG = [
'scheduled' => 'https://schema.org/EventScheduled',
'cancelled' => 'https://schema.org/EventCancelled',
'moved_online' => 'https://schema.org/EventMovedOnline',
'postponed' => 'https://schema.org/EventPostponed',
];
/**
* Gets a 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, self::STATUS, "appointment_status", "appointment_status");
}
}

View File

@ -0,0 +1,21 @@
<?PHP
/**
* Contains a class listing blocked mailservers. Mail servers may e.g. be blocked
* for not accepting mails from @museum-digital.de.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a class listing blocked mailservers. Mail servers may e.g. be blocked
* for not accepting mails from @museum-digital.de.
*/
final class MDBlockedMailserverSet extends MDValueSet {
public const BLOCKED_DOMAINS = [
"@magenta.de",
"@t-online.de",
];
}

View File

@ -0,0 +1,32 @@
<?PHP
/**
* Contains a class of available types of closer locations.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available types of closer locations.
*/
final class MDCloserLocationTypesSet extends MDValueSet {
public const CLOSER_LOCATION_TYPES = [
"0", // ''
"1", // Place of recording
"2", // Place of finding
"3", // Previous place
];
/**
* Gets a 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, self::CLOSER_LOCATION_TYPES, "closer_location_types_set", "closer_location_types_set");
}
}

95
src/MDColorsSet.php Normal file
View File

@ -0,0 +1,95 @@
<?PHP
/**
* Contains a class for controlling the list of base colors.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available colors.
*/
final class MDColorsSet extends MDValueSet {
public const COLOR_NAMES = [
"black",
"green",
"silver",
"lime",
"gray",
"olive",
"white",
"yellow",
"maroon",
"navy",
"red",
"blue",
"purple",
"teal",
"fuchsia",
"aqua",
];
public const COLOR_NAMES_AND_EMPTY = [
'',
"black",
"green",
"silver",
"lime",
"gray",
"olive",
"white",
"yellow",
"maroon",
"navy",
"red",
"blue",
"purple",
"teal",
"fuchsia",
"aqua",
];
public const COLORS_RGB = [
"black" => [0, 0, 0],
"green" => [0, 128, 0],
"silver" => [192, 192, 192],
"lime" => [0, 255, 0],
"gray" => [128, 0, 128],
"olive" => [128, 128, 0],
"white" => [255, 255, 255],
"yellow" => [255, 255, 0],
"maroon" => [128, 0, 0],
"navy" => [0, 0, 128],
"red" => [255, 0, 0],
"blue" => [0, 0, 255],
"purple" => [128, 0, 128],
"teal" => [0, 128, 128],
"fuchsia" => [255, 0, 255],
"aqua" => [0, 255, 255],
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::COLOR_NAMES, "colors_set", "colors_set");
}
/**
* Gets a 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, self::COLOR_NAMES, "colors_set", "colors_set");
}
}

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDConservationReportTypeSet extends MDValueSet {
const REPORT_TYPES = [
public const REPORT_TYPES = [
'damage',
'conservation',
'condition',

View File

@ -0,0 +1,21 @@
<?PHP
/**
* Contains a class for controlling the list of available recording types and sources.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available units for weights, lengths etc.
*/
final class MDConservationStatusSet extends MDValueSet {
public const STATUS_LEVELS = [
1 => '',
34 => 'markedBad',
67 => 'markedMedium',
100 => 'markedGood'
];
}

View File

@ -11,20 +11,29 @@ declare(strict_types = 1);
*/
final class MDCurrenciesSet extends MDValueSet {
const CURRENCIES = [
public const CURRENCIES = [
'',
"ddr-Mark",
"ddr-MDN",
"de-DM",
"de-RM",
"es-Real",
"eu-EUR",
"id-IDR",
"hu-Ft",
'by-BYN',
'ch-CHF', // Swiss Franc
'ddr-Mark',
'ddr-MDN',
'de-DM',
'de-RM',
'es-Real',
'eu-EUR',
'fr-FF',
'id-IDR',
'hu-Ft',
'hu-Lari',
'hu-Pengő',
"pl-Złoty",
"us-USD",
'hu-Korona',
'pl-Złoty',
'ru-RUB',
'su-SUR',
'ua-UAH',
'ua-UAK',
'uk-GBP',
'us-USD',
];
/**

View File

@ -0,0 +1,30 @@
<?PHP
/**
* Contains a class for controlling the list of available subjects for data history writing.
* Deprecated: Replaced by MusdbBaseEntry in musdb.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available options for data history subjects.
*/
final class MDDataHistorySubjectsSet extends MDValueSet {
public const AVAILABLE_SUBJECTS = [
'appointment',
'collection',
'contact',
'exhibition',
'literature',
'loan',
'museum',
'object',
'podcast',
'podcast_episode',
'series',
'user',
];
}

View File

@ -0,0 +1,44 @@
<?PHP
/**
* Contains a class for listing possible ways of disposing objects.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a class for listing possible ways of disposing objects.
*/
final class MDDisposalMethodSet extends MDValueSet {
public const METHODS = [
'',
'sold',
'destroyed',
'garbage',
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::METHODS, "disposal_method_set", "disposal_method_set");
}
/**
* 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, self::METHODS, "disposal_method_set", "disposal_method_set");
}
}

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDEntryTypesSet extends MDValueSet {
const ENTRY_TYPES = [
public const ENTRY_TYPES = [
'0', //
'1', // Schenkung
'2', // Kauf

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDEventsSet extends MDValueSet {
const EVENT_IDS = [
public const EVENT_IDS = [
'1', // => Created
'2', // => Found
'3', // => Published
@ -48,8 +48,8 @@ final class MDEventsSet extends MDValueSet {
'36', // => Was depicted
'37', // => Painted on
'38', // => Illustrated
'39', // "wurde zusammengefügt" (Finale Herstellung, z.B. Bild in Rahmen, Montage eines Omnibusses)
'40', // "wurde versteigert" (Objekt war im Auktionshandel)
'39', // => Assembled / "wurde zusammengefügt" (Finale Herstellung, z.B. Bild in Rahmen, Montage eines Omnibusses)
'40', // => Auctioned "wurde versteigert" (Objekt war im Auktionshandel)
'41', // "wurde gekauft" (Hier kann man jeden Kauf des Objektes vermerken)
'42', // "wurde besessen" (Hier kann man jeden Besitz des Objektes vermerken)
'43', // "wurde verkauft" (Hier kann man jeden Verkauf des Objektes vermerken)
@ -57,26 +57,39 @@ final class MDEventsSet extends MDValueSet {
'45', // "wurde beschädigt" (Hier kann man jede Beschädigung des Objektes vermerken, Teilbeschädigung oder Anlaß in Ereignisanmerkung)
'46', // "wurde zerstört" (Hier kann man die Zerstörung eines Objektes vermerken)
'47', // "verschollen" (Hier kann man das Abhandenkommen eines Objektes vermerken)
'48', // Nachtrag auf Anregung von Manfred: "wurde herausgegeben"
'48', // "wurde herausgegeben"
'49', // "gespendet / verschenkt"
'50', // "vererbt"
'51', // is subject of
'52', // Emerged
'53', // Production of material
'54', // Mentioned place
'55', // Mentioned time
'56', // Received ownership
'57', // Transferred ownership
];
const EVENTS_PRODUCTION = [1, 7, 9, 10, 19, 20, 26, 38, 39];
public const EVENTS_PRODUCTION = [1, 7, 9, 10, 19, 20, 26, 27, 28, 38, 39, 48, 52];
// Array enthält solche Ereignisse, die nach der Herstellung passiert sein müssen
const EVENTS_POST_PRODUCTION = [2, 3, 6, 8, 11, 13, 14, 15, 32, 34, 37, 40, 41, 42, 43, 44, 45, 46, 47];
public const EVENTS_POST_PRODUCTION = [2, 3, 6, 8, 11, 13, 14, 15, 32, 34, 37, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 56, 57];
// Array enthält solche Ereignisse, die vor der Herstellung passiert sein müssen
const EVENTS_PRE_PRODUCTION = [4, 12, 25, 29, 30, 31, 35];
public const EVENTS_PRE_PRODUCTION = [4, 12, 25, 29, 30, 31, 35, 53];
// Array enthält solche Ereignisse, die sich auf Objekte beziehen, die nicht hergestellt wurden
const EVENTS_NO_PRODUCTION = [21];
public const EVENTS_NO_PRODUCTION = [16, 21, 33, 51, 54, 55];
// Array enthält Ereignistypen, die auf Korrespondenzen hinweisen
const EVENTS_CORRESPONDENCE = [11, 13];
public const EVENTS_CORRESPONDENCE = [11, 13];
/*
* Constants for event types without places, times, actors
*/
const EVENTS_NO_TIME = [5, 22, 23, 36];
const EVENTS_NO_ACTOR = [21, 22, 24, 36];
const EVENTS_NO_PLACE = [5, 23, 24];
public const EVENTS_NO_TIME = [5, 22, 23, 33, 36];
public const EVENTS_NO_ACTOR = [21, 22, 24, 36, 52];
public const EVENTS_NO_PLACE = [5, 23, 24, 33];
/**
* Gets a list of the entries in a translated version.
@ -89,4 +102,46 @@ final class MDEventsSet extends MDValueSet {
return parent::getTlSortedList($tlLoader, self::EVENT_IDS, "eventtype_name", "eventname");
}
/**
* Gets a list of the entries in a translated version (actor focus).
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedListActors(MDTlLoader $tlLoader):array {
$output = parent::getTlSortedList($tlLoader, self::EVENT_IDS, "eventtype_persinst", "event_persinst");
foreach (self::EVENTS_NO_ACTOR as $id) unset($output[$id]);
return $output;
}
/**
* Gets a list of the entries in a translated version (place focus).
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedListPlaces(MDTlLoader $tlLoader):array {
$output = parent::getTlSortedList($tlLoader, self::EVENT_IDS, "eventtype_place", "event_place");
foreach (self::EVENTS_NO_PLACE as $id) unset($output[$id]);
return $output;
}
/**
* Gets a list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedListTimes(MDTlLoader $tlLoader):array {
$output = parent::getTlSortedList($tlLoader, self::EVENT_IDS, "eventtype_time", "event_time");
foreach (self::EVENTS_NO_TIME as $id) unset($output[$id]);
return $output;
}
}

View File

@ -0,0 +1,34 @@
<?PHP
/**
* Contains a class for controlling the list of available contributor types
* to exhibitions.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available contributor roles.
*/
final class MDExhibitionContributorsSet extends MDValueSet {
public const AVAILABLE_ROLES = [
'concept',
'curator',
'design',
'coordinator',
'protagonist',
];
/**
* Gets a 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, self::AVAILABLE_ROLES, "exhibition_contributor_roles", "exhibition_contributor_roles");
}
}

View File

@ -0,0 +1,20 @@
<?PHP
/**
* Contains a class for controlling the list of available external sources.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available external sources.
*/
final class MDExternalHostingSet extends MDValueSet {
public const DEFAULT_EXTERNAL_HOSTING = 'Archive.org';
public const EXTERNAL_SOURCES = [
'Archive.org',
];
}

44
src/MDGenderSet.php Normal file
View File

@ -0,0 +1,44 @@
<?PHP
/**
* Contains a class for listing the possible genders.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a class for listing the possible genders.
*/
final class MDGenderSet extends MDValueSet {
public const GENDERS = [
'',
'female',
'male',
'other',
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::GENDERS, "gender_set", "gender_set");
}
/**
* 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, self::GENDERS, "gender_set", "gender_set");
}
}

View File

@ -11,7 +11,202 @@ declare(strict_types = 1);
*/
final class MDLanguagesSet {
const AVAILABLE_LANGUAGES = [
public const AVAILABLE_LANGUAGES_SHORT = [
'aa',
'ab',
'ae',
'af',
'ak',
'am',
'an',
'ar',
'as',
'av',
'ay',
'az',
'ba',
'be',
'bg',
'bh',
'bi',
'bm',
'bn',
'bo',
'br',
'bs',
'ca',
'ce',
'ch',
'co',
'cr',
'crh',
'cs',
'cu',
'cv',
'cy',
'da',
'de',
'dsb',
'dv',
'dz',
'ee',
'egy',
'el',
'en',
'eo',
'es',
'et',
'eu',
'fa',
'ff',
'fi',
'fj',
'fo',
'fr',
'fy',
'ga',
'gd',
'gl',
'gn',
'grc',
'gu',
'gv',
'ha',
'he',
'hi',
'ho',
'hr',
'hsb',
'ht',
'hu',
'hy',
'hz',
'ia',
'id',
'ie',
'ig',
'ii',
'ik',
'io',
'is',
'it',
'iu',
'ja',
'jv',
'ka',
'kg',
'ki',
'kj',
'kk',
'kl',
'km',
'kn',
'ko',
'kr',
'ks',
'ku',
'kv',
'kw',
'ky',
'la',
'lb',
'lg',
'li',
'ln',
'lo',
'lt',
'lu',
'lv',
'mg',
'mh',
'mi',
'mk',
'ml',
'mn',
'mr',
'ms',
'mt',
'my',
'na',
'nb',
'nd',
'nds',
'ne',
'ng',
'nl',
'nn',
'no',
'nr',
'nv',
'ny',
'oc',
'oj',
'om',
'or',
'os',
'pa',
'pdt',
'pi',
'pl',
'ps',
'pt',
'qu',
'rm',
'rn',
'ro',
'ru',
'rw',
'sa',
'sc',
'sd',
'se',
'sg',
'si',
'sk',
'sl',
'sm',
'sn',
'so',
'sq',
'sr',
'ss',
'st',
'su',
'sv',
'sw',
'ta',
'te',
'tg',
'th',
'ti',
'tk',
'tl',
'tn',
'to',
'tr',
'ts',
'tt',
'tw',
'ty',
'ug',
'uk',
'ur',
'uz',
've',
'vi',
'vo',
'wa',
'wen',
'wo',
'xh',
'yi',
'yo',
'za',
'zh',
'zu',
];
public const AVAILABLE_LANGUAGES = [
'aa' => 'Afar-áf',
'ab' => 'аҧсуа бызшәа',
'ae' => 'Avestan',
@ -27,10 +222,10 @@ final class MDLanguagesSet {
'ba' => 'Bashkir',
'be' => 'беларуская мова',
'bg' => 'български език',
'bh' => 'Bihari',
'bh' => 'भोजपुरी',
'bi' => 'Bislama',
'bm' => 'Bambara',
'bn' => 'Bengali',
'bn' => 'বাংলা',
'bo' => 'བོད་སྐད',
'br' => 'Breton',
'bs' => 'Bosnian',
@ -39,6 +234,7 @@ final class MDLanguagesSet {
'ch' => 'Chamorro',
'co' => 'Corsican',
'cr' => 'Cree',
'crh' => 'Qırımtatar tili',
'cs' => 'čeština',
'cu' => 'словѣньскъ ѩзыкъ',
'cv' => 'Chuvash',
@ -56,12 +252,12 @@ final class MDLanguagesSet {
'es' => 'Spanish; Castilian',
'et' => 'Estonian',
'eu' => 'Basque',
'fa' => 'Persian',
'fa' => 'فارسی',
'ff' => 'Fula; Fulah; Pulaar; Pular',
'fi' => 'Finnish',
'fj' => 'Fijian',
'fo' => 'Faroese',
'fr' => 'French',
'fr' => 'Français',
'fy' => 'Western Frisian',
'ga' => 'Irish',
'gd' => 'Scottish Gaelic; Gaelic',
@ -71,8 +267,8 @@ final class MDLanguagesSet {
'gu' => 'Gujarati',
'gv' => 'Manx',
'ha' => 'Hausa',
'he' => 'Hebrew (modern)',
'hi' => 'Hindi',
'he' => 'עברית',
'hi' => 'हिन्दी',
'ho' => 'Hiri Motu',
'hr' => 'Croatian',
'hsb' => 'Hornjoserbšćina',
@ -90,7 +286,7 @@ final class MDLanguagesSet {
'is' => 'Icelandic',
'it' => 'Italian',
'iu' => 'Inuktitut',
'ja' => 'Japanese (ja)',
'ja' => '日本語',
'jv' => 'Javanese (jv)',
'ka' => 'Georgian',
'kg' => 'Kongo',
@ -98,9 +294,9 @@ final class MDLanguagesSet {
'kj' => 'Kwanyama, Kuanyama',
'kk' => 'Kazakh',
'kl' => 'Kalaallisut, Greenlandic',
'km' => 'Khmer',
'kn' => 'Kannada',
'ko' => 'Korean',
'km' => 'ភាសាខ្មែរ',
'kn' => 'ಕನ್ನಡ',
'ko' => '한국어',
'kr' => 'Kanuri',
'ks' => 'Kashmiri',
'ku' => 'Kurdish',
@ -120,15 +316,16 @@ final class MDLanguagesSet {
'mh' => 'Marshallese',
'mi' => 'Maori',
'mk' => 'Macedonian',
'ml' => 'Malayalam',
'mn' => 'Mongolian',
'mr' => 'Marathi (Mara?hi)',
'ml' => 'മലയാളം',
'mn' => 'Монгол',
'mr' => 'मराठी',
'ms' => 'Malay',
'mt' => 'Maltese',
'my' => 'Burmese',
'na' => 'Nauru',
'nb' => 'Bokmål',
'nd' => 'North Ndebele',
'nds' => 'Niederdeutsch',
'ne' => 'Nepali',
'ng' => 'Ndonga',
'nl' => 'Nederlands',
@ -143,17 +340,18 @@ final class MDLanguagesSet {
'or' => 'Oriya',
'os' => 'Ossetian, Ossetic',
'pa' => 'Panjabi, Punjabi',
'pdt' => 'Plautdietsch',
'pi' => 'Pali',
'pl' => 'Polish',
'ps' => 'Pashto, Pushto',
'pl' => 'Polski',
'ps' => 'پښتو',
'pt' => 'Português',
'qu' => 'Quechua',
'rm' => 'Romansh',
'rn' => 'Kirundi',
'ro' => 'Română',
'ru' => 'Russian',
'ru' => 'Русский',
'rw' => 'Kinyarwanda',
'sa' => 'Sanskrit (संस्कृत)',
'sa' => 'संस्कृत',
'sc' => 'Sardinian',
'sd' => 'Sindhi',
'se' => 'Northern Sami',
@ -171,8 +369,8 @@ final class MDLanguagesSet {
'su' => 'Sundanese',
'sv' => 'Swedish',
'sw' => 'Swahili',
'ta' => 'Tamil',
'te' => 'Telugu',
'ta' => 'தமிழ்',
'te' => 'తెలుగు',
'tg' => 'Tajik',
'th' => 'ภาษาไทย',
'ti' => 'Tigrinya',
@ -186,11 +384,11 @@ final class MDLanguagesSet {
'tw' => 'Twi',
'ty' => 'Tahitian',
'ug' => 'Uighur, Uyghur',
'uk' => 'Ukrainian',
'uk' => 'Українська',
'ur' => 'اردو',
'uz' => 'Uzbek',
've' => 'Venda',
'vi' => 'Vietnamese',
'vi' => 'Tiếng Việt',
'vo' => 'Volapük',
'wa' => 'Walloon',
'wen' => 'Sorbisch',
@ -200,7 +398,202 @@ final class MDLanguagesSet {
'yo' => 'Yoruba',
'za' => 'Zhuang, Chuang',
'zh' => 'Chinese',
'zu' => 'Zulu'
'zu' => 'Zulu',
];
public const LANGUAGES_ISO639_2B = [
'aa' => 'aar', # 'Afar-áf',
'ab' => 'abk', # 'аҧсуа бызшәа',
'ae' => 'ave', # 'Avestan',
'af' => 'afr', # 'Afrikaans',
'ak' => 'aka', # 'Akan',
'am' => 'amh', # 'Amharic',
'an' => 'arg', # 'Aragonese',
'ar' => 'ara', # 'العربية',
'as' => 'asm', # 'Assamese',
'av' => 'ava', # 'Avaric',
'ay' => 'aym', # 'Aymara',
'az' => 'aze', # 'Azerbaijani',
'ba' => 'bak', # 'Bashkir',
'be' => 'bel', # 'беларуская мова',
'bg' => 'bul', # 'български език',
'bh' => 'bih', # 'Bihari',
'bi' => 'bis', # 'Bislama',
'bm' => 'bam', # 'Bambara',
'bn' => 'ben', # 'Bengali',
'bo' => 'tib', # 'བོད་སྐད',
'br' => 'bre', # 'Breton',
'bs' => 'bos', # 'Bosnian',
'ca' => 'cat', # 'català',
'ce' => 'che', # 'Chechen',
'ch' => 'cha', # 'Chamorro',
'co' => 'cos', # 'Corsican',
'cr' => 'cre', # 'Cree',
'crh' => 'crh', # 'Crimean Tatar',
'cs' => 'cze', # 'čeština',
'cu' => 'chu', # 'словѣньскъ ѩзыкъ',
'cv' => 'chv', # 'Chuvash',
'cy' => 'wel', # 'Welsh',
'da' => 'dan', # 'Danish',
'de' => 'ger', # 'Deutsch',
'dsb' => 'dsb', # 'Dolnoserbšćina',
'dv' => 'div', # 'Divehi; Dhivehi; Maldivian;',
'dz' => 'dzo', # 'Dzongkha',
'ee' => 'ewe', # 'Ewe',
'egy' => 'egy', # 'Egyptian language',
'el' => 'gre', # 'ελληνικά',
'en' => 'eng', # 'English',
'eo' => 'epo', # 'Esperanto',
'es' => 'spa', # 'Spanish; Castilian',
'et' => 'est', # 'Estonian',
'eu' => 'baq', # 'Basque',
'fa' => 'per', # 'Persian',
'ff' => 'ful', # 'Fula; Fulah; Pulaar; Pular',
'fi' => 'fin', # 'Finnish',
'fj' => 'fij', # 'Fijian',
'fo' => 'fao', # 'Faroese',
'fr' => 'fre', # 'French',
'fy' => 'fry', # 'Western Frisian',
'ga' => 'gle', # 'Irish',
'gd' => 'gla', # 'Scottish Gaelic; Gaelic',
'gl' => 'glg', # 'Galician',
'gn' => 'grn', # 'Guaraní',
'grc' => 'grc', # 'Ancient Greek',
'gu' => 'guj', # 'Gujarati',
'gv' => 'glv', # 'Manx',
'ha' => 'hau', # 'Hausa',
'he' => 'heb', # 'Hebrew (modern)',
'hi' => 'hin', # 'Hindi',
'ho' => 'hmo', # 'Hiri Motu',
'hr' => 'hrv', # 'Croatian',
'hsb' => 'hsb', # 'Hornjoserbšćina',
'ht' => 'hat', # 'Haitian; Haitian Creole',
'hu' => 'hun', # 'Magyar',
'hy' => 'arm', # 'Armenian',
'hz' => 'her', # 'Herero',
'ia' => 'ina', # 'Interlingua',
'id' => 'ind', # 'Bahasa Indonesia',
'ie' => 'ile', # 'Interlingue',
'ig' => 'ibo', # 'Igbo',
'ii' => 'iii', # 'Nuosu',
'ik' => 'ipk', # 'Inupiaq',
'io' => 'ido', # 'Ido',
'is' => 'ice', # 'Icelandic',
'it' => 'ita', # 'Italian',
'iu' => 'iku', # 'Inuktitut',
'ja' => 'jpn', # 'Japanese (ja)',
'jv' => 'jav', # 'Javanese (jv)',
'ka' => 'geo', # 'Georgian',
'kg' => 'kon', # 'Kongo',
'ki' => 'kik', # 'Kikuyu, Gikuyu',
'kj' => 'kua', # 'Kwanyama, Kuanyama',
'kk' => 'kaz', # 'Kazakh',
'kl' => 'kal', # 'Kalaallisut, Greenlandic',
'km' => 'khm', # 'Khmer',
'kn' => 'kan', # 'Kannada',
'ko' => 'kor', # 'Korean',
'kr' => 'kau', # 'Kanuri',
'ks' => 'kas', # 'Kashmiri',
'ku' => 'kur', # 'Kurdish',
'kv' => 'kom', # 'Komi',
'kw' => 'cor', # 'Cornish',
'ky' => 'kir', # 'Kirghiz, Kyrgyz',
'la' => 'lat', # 'Latin',
'lb' => 'ltz', # 'Lëtzebuergesch',
'lg' => 'lug', # 'Luganda',
'li' => 'lim', # 'Limburgish, Limburgan, Limburger',
'ln' => 'lin', # 'Lingala',
'lo' => 'lao', # 'Lao',
'lt' => 'lit', # 'lietuvių kalba',
'lu' => 'lub', # 'Luba-Katanga',
'lv' => 'lav', # 'Latvian',
'mg' => 'mlg', # 'Malagasy',
'mh' => 'mah', # 'Marshallese',
'mi' => 'mao', # 'Maori',
'mk' => 'mac', # 'Macedonian',
'ml' => 'mal', # 'Malayalam',
'mn' => 'mon', # 'Mongolian',
'mr' => 'mar', # 'Marathi (Mara?hi)',
'ms' => 'may', # 'Malay',
'mt' => 'mlt', # 'Maltese',
'my' => 'bur', # 'Burmese',
'na' => 'nau', # 'Nauru',
'nb' => 'nob', # 'Bokmål',
'nd' => 'nde', # 'North Ndebele',
'nds' => 'nds', # 'Niederdeutsch',
'ne' => 'nep', # 'Nepali',
'ng' => 'ndo', # 'Ndonga',
'nl' => 'dut', # 'Nederlands',
'nn' => 'nno', # 'Nynorsk',
'no' => 'nor', # 'Norsk',
'nr' => 'nbl', # 'South Ndebele',
'nv' => 'nav', # 'Navajo, Navaho',
'ny' => 'nya', # 'Chichewa; Chewa; Nyanja',
'oc' => 'oci', # 'Occitan',
'oj' => 'oji', # 'Ojibwe, Ojibwa',
'om' => 'orm', # 'Oromo',
'or' => 'ori', # 'Oriya',
'os' => 'oss', # 'Ossetian, Ossetic',
'pa' => 'pan', # 'Panjabi, Punjabi',
'pdt' => 'pdt', # Plautdietsch
'pi' => 'pli', # 'Pali',
'pl' => 'pol', # 'Polish',
'ps' => 'pus', # 'Pashto, Pushto',
'pt' => 'por', # 'Português',
'qu' => 'que', # 'Quechua',
'rm' => 'roh', # 'Romansh',
'rn' => 'run', # 'Kirundi',
'ro' => 'rum', # 'Română',
'ru' => 'rus', # 'Russian',
'rw' => 'kin', # 'Kinyarwanda',
'sa' => 'san', # 'Sanskrit (संस्कृत)',
'sc' => 'srd', # 'Sardinian',
'sd' => 'snd', # 'Sindhi',
'se' => 'sme', # 'Northern Sami',
'sg' => 'sag', # 'Sango',
'si' => 'sin', # 'Sinhala, Sinhalese',
'sk' => 'slo', # 'Slovenčina',
'sl' => 'slv', # 'Slovenščina',
'sm' => 'smo', # 'Samoan',
'sn' => 'sna', # 'Shona',
'so' => 'som', # 'Somali',
'sq' => 'alb', # 'Albanian',
'sr' => 'srp', # 'Serbian',
'ss' => 'ssw', # 'Swati',
'st' => 'sot', # 'Southern Sotho',
'su' => 'sun', # 'Sundanese',
'sv' => 'swe', # 'Swedish',
'sw' => 'swa', # 'Swahili',
'ta' => 'tam', # 'Tamil',
'te' => 'tel', # 'Telugu',
'tg' => 'tgk', # 'Tajik',
'th' => 'tha', # 'ภาษาไทย',
'ti' => 'tir', # 'Tigrinya',
'tk' => 'tuk', # 'Turkmen',
'tl' => 'tgl', # 'Tagalog',
'tn' => 'tsn', # 'Tswana',
'to' => 'ton', # 'Tonga (Tonga Islands)',
'tr' => 'tur', # 'Türkçe',
'ts' => 'tso', # 'Tsonga',
'tt' => 'tat', # 'Tatar',
'tw' => 'twi', # 'Twi',
'ty' => 'tah', # 'Tahitian',
'ug' => 'uig', # 'Uighur, Uyghur',
'uk' => 'ukr', # 'Ukrainian',
'ur' => 'urd', # 'اردو',
'uz' => 'uzb', # 'Uzbek',
've' => 'ven', # 'Venda',
'vi' => 'vie', # 'Vietnamese',
'vo' => 'vol', # 'Volapük',
'wa' => 'wln', # 'Walloon',
'wen' => 'wen', # 'Sorbisch',
'wo' => 'wol', # 'Wolof',
'xh' => 'xho', # 'Xhosa',
'yi' => 'yid', # 'Yiddish',
'yo' => 'yor', # 'Yoruba',
'za' => 'zha', # 'Zhuang, Chuang',
'zh' => 'chi', # 'Chinese',
'zu' => 'zul', # 'Zulu',
];
}

View File

@ -11,7 +11,27 @@ declare(strict_types = 1);
*/
final class MDLicensesSet extends MDValueSet {
const AVAILABLE_LICENSES = [
public const DEFAULT_LICENSE_IMGS = 'CC BY-NC-SA';
public const DEFAULT_LICENSE_METADATA = 'CC BY-NC-SA';
public const AVAILABLE_LICENSES_NAMES = [
'CC BY-NC-SA',
'CC BY-NC-ND',
'CC BY-NC',
'CC BY-ND',
'CC BY-SA',
'CC BY',
'CC0',
'RR-F',
'RR-P',
'RR-R',
'Public Domain Mark',
'Orphan Work',
];
public const AVAILABLE_LICENSES = [
'CC BY-NC-SA' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
'CC BY-NC-ND' => 'https://creativecommons.org/licenses/by-nc-nd/4.0/',

44
src/MDLoanTypesSet.php Normal file
View File

@ -0,0 +1,44 @@
<?PHP
/**
* Contains a list of types of loans.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a list of types of loans.
*/
final class MDLoanTypesSet extends MDValueSet {
public const DEFAULT_LOAN_TYPE = 'outgoing';
public const LOAN_TYPES = [
'outgoing',
'incoming',
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::LOAN_TYPES, "loan_types", "loan_types");
}
/**
* Gets a 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, self::LOAN_TYPES, "loan_types", "loan_types");
}
}

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDMarkingTypesSet extends MDValueSet {
const MARKING_TYPES = [
public const MARKING_TYPES = [
'signature',
'engraving',
'watermark',
@ -19,7 +19,20 @@ final class MDMarkingTypesSet extends MDValueSet {
'stamp',
'overprint',
'embossing',
'embroidered',
'handwritten',
'screwed',
'burnt_in',
'riveted',
'nailed',
'punched',
'hallmarked',
'scarified',
'cast',
'sewn',
'glued',
'painted',
'drawn',
];
/**

View File

@ -0,0 +1,21 @@
<?PHP
/**
* Describes an interface for a measurement units.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Describes an interface for a measurement units.
*/
interface MDMeasurementUnitInterface {
/**
* Returns the measurement calculated down to the base unit (e.g. mm for lengths).
*
* @param float $value Measurement value.
*
* @return float
*/
public function convertToBaseUnit(float $value):float;
}

View File

@ -0,0 +1,78 @@
<?PHP
/**
* Class containing lists of repositories, tags, places, and actors can be linked with.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing lists of repositories, tags, places, and actors can be linked with.
*/
final class MDNodaRepositoriesSet extends MDValueSet {
public const REPOSITORIES_ACTOR = [
'allgemein',
'bne',
'bnf',
'edition humboldt digital',
'gnd',
'iconclass',
'kl-bb',
'lcsh',
'loc',
'NDB/ADB',
'ndl',
'ndp-ikmk-persons',
'nomisma',
'npg',
'orcid',
'pim',
'rkd',
'ulan',
'viaf',
'wikidata',
];
public const REPOSITORIES_PLACE = [
'allgemein',
'bne',
'bnf',
'cona',
'gnd',
'lcsh',
'loc',
'ndl',
'ndp-ikmk',
'nomisma',
'npg',
'osm',
'pleiades',
'rkd',
'viaf',
'wikidata',
];
public const REPOSITORIES_TAG = [
'aat',
'ackerbau',
'allgemein',
'bne',
'bnf',
'gnd',
'grobsystematik',
'iconclass',
'lcsh',
'loc',
'mindat.org',
'moebeltypologie',
'ndl',
'nomisma',
'npg',
'oberbegriffsdatei',
'rkd',
'viaf',
'wikidata',
];
}

46
src/MDObjectFormSet.php Normal file
View File

@ -0,0 +1,46 @@
<?PHP
/**
* Contains a class for listing the possible forms for objects.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a class for listing the possible forms for objects.
*/
final class MDObjectFormSet extends MDValueSet {
public const FORMS = [
'',
'cube',
'cuboid',
'sphere',
'cone',
'cylinder',
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::FORMS, "object_form_set", "object_form_set");
}
/**
* 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, self::FORMS, "object_form_set", "object_form_set");
}
}

View File

@ -11,8 +11,13 @@ declare(strict_types = 1);
*/
final class MDObjectPositionsSet extends MDValueSet {
const POSITIONS = [
'left', 'top_left', 'top', 'top_right', 'right', 'bottom_right', 'bottom', 'bottom_left', 'center', 'rear_side', 'edge', 'other',
public const POSITIONS = [
'front_front',
'left', 'top_left', 'top', 'top_right', 'right', 'bottom_right', 'bottom', 'bottom_left', 'center',
'rear_side',
'rear_left', 'rear_top_left', 'rear_top', 'rear_top_right', 'rear_right', 'rear_bottom_right', 'rear_bottom', 'rear_bottom_left', 'rear_center',
'underside', 'topside',
'edge', 'inside', 'other',
];
/**

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDObjectPublicationBackgrounds extends MDValueSet {
const PUBLICATION_BACKGROUNDS = [
public const PUBLICATION_BACKGROUNDS = [
'0', // Image published
'1', // Transcript published
'2', // Discussed

49
src/MDObjectStatusSet.php Normal file
View File

@ -0,0 +1,49 @@
<?PHP
/**
* Contains a list of states an object can be in for inventorization.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a list of states an object can be in for inventorization.
*/
final class MDObjectStatusSet extends MDValueSet {
public const DEFAULT_OBJECT_STATUS = 'owned';
public const OBJECT_STATUS = [
'owned',
'permanent_loan',
'third_party_property',
'borrowed',
'to_check_for_gift',
'to_check',
'deaccessed',
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::OBJECT_STATUS, "object_status", "object_status");
}
/**
* Gets a 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, self::OBJECT_STATUS, "object_status", "object_status");
}
}

View File

@ -0,0 +1,93 @@
<?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 {
public 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,
],
'smb-digital' => [
'url' => 'https://recherche.smb.museum/',
'object_prefix' => 'https://id.smb.museum/object/',
'org_prefix' => null,
'id_is_int' => true,
],
'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,
],
];
/**
* 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
*/
public static function getSearchUrlForObject(string $repo, string $instId, string $search_value):string {
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");
}
}
/**
* 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])) {
return $repo;
}
return false;
}
/**
* 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");
}
}

54
src/MDPhoneTypesSet.php Normal file
View File

@ -0,0 +1,54 @@
<?PHP
/**
* Contains a class for controlling the list of available phone types.
* Phone types (e.g. mobile, work, fax) are mainly used for contact pages in
* musdb.
* The list aims to be roughly similar to common implementations of the vCard standard.
*
* @see https://tools.ietf.org/html/rfc2426
* @see https://tools.ietf.org/html/rfc6350
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available place types.
*/
final class MDPhoneTypesSet extends MDValueSet {
public const DEFAULT_PHONE_TYPE = 'work';
public const PHONE_TYPES = [
'work',
'home',
'mobile',
'work mobile',
'fax',
'fax work',
];
/**
* Gets an unsorted list of the entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::PHONE_TYPES, "phone_types", "phone_types");
}
/**
* Gets a 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, self::PHONE_TYPES, "phone_types", "phone_types");
}
}

View File

@ -11,7 +11,7 @@ declare(strict_types = 1);
*/
final class MDPlacetypesSet extends MDValueSet {
const PLACE_TYPE_IDS = [
public const PLACE_TYPE_IDS = [
'0', // => Administrativ
'1', // => Historisch
'2', // => Region - Landschaft - Naturpark

View File

@ -12,7 +12,7 @@ declare(strict_types = 1);
*/
final class MDPodcastContributorsSet extends MDValueSet {
const AVAILABLE_ROLES = [
public const AVAILABLE_ROLES = [
'onair',
'organization',
'recording',

42
src/MDProcessTypesSet.php Normal file
View File

@ -0,0 +1,42 @@
<?PHP
/**
* Contains a class for listing the possible types of internal processes in a museum.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Contains a class for listing the possible types of internal processes in a museum.
*/
final class MDProcessTypesSet extends MDValueSet {
public const TYPES = [
'project',
'grant_application',
'exhibition',
'appointment', // This is MD's internally used name for events at the museum
'loan_incoming',
'loan_outgoing',
'employment_ad',
'purchase',
'deaccession',
'construction',
'pest_control_campaign',
'pr_campaign',
'relocation',
'discussion',
];
/**
* 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, self::TYPES, "process_types", "process_types");
}
}

View File

@ -0,0 +1,32 @@
<?PHP
/**
* Contains a class for controlling the list of available recording types.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available recording types.
*/
final class MDRecordingTypesSet extends MDValueSet {
public const DEFAULT_RECORDING_TYPE = 'audio';
public const RECORDING_TYPES = [
'audio',
'video',
];
/**
* Gets a 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, self::RECORDING_TYPES, "recording_types_set", "recording_types_set");
}
}

62
src/MDRequirementsSet.php Normal file
View File

@ -0,0 +1,62 @@
<?PHP
/**
* Class containing requirements for museum-digital generally.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing requirements for museum-digital generally.
*/
final class MDRequirementsSet {
// Newly created user account invites need to be accepted within
// the given timespan. If they are not, the account will be ignored
// and deleted.
// 60 * 60 * 24 * 6 = 518400. 6 days.
public const MAX_AGE_AFTER_USER_INVITE = 518400;
// Object images need to be at least 500 px wide
public const MIN_OBJECT_IMAGE_WIDTH = 540;
// Object images need to be at least 500 px wide
public const MIN_OBJECT_IMAGE_HEIGHT = 540;
public const MAX_FILESIZE_PDF = 20000000;
public const TIME_EARLIEST_YEAR = -6000000000;
public const TIME_EARLIEST_DATE = '0001-01-01';
public const TIME_LATEST_YEAR = 2099;
public const TIME_LATEST_DATE = '9999-12-31';
public const TIME_DEFAULT_DATE = '0001-01-01'; // Date to ignore in indexing
public const MIMETYPES_USER_PROFILE_IMG = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_OBJECT_IMAGE = ['image/jpeg', 'image/jpg', 'image/png', 'image/webp'];
public const MIMETYPES_OBJECT_PDF = ['application/pdf'];
public const MIMETYPES_OBJECT_PROVENANCE_REPORT = ['application/pdf'];
public const MIMETYPES_OBJECT_RESTORATION_REPORT = ['application/pdf', 'image/jpeg', 'image/png'];
public const MIMETYPES_OBJECT_CONDITION_REPORT = ['application/pdf', 'image/jpeg', 'image/png'];
public const MIMETYPES_OBJECT_DOCUMENT = ['image/jpeg', 'image/jpg', 'application/pdf'];
public const MIMETYPES_COLLECTION_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_INSTITUTION_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_EXHIBITION_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_ARTICLE_ASSET = ['image/jpeg', 'image/jpg', 'image/png'];
public const MIMETYPES_APPOINTMENT_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_APPOINTMENT_DOC_ASSET = ['application/pdf', 'image/jpeg', 'image/jpg', 'image/png'];
public const MIMETYPES_PODCAST_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_PODCAST_EPISODE_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_TOUR_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_CATALOGUE_WORK_IMAGE = ['image/jpeg', 'image/jpg'];
public const MIMETYPES_CATALOGUE_OBJECT_SUMMARY_IMAGE = ['image/jpeg', 'image/jpg'];
public const EXTENSIONS_THREE_D_ZIP = ['obj', 'mtl', 'jpg', 'jpeg', 'png'];
}

View File

@ -0,0 +1,34 @@
<?PHP
/**
* Research status.
*
* @see https://tools.ietf.org/html/rfc2426
* @see https://tools.ietf.org/html/rfc6350
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing available place types.
*/
final class MDResearchStatusSet extends MDValueSet {
public const RESEARCH_STATUS = [
'bad',
'medium',
'good',
];
/**
* Returns a translated list of research status.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getResearchStatusTLed(MDTlLoader $tlLoader):array {
return parent::getTlUnsortedList($tlLoader, self::RESEARCH_STATUS, "research_status", "research_status");
}
}

173
src/MDSourceType.php Normal file
View File

@ -0,0 +1,173 @@
<?PHP
/**
* Represents a type of source.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of source.
*/
enum MDSourceType implements MDValueEnumInterface, JsonSerializable {
case article;
case inbook;
case book;
case phdthesis;
case electronical;
case patent;
case unpublished;
case misc;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDSourceType
*/
public static function fromString(string $input):MDSourceType {
return match($input) {
"article" => self::article,
"inbook" => self::inbook,
"book" => self::book,
"phdthesis" => self::phdthesis,
"electronical" => self::electronical,
"patent" => self::patent,
"unpublished" => self::unpublished,
"misc" => self::misc,
default => throw new MDpageParameterNotFromListException("Unknown source type"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDSourceType
*/
public static function fromInt(int $input):MDSourceType {
return match($input) {
0 => self::article,
1 => self::inbook,
2 => self::book,
3 => self::phdthesis,
4 => self::electronical,
5 => self::patent,
6 => self::unpublished,
7 => self::misc,
default => throw new MDpageParameterNotFromListException("Unknown source 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(), "source_type_set", "source_type_set");
}
/**
* 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(), "source_type_set", "source_type_set");
}
/**
* 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::article => 0,
self::inbook => 1,
self::book => 2,
self::phdthesis => 3,
self::electronical => 4,
self::patent => 5,
self::unpublished => 6,
self::misc => 7,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("source_type_set", "source_type_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -1,22 +1,24 @@
<?PHP
/**
* Contains a class of available licenses.
* Contains a class of available source types.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing static functions for getting available licenses on md.
* Class containing static functions for getting available source types on md.
*/
final class MDSourceTypeSet extends MDValueSet {
const SOURCE_TYPES = [
public const SOURCE_TYPES = [
'article',
'inbook',
'book',
'phdthesis',
'electronical',
'patent',
'unpublished',
'misc',
];

View File

@ -0,0 +1,31 @@
<?PHP
/**
* Contains a class of available space access status.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing static functions for getting available space access status on md.
*/
final class MDSpaceAccessStatusSet extends MDValueSet {
public const STATUS = [
'enter',
'leave',
];
/**
* 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, self::STATUS, "space_access_status", "space_access_status");
}
}

41
src/MDSpaceTypesSet.php Normal file
View File

@ -0,0 +1,41 @@
<?PHP
/**
* Contains a class of available space types.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Class containing static functions for getting available space types on md.
*/
final class MDSpaceTypesSet extends MDValueSet {
public const TYPES = [
'building',
'floor',
'depot',
'utility_room',
'office',
'exhibition_room',
'hallway',
'display_cabinet',
'shelf',
'box',
'folder',
'outdoor_area',
];
/**
* 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, self::TYPES, "space_types", "space_types");
}
}

View File

@ -11,12 +11,14 @@ declare(strict_types = 1);
*/
final class MDTitleTypesSet extends MDValueSet {
const TITLE_TYPES = [
public const TITLE_TYPES = [
"",
"Science",
"Everyday speech",
"Colloquial speech",
"Dialect",
"Professional jargon",
"Sociolect",
];
/**

View File

@ -11,8 +11,67 @@ declare(strict_types = 1);
*/
final class MDUnitsSet extends MDValueSet {
const UNITS_LENGTH = ['', 'm', 'dm', 'cm', 'mm'];
const UNITS_WEIGHT = ['', 't', 'kg', 'g'];
public const UNITS_LENGTH = ['', 'm', 'dm', 'cm', 'mm', 'ft', 'in'];
public const UNITS_WEIGHT = ['', 't', 'kg', 'g'];
public const UNITS_LENGTH_TO_MILLIMETER = [
'm' => 1000,
'ft' => 304.8,
'dm' => 100,
'in' => 25.4,
'cm' => 10,
'mm' => 1,
];
public const UNITS_WEIGHT_TO_GRAMM = [
't' => 1000000,
'kg' => 1000,
'g' => 1,
];
/**
* Converts a given length to millimeters.
*
* @param mixed $value Input value to convert.
* @param string $unit Length unit of the value to convert.
*
* @return float|null
*/
public static function convertLengthToMillimeter(mixed $value, string $unit):float|null {
if (!isset(self::UNITS_LENGTH_TO_MILLIMETER[$unit])) return null;
try {
$number = MD_STD_IN::sanitize_float($value);
return floatval($number * self::UNITS_LENGTH_TO_MILLIMETER[$unit]);
}
catch (MDgenericInvalidInputsException $e) {
return null;
}
}
/**
* Converts a given weight to gramm.
*
* @param mixed $value Input value to convert.
* @param string $unit Weight unit of the value to convert.
*
* @return float|null
*/
public static function convertWeightToGramm(mixed $value, string $unit):float|null {
if (!isset(self::UNITS_WEIGHT_TO_GRAMM[$unit])) return null;
try {
$number = MD_STD_IN::sanitize_float($value);
return floatval($number * self::UNITS_WEIGHT_TO_GRAMM[$unit]);
}
catch (MDgenericInvalidInputsException $e) {
return null;
}
}
/**
* Returns a translated list of length units.

View File

@ -18,7 +18,7 @@ class MDValueSet {
* @param string $tlFileName Name of the translation file.
* @param string $tlVarName Variable of the translation.
*
* @return array<string>
* @return array<string, string>
*/
public static function getTlUnsortedList(MDTlLoader $tlLoader, array $keyList, string $tlFileName, string $tlVarName):array {

View File

@ -0,0 +1,75 @@
<?PHP
/**
* Describes a measurement of an object.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Describes a measurement of an object.
*/
final class MDMeasurement implements JsonSerializable {
public readonly int $object_id;
public readonly MDMeasurementType $type;
public float $value;
public MDLengthUnit|MDCountCopiesUnit|MDWeightUnit|MDCountPartsUnit|MDDieAxisUnit $unit;
public bool $exactness;
public string $note;
public string $updated_by = "";
public int $update_timestamp = 0;
/**
* Returns array for forming JSON representation.
*
* @return array{type: MDMeasurementType, value: float, unit: MDLengthUnit|MDCountCopiesUnit|MDWeightUnit|MDCountPartsUnit|MDDieAxisUnit, exactness: bool, note: string}|array{type: MDMeasurementType, value: float, unit: MDLengthUnit|MDCountCopiesUnit|MDWeightUnit|MDCountPartsUnit|MDDieAxisUnit, exactness: bool, note: string, updated_by: string, update_timestamp: int}
*/
public function jsonSerialize():array {
$output = [
'type' => $this->type,
'value' => $this->value,
'unit' => $this->unit,
'exactness' => $this->exactness,
'note' => $this->note,
];
if ($this->update_timestamp !== 0) {
$output['updated_by'] = $this->updated_by;
$output['update_timestamp'] = $this->update_timestamp;
}
return $output;
}
/**
* Constructor.
*
* @param integer $object_id Object ID.
* @param MDMeasurementType $type Type.
* @param float $value Value.
* @param MDLengthUnit|MDCountCopiesUnit|MDWeightUnit|MDCountPartsUnit|MDDieAxisUnit $unit Unit.
* @param boolean $exactness Exactness.
* @param string $note Note.
*
* @return void
*/
public function __construct(int $object_id, MDMeasurementType $type, float $value, MDLengthUnit|MDCountCopiesUnit|MDWeightUnit|MDCountPartsUnit|MDDieAxisUnit $unit, bool $exactness, string $note) {
$this->object_id = $object_id;
$this->type = $type;
// Validate unit
if (get_class($unit) !== $this->type->getMeasurementUnit()) {
throw new Exception("Invalid unit selected");
}
$this->value = $value;
$this->unit = $unit;
$this->exactness = $exactness;
$this->note = $note;
}
}

View File

@ -0,0 +1,45 @@
<?PHP
/**
* Describes a reference to an external norm data repository.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Describes a reference to an external norm data repository.
*/
final class MDNodaLink {
public readonly MDNodaRepository $source;
public readonly string $id;
/**
* Returns the link to the current entity.
*
* @return string
*/
public function getEntityLink():string {
return $this->source->getEntityLink($this->id);
}
/**
* Constructor.
*
* @param MDNodaRepository $source Source repository.
* @param string $id ID.
*
* @return void
*/
public function __construct(MDNodaRepository $source, string $id) {
$this->source = $source;
if (($validatedId = $this->source->validateId(strtr(trim($id), [" " => "", "\t" => "", "\n" => ""]))) === false) {
throw new MDInvalidNodaLink("Invalid norm data ID / link: \"" . $id . "\" [Repository: " . $this->source->toDbName() . "]");
}
$this->id = $validatedId;
}
}

1
src/classes/README.md Normal file
View File

@ -0,0 +1 @@
# Full-scale data types that provide further functionality but end up representing base data types

View File

@ -0,0 +1,37 @@
<?PHP
/**
* Lists the types of functionalities for which app tokens can be used in musdb.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Sections of musdb for which alternative output formats are available,
* that can be used with an app token.
*/
enum MDAppTokenSection {
case webcal;
case space_sensors;
case space_sensors_dashboard;
case general_stats_dashboard;
/**
* 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;
}
}

View File

@ -0,0 +1,125 @@
<?PHP
/**
* Represents a type of cancellation status for events / appointments.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of cancellation status for events / appointments.
*/
enum MDAppointmentCancellationStatus implements MDValueEnumInterface, JsonSerializable {
case scheduled_done;
case cancelled;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDAppointmentCancellationStatus
*/
public static function fromString(string $input):MDAppointmentCancellationStatus {
return match($input) {
'scheduled_done' => self::scheduled_done,
'cancelled' => self::cancelled,
default => throw new MDpageParameterNotFromListException("Unknown cancellation status"),
};
}
/**
* Returns the default status.
*
* @return MDAppointmentCancellationStatus
*/
public static function getDefault():MDAppointmentCancellationStatus {
return self::scheduled_done;
}
/**
* 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_cancellation_status_set", "appointment_cancellation_status_set");
}
/**
* 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_cancellation_status_set", "appointment_cancellation_status_set");
}
/**
* 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_cancellation_status_set", "appointment_cancellation_status_set", $this->name);
}
/**
* Returns the JSON-LD representation of the attendance mode.
*
* @return string
*/
public function getJsonLd():string {
return match($this) {
self::scheduled_done => "https://schema.org/EventScheduled",
self::cancelled => "https://schema.org/EventCancelled",
// default => throw new MDpageParameterNotFromListException("Unknown JSON LD for attendance status"),
};
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,125 @@
<?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);
/**
* Represents a type of attendance status for events / appointments: offline or online.
*/
enum MDAttendanceStatus implements MDValueEnumInterface, JsonSerializable {
case online;
case offline;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDAttendanceStatus
*/
public static function fromString(string $input):MDAttendanceStatus {
return match($input) {
'online' => self::online,
'offline' => self::offline,
default => throw new MDpageParameterNotFromListException("Unknown attendance status"),
};
}
/**
* Returns the default status.
*
* @return MDAttendanceStatus
*/
public static function getDefault():MDAttendanceStatus {
return self::offline;
}
/**
* 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(), "attendance_status_set", "attendance_status_set");
}
/**
* 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(), "attendance_status_set", "attendance_status_set");
}
/**
* 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("attendance_status_set", "attendance_status_set", $this->name);
}
/**
* Returns the JSON-LD representation of the attendance mode.
*
* @return string
*/
public function getJsonLd():string {
return match($this) {
self::online => "https://schema.org/OnlineEventAttendanceMode",
self::offline => "https://schema.org/OfflineEventAttendanceMode",
// default => throw new MDpageParameterNotFromListException("Unknown JSON LD for attendance status"),
};
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,122 @@
<?PHP
/**
* Represents a copyright collective.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of check an object may be subject to (completeness, condition, general audit).
*/
enum MDCopyrightCollective implements JsonSerializable {
case vg_bildkunst;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDCopyrightCollective
*/
public static function fromString(string $input):MDCopyrightCollective {
return match($input) {
'vg_bildkunst' => self::vg_bildkunst,
default => throw new MDpageParameterNotFromListException("Unknown copyright collective"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDCopyrightCollective
*/
public static function fromInt(int $input):MDCopyrightCollective {
return match($input) {
1 => self::vg_bildkunst,
default => throw new MDpageParameterNotFromListException("Unknown copyright collective"),
};
}
/**
*
*/
/**
* 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 the human-readable name of the copyright collective.
*
* @return string
*/
public function getName():string {
return match($this) {
self::vg_bildkunst => "VG Bildkunst",
default => throw new MDpageParameterNotFromListException("Unknown copyright collective"),
};
}
/**
* Returns an integer representation of the collective (for storage in DB).
*
* @return integer
*/
public function toInt():int {
return match($this) {
self::vg_bildkunst => 1,
default => throw new MDpageParameterNotFromListException("Unknown copyright collective"),
};
}
/**
* Returns a link to the contact form.
*
* @return string
*/
public function getContactForm():string {
return match($this) {
self::vg_bildkunst => "https://www.bildkunst.de/service/formulare-fuer-nutzer/anfrage-online-nutzung",
default => throw new MDpageParameterNotFromListException("Unknown copyright collective"),
};
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,148 @@
<?PHP
/**
* Represents a measurement type.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a measurement type.
*/
enum MDCountCopiesUnit implements MDValueEnumInterface, JsonSerializable, MDMeasurementUnitInterface {
case copies;
case specimen;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDCountCopiesUnit
*/
public static function fromString(string $input):MDCountCopiesUnit {
return match($input) {
'copies' => self::copies,
'specimen' => self::specimen,
default => throw new MDpageParameterNotFromListException("Unknown copies count unit"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDCountCopiesUnit
*/
public static function fromInt(int $input):MDCountCopiesUnit {
return match($input) {
1 => self::copies,
2 => self::specimen,
default => throw new MDpageParameterNotFromListException("Unknown copies count unit"),
};
}
/**
*
*/
/**
* 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::copies => 1,
self::specimen => 2,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns the measurement calculated down to the base unit.
*
* @param float $value Measurement value.
*
* @return float
*/
public function convertToBaseUnit(float $value):float {
return $value;
}
/**
* 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(), "units_count_copies_set", "units_count_copies_set");
}
/**
* 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(), "units_count_copies_set", "units_count_copies_set");
}
/**
* 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("units_count_copies_set", "units_count_copies_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,152 @@
<?PHP
/**
* Represents a measurement type.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a measurement type.
*/
enum MDCountPartsUnit implements MDValueEnumInterface, JsonSerializable, MDMeasurementUnitInterface {
case parts;
case sheets;
case pages;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDCountPartsUnit
*/
public static function fromString(string $input):MDCountPartsUnit {
return match($input) {
'parts' => self::parts,
'pages' => self::pages,
'sheets' => self::sheets,
default => throw new MDpageParameterNotFromListException("Unknown parts counting unit"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDCountPartsUnit
*/
public static function fromInt(int $input):MDCountPartsUnit {
return match($input) {
1 => self::parts,
2 => self::pages,
3 => self::sheets,
default => throw new MDpageParameterNotFromListException("Unknown parts counting unit"),
};
}
/**
*
*/
/**
* 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::parts => 1,
self::pages => 2,
self::sheets => 3,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns the measurement calculated down to the base unit.
*
* @param float $value Measurement value.
*
* @return float
*/
public function convertToBaseUnit(float $value):float {
return $value;
}
/**
* 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(), "units_count_parts_set", "units_count_parts_set");
}
/**
* 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(), "units_count_parts_set", "units_count_parts_set");
}
/**
* 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("units_count_parts_set", "units_count_parts_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,78 @@
<?PHP
/**
* Represents a format in which custom reports can be generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a format in which custom reports can be generated.
*/
enum MDCustomReportFormat implements JsonSerializable {
case csv;
case html;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDCustomReportFormat
*/
public static function fromString(string $input):MDCustomReportFormat {
return match($input) {
'csv' => self::csv,
'html' => self::html,
default => throw new MDpageParameterNotFromListException("Unknown custom report format"),
};
}
/**
* 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;
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
/**
* Sanitizes a string for input into a file of the current format.
*
* @param string $input Input string to sanitize.
*
* @return string
*/
public function sanitize(string $input):string {
return match($this) {
self::csv => '"' . strtr($input, ['"' => '\'']) . '"',
self::html => htmlspecialchars($input),
};
}
}

View File

@ -0,0 +1,103 @@
<?PHP
/**
* Represents a type of page for which custom reports can be generated in musdb.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of page for which custom reports can be generated in musdb.
*/
enum MDCustomReportTarget implements MDValueEnumInterface, JsonSerializable {
case object_single;
case object_list;
case loan;
case exhibition;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDCustomReportTarget
*/
public static function fromString(string $input):MDCustomReportTarget {
return match($input) {
'object_single' => self::object_single,
'object_list' => self::object_list,
'loan' => self::loan,
'exhibition' => self::exhibition,
default => throw new MDpageParameterNotFromListException("Unknown custom report target: " . $input),
};
}
/**
* 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(), "custom_report_targets_set", "custom_report_targets_set");
}
/**
* 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(), "custom_report_targets_set", "custom_report_targets_set");
}
/**
* 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("custom_report_targets_set", "custom_report_targets_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

144
src/enums/MDDieAxisUnit.php Normal file
View File

@ -0,0 +1,144 @@
<?PHP
/**
* Represents a measurement type.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a measurement type.
*/
enum MDDieAxisUnit implements MDValueEnumInterface, JsonSerializable, MDMeasurementUnitInterface {
case h;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDDieAxisUnit
*/
public static function fromString(string $input):MDDieAxisUnit {
return match($input) {
'h' => self::h,
default => throw new MDpageParameterNotFromListException("Unknown h counting unit"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDDieAxisUnit
*/
public static function fromInt(int $input):MDDieAxisUnit {
return match($input) {
1 => self::h,
default => throw new MDpageParameterNotFromListException("Unknown h counting unit"),
};
}
/**
*
*/
/**
* 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::h => 1,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns the measurement calculated down to the base unit.
*
* @param float $value Measurement value.
*
* @return float
*/
public function convertToBaseUnit(float $value):float {
return $value;
}
/**
* 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(), "units_die_axis_set", "units_die_axis_set");
}
/**
* 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(), "units_die_axis_set", "units_die_axis_set");
}
/**
* 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("units_die_axis_set", "units_die_axis_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,177 @@
<?PHP
/**
* Represents a type of contribution to an exhibition.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of contribution to an exhibition.
*/
enum MDExhibitionContributorRole implements MDValueEnumInterface, JsonSerializable {
case concept;
case curator;
case design;
case coordinator;
case protagonist;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDExhibitionContributorRole
*/
public static function fromString(string $input):MDExhibitionContributorRole {
return match($input) {
"concept" => self::concept,
"curator" => self::curator,
"design" => self::design,
"coordinator" => self::coordinator,
"protagonist" => self::protagonist,
default => throw new MDpageParameterNotFromListException("Unknown exhibition contributor role"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDExhibitionContributorRole
*/
public static function fromInt(int $input):MDExhibitionContributorRole {
return match($input) {
0 => self::concept,
1 => self::curator,
2 => self::design,
3 => self::coordinator,
4 => self::protagonist,
default => throw new MDpageParameterNotFromListException("Unknown exhibition 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(), "exhibition_contributor_roles", "exhibition_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(), "exhibition_contributor_roles", "exhibition_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::concept => 0,
self::curator => 1,
self::design => 2,
self::coordinator => 3,
self::protagonist => 4,
};
}
/**
* Returns canonical string representation of object record status.
*
* @return string
*/
public function toString():string {
return match($this) {
self::concept => 'concept',
self::curator => 'curator',
self::design => 'design',
self::coordinator => 'coordinator',
self::protagonist => 'protagonist',
};
}
/**
* 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("exhibition_contributor_roles", "exhibition_contributor_roles", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

176
src/enums/MDGender.php Normal file
View File

@ -0,0 +1,176 @@
<?PHP
/**
* Represents a gender.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a gender.
*/
enum MDGender implements MDValueEnumInterface, JsonSerializable {
case none;
case female;
case male;
case other;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDGender
*/
public static function fromString(string $input):MDGender {
return match($input) {
"" => self::none,
"none" => self::none,
"female" => self::female,
"male" => self::male,
"other" => self::other,
default => throw new MDpageParameterNotFromListException("Unknown gender"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDGender
*/
public static function fromInt(int $input):MDGender {
return match($input) {
0 => self::none,
1 => self::female,
2 => self::male,
3 => self::other,
default => throw new MDpageParameterNotFromListException("Unknown gender"),
};
}
/**
* 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(), "gender_set", "gender_set");
}
/**
* 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(), "gender_set", "gender_set");
}
/**
* 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::none => 0,
self::female => 1,
self::male => 2,
self::other => 3,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns string representation.
*
* @return string
*/
public function toString():string {
return match($this) {
self::none => '',
self::female => 'female',
self::male => 'male',
self::other => 'other',
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns the name of the current value in translation.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return string
*/
public function getTledName(MDTlLoader $tlLoader):string {
if ($this === self::none) return '';
return $tlLoader->tl("gender_set", "gender_set", $this->toString());
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->toString();
}
}

View File

@ -0,0 +1,165 @@
<?PHP
/**
* Represents a most basic categorization of institutions using museum-digital.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a most basic categorization of institutions using museum-digital.
*/
enum MDInstitutionBasicCategory implements MDValueEnumInterface, JsonSerializable {
case museum;
case archive;
case library;
case memorial_site;
case private_collection;
case university_collection;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDInstitutionBasicCategory
*/
public static function fromString(string $input):MDInstitutionBasicCategory {
return match($input) {
"museum" => self::museum,
"archive" => self::archive,
"library" => self::library,
"memorial_site" => self::memorial_site,
"private_collection" => self::private_collection,
"university_collection" => self::university_collection,
default => throw new MDpageParameterNotFromListException("Unknown institution category"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDInstitutionBasicCategory
*/
public static function fromInt(int $input):MDInstitutionBasicCategory {
return match($input) {
0 => self::museum,
1 => self::archive,
2 => self::library,
3 => self::memorial_site,
4 => self::private_collection,
5 => self::university_collection,
default => throw new MDpageParameterNotFromListException("Unknown institution category"),
};
}
/**
* 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(), "institution_basic_category_set", "institution_basic_category_set");
}
/**
* 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(), "institution_basic_category_set", "institution_basic_category_set");
}
/**
* 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::museum => 0,
self::archive => 1,
self::library => 2,
self::memorial_site => 3,
self::private_collection => 4,
self::university_collection => 5,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("institution_basic_category_set", "institution_basic_category_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,254 @@
<?PHP
/**
* Represents a type of collection focus a museum (or similar institution) may have.
* This can be useful for statistics and be used in line with institutions' self-
* categorization.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of collection focus a museum (or similar institution) may have.
* This can be useful for statistics and be used in line with institutions' self-
* categorization.
*/
enum MDInstitutionCollectionArea implements MDValueEnumInterface, JsonSerializable {
case everyday_life;
case archaeology;
case architecture;
case history_of_mining;
case botany;
case history_of_film;
case political_history;
case arts;
case applied_arts;
case agriculture;
case literature;
case history_of_medicine;
case military_history;
case mineralogy;
case music;
case numismatics;
case paleontology;
case personalia;
case regional_history;
case religion;
case technology;
case ethnography;
case zoology;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDInstitutionCollectionArea
*/
public static function fromString(string $input):MDInstitutionCollectionArea {
return match($input) {
"everyday_life" => self::everyday_life,
"archaeology" => self::archaeology,
"architecture" => self::architecture,
"history_of_mining" => self::history_of_mining,
"botany" => self::botany,
"history_of_film" => self::history_of_film,
"political_history" => self::political_history,
"arts" => self::arts,
"applied_arts" => self::applied_arts,
"agriculture" => self::agriculture,
"literature" => self::literature,
"history_of_medicine" => self::history_of_medicine,
"military_history" => self::military_history,
"mineralogy" => self::mineralogy,
"music" => self::music,
"numismatics" => self::numismatics,
"paleontology" => self::paleontology,
"personalia" => self::personalia,
"regional_history" => self::regional_history,
"religion" => self::religion,
"technology" => self::technology,
"ethnography" => self::ethnography,
"zoology" => self::zoology,
default => throw new MDpageParameterNotFromListException("Unknown collection focus area"),
};
}
/**
* Returns instances of MDInstitutionCollectionArea based on list of strings.
*
* @param list<string> $input Input to get a value from.
*
* @return list<MDInstitutionCollectionArea>
*/
public static function fromStrings(array $input):array {
$output = [];
foreach ($input as $value) {
$output[] = self::fromString($value);
}
return $output;
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDInstitutionCollectionArea
*/
public static function fromInt(int $input):MDInstitutionCollectionArea {
return match($input) {
0 => self::everyday_life,
1 => self::archaeology,
2 => self::architecture,
3 => self::history_of_mining,
4 => self::botany,
5 => self::history_of_film,
6 => self::political_history,
7 => self::arts,
8 => self::applied_arts,
9 => self::agriculture,
10 => self::literature,
11 => self::history_of_medicine,
12 => self::military_history,
13 => self::mineralogy,
14 => self::music,
15 => self::numismatics,
16 => self::paleontology,
17 => self::personalia,
18 => self::regional_history,
19 => self::religion,
20 => self::technology,
21 => self::ethnography,
22 => self::zoology,
default => throw new MDpageParameterNotFromListException("Unknown collection focus area"),
};
}
/**
* 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(), "institution_collection_area_set", "institution_collection_area_set");
}
/**
* 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(), "institution_collection_area_set", "institution_collection_area_set");
}
/**
* 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::everyday_life => 0,
self::archaeology => 1,
self::architecture => 2,
self::history_of_mining => 3,
self::botany => 4,
self::history_of_film => 5,
self::political_history => 6,
self::arts => 7,
self::applied_arts => 8,
self::agriculture => 9,
self::literature => 10,
self::history_of_medicine => 11,
self::military_history => 12,
self::mineralogy => 13,
self::music => 14,
self::numismatics => 15,
self::paleontology => 16,
self::personalia => 17,
self::regional_history => 18,
self::religion => 19,
self::technology => 20,
self::ethnography => 21,
self::zoology => 22,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("institution_collection_area_set", "institution_collection_area_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,128 @@
<?PHP
/**
* Represents a possible repository, in which an institution is listed with an ID.
* The ISIL is not covered in this list.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a possible status for to-dos.
*/
enum MDInstitutionExternalIdRepository implements MDValueEnumInterface, JsonSerializable {
case hu_ksh; // https://en.wikipedia.org/wiki/Hungarian_Central_Statistical_Office
private const VALIDATION_PATTERN_HTML = [
'hu_ksh' => '[0-9]{8}-[0-9]{4}-[0-9]{3}-[0-9]{2}',
];
private const VALIDATION_PATTERN_PHP = [
'hu_ksh' => '/^[0-9]{8}-[0-9]{4}-[0-9]{3}-[0-9]{2}$/',
];
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDInstitutionExternalIdRepository
*/
public static function fromString(string $input):MDInstitutionExternalIdRepository {
return match($input) {
'hu_ksh' => self::hu_ksh,
default => throw new MDpageParameterNotFromListException("Unknown external repository"),
};
}
/**
* 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(), "institution_external_id_repositories", "institution_external_id_repositories");
}
/**
* 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(), "institution_external_id_repositories", "institution_external_id_repositories");
}
/**
* 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("institution_external_id_repositories", "institution_external_id_repositories", $this->name);
}
/**
* Returns the HTML pattern.
*
* @return string
*/
public function getValidationPatternHtml():string {
return self::VALIDATION_PATTERN_HTML[$this->name];
}
/**
* Returns the PHP pattern.
*
* @return string
*/
public function getValidationPatternPhp():string {
return self::VALIDATION_PATTERN_PHP[$this->name];
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,157 @@
<?PHP
/**
* Represents the status of an institution as a public or privately-run one.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents the status of an institution as a public or privately-run one.
*/
enum MDInstitutionPublicPrivateStatus implements MDValueEnumInterface, JsonSerializable {
case public;
case private;
case religious;
case mixed;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDInstitutionPublicPrivateStatus
*/
public static function fromString(string $input):MDInstitutionPublicPrivateStatus {
return match($input) {
"public" => self::public,
"private" => self::private,
"religious" => self::religious,
"mixed" => self::mixed,
default => throw new MDpageParameterNotFromListException("Unknown public / private status"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDInstitutionPublicPrivateStatus
*/
public static function fromInt(int $input):MDInstitutionPublicPrivateStatus {
return match($input) {
0 => self::public,
1 => self::private,
2 => self::religious,
3 => self::mixed,
default => throw new MDpageParameterNotFromListException("Unknown public / private 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(), "institution_public_private_category_set", "institution_public_private_category_set");
}
/**
* 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(), "institution_public_private_category_set", "institution_public_private_category_set");
}
/**
* 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::public => 0,
self::private => 1,
self::religious => 2,
self::mixed => 3,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("institution_public_private_category_set", "institution_public_private_category_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,153 @@
<?PHP
/**
* Represents the use case an institution uses museum-digital's tools for.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents the use case an institution uses museum-digital's tools for.
*/
enum MDInstitutionUseCase implements MDValueEnumInterface, JsonSerializable {
case collection_management;
case publication;
case collection_management_and_publication;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDInstitutionUseCase
*/
public static function fromString(string $input):MDInstitutionUseCase {
return match($input) {
"collection_management" => self::collection_management,
"publication" => self::publication,
"collection_management_and_publication" => self::collection_management_and_publication,
default => throw new MDpageParameterNotFromListException("Unknown use case for museum-digital"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDInstitutionUseCase
*/
public static function fromInt(int $input):MDInstitutionUseCase {
return match($input) {
0 => self::collection_management,
1 => self::publication,
2 => self::collection_management_and_publication,
default => throw new MDpageParameterNotFromListException("Unknown use case for museum-digital"),
};
}
/**
* 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(), "institution_musdb_use_case_set", "institution_musdb_use_case_set");
}
/**
* 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(), "institution_musdb_use_case_set", "institution_musdb_use_case_set");
}
/**
* 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::collection_management => 0,
self::publication => 1,
self::collection_management_and_publication => 2,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("institution_musdb_use_case_set", "institution_musdb_use_case_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

173
src/enums/MDLengthUnit.php Normal file
View File

@ -0,0 +1,173 @@
<?PHP
/**
* Represents a measurement type.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a measurement type.
*/
enum MDLengthUnit implements MDValueEnumInterface, JsonSerializable, MDMeasurementUnitInterface {
case m;
case dm;
case cm;
case mm;
case ft;
case in;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDLengthUnit
*/
public static function fromString(string $input):MDLengthUnit {
return match($input) {
'm' => self::m,
'dm' => self::dm,
'cm' => self::cm,
'mm' => self::mm,
'ft' => self::ft,
'in' => self::in,
default => throw new MDpageParameterNotFromListException("Unknown length unit"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDLengthUnit
*/
public static function fromInt(int $input):MDLengthUnit {
return match($input) {
1 => self::m,
2 => self::dm,
3 => self::cm,
4 => self::mm,
5 => self::ft,
6 => self::in,
default => throw new MDpageParameterNotFromListException("Unknown length unit"),
};
}
/**
*
*/
/**
* 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::m => 1,
self::dm => 2,
self::cm => 3,
self::mm => 4,
self::ft => 5,
self::in => 6,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns the measurement calculated down to the base unit (e.g. mm for lengths).
*
* @param float $value Measurement value.
*
* @return float
*/
public function convertToBaseUnit(float $value):float {
$multiplier = match($this) {
self::m => 1000,
self::ft => 304.8,
self::dm => 100,
self::in => 25.4,
self::cm => 10,
self::mm => 1,
};
return floatval($value * $multiplier);
}
/**
* 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(), "units_length_set", "units_length_set");
}
/**
* 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(), "units_length_set", "units_length_set");
}
/**
* 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("units_length_set", "units_length_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

237
src/enums/MDLicense.php Normal file
View File

@ -0,0 +1,237 @@
<?PHP
/**
* Represents a license.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a license.
*/
enum MDLicense implements MDValueEnumInterface, JsonSerializable {
case CC_BY_NC_SA;
case CC_BY_NC_ND;
case CC_BY_NC;
case CC_BY_ND;
case CC_BY_SA;
case CC_BY;
case CC0;
case RR_F;
case RR_P;
case RR_R;
case Public_Domain_Mark;
case Orphan_Work;
public const AVAILABLE_LICENSES = [
'CC BY-NC-SA' => 'https://creativecommons.org/licenses/by-nc-sa/4.0/',
'CC BY-NC-ND' => 'https://creativecommons.org/licenses/by-nc-nd/4.0/',
'CC BY-NC' => 'https://creativecommons.org/licenses/by-nc/4.0/',
'CC BY-ND' => 'https://creativecommons.org/licenses/by-nd/4.0/',
'CC BY-SA' => 'https://creativecommons.org/licenses/by-sa/4.0/',
'CC BY' => 'https://creativecommons.org/licenses/by/4.0/',
'CC0' => 'https://creativecommons.org/publicdomain/zero/1.0/',
'RR-F' => 'https://www.europeana.eu/rights/rr-f/',
'RR-P' => 'https://www.europeana.eu/rights/rr-p/',
'RR-R' => 'https://www.europeana.eu/rights/rr-r/',
'Public Domain Mark' => 'https://creativecommons.org/publicdomain/mark/1.0/',
'Orphan Work' => 'https://www.europeana.eu/rights/orphan-work-eu/',
];
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDLicense
*/
public static function fromString(string $input):MDLicense {
return match($input) {
'CC BY-NC-SA' => self::CC_BY_NC_SA,
'CC BY-NC-ND' => self::CC_BY_NC_ND,
'CC BY-NC' => self::CC_BY_NC,
'CC BY-ND' => self::CC_BY_ND,
'CC BY-SA' => self::CC_BY_SA,
'CC BY' => self::CC_BY,
'CC0' => self::CC0,
'RR-F' => self::RR_F,
'RR-P' => self::RR_P,
'RR-R' => self::RR_R,
'Public Domain Mark' => self::Public_Domain_Mark,
'Orphan Work' => self::Orphan_Work,
default => throw new MDpageParameterNotFromListException("Unknown license role"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDLicense
*/
public static function fromInt(int $input):MDLicense {
return match($input) {
1 => self::CC_BY_NC_SA,
2 => self::CC_BY_NC_ND,
3 => self::CC_BY_NC,
4 => self::CC_BY_ND,
5 => self::CC_BY_SA,
6 => self::CC_BY,
7 => self::CC0,
8 => self::RR_F,
9 => self::RR_P,
10 => self::RR_R,
11 => self::Public_Domain_Mark,
12 => self::Orphan_Work,
default => throw new MDpageParameterNotFromListException("Unknown license role"),
};
}
/**
* 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 {
$output = [];
foreach (self::caseNames() as $name) $output[$name] = $name;
return $output;
}
/**
* 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 {
$output = self::getUnsortedList($tlLoader);
asort($output);
return $output;
}
/**
* 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::CC_BY_NC_SA => 1,
self::CC_BY_NC_ND => 2,
self::CC_BY_NC => 3,
self::CC_BY_ND => 4,
self::CC_BY_SA => 5,
self::CC_BY => 6,
self::CC0 => 7,
self::RR_F => 8,
self::RR_P => 9,
self::RR_R => 10,
self::Public_Domain_Mark => 11,
self::Orphan_Work => 12,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns string representation.
*
* @return string
*/
public function toString():string {
return match($this) {
self::CC_BY_NC_SA => 'CC BY-NC-SA',
self::CC_BY_NC_ND => 'CC BY-NC-ND',
self::CC_BY_NC => 'CC BY-NC',
self::CC_BY_ND => 'CC BY-ND',
self::CC_BY_SA => 'CC BY-SA',
self::CC_BY => 'CC BY',
self::CC0 => 'CC0',
self::RR_F => 'RR-F',
self::RR_P => 'RR-P',
self::RR_R => 'RR-R',
self::Public_Domain_Mark => 'Public Domain Mark',
self::Orphan_Work => 'Orphan Work',
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns the name of the current value in translation.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return string
*/
public function getTledName(MDTlLoader $tlLoader):string {
return $this->toString();
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->toString();
}
}

143
src/enums/MDLoanType.php Normal file
View File

@ -0,0 +1,143 @@
<?PHP
declare(strict_types = 1);
/**
* Represents a type of loan.
*/
enum MDLoanType implements MDValueEnumInterface, JsonSerializable {
case outgoing;
case incoming;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDLoanType
*/
public static function fromString(string $input):MDLoanType {
return match($input) {
"outgoing" => self::outgoing,
"incoming" => self::incoming,
default => throw new MDpageParameterNotFromListException("Unknown loan type"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDLoanType
*/
public static function fromInt(int $input):MDLoanType {
return match($input) {
0 => self::outgoing,
1 => self::incoming,
default => throw new MDpageParameterNotFromListException("Unknown loan 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(), "loan_types", "loan_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(), "loan_types", "loan_types");
}
/**
* 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::outgoing => 0,
self::incoming => 1,
};
}
/**
* 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("loan_types", "loan_types", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,317 @@
<?PHP
/**
* Represents a measurement type.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a measurement type.
*/
enum MDMeasurementType implements MDValueEnumInterface, JsonSerializable {
// Main types
case length;
case height;
case width;
case weight;
case diameter;
case wall;
case die_axis;
case number_of_copies; // copies, specimen
case number_of_parts;
// Sub-types
case length_socle;
case height_socle;
case width_socle;
case length_sheet_size;
case height_sheet_size;
case width_sheet_size;
case length_image_size;
case height_image_size;
case width_image_size;
case length_frame;
case height_frame;
case width_frame;
case diameter_frame;
case length_min;
case length_max;
case height_min;
case height_max;
case width_min;
case width_max;
case diameter_min;
case diameter_max;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDMeasurementType
*/
public static function fromString(string $input):MDMeasurementType {
return match($input) {
'length' => self::length,
'height' => self::height,
'width' => self::width,
'number_of_copies' => self::number_of_copies,
'weight' => self::weight,
'diameter' => self::diameter,
'wall' => self::wall,
'number_of_parts' => self::number_of_parts,
'die_axis' => self::die_axis,
'length_socle' => self::length_socle,
'height_socle' => self::height_socle,
'width_socle' => self::width_socle,
'length_sheet_size' => self::length_sheet_size,
'height_sheet_size' => self::height_sheet_size,
'width_sheet_size' => self::width_sheet_size,
'length_image_size' => self::length_image_size,
'height_image_size' => self::height_image_size,
'width_image_size' => self::width_image_size,
'length_frame' => self::length_frame,
'height_frame' => self::height_frame,
'width_frame' => self::width_frame,
'length_min' => self::length_min,
'length_max' => self::length_max,
'height_min' => self::height_min,
'height_max' => self::height_max,
'width_min' => self::width_min,
'width_max' => self::width_max,
'diameter_min' => self::diameter_min,
'diameter_max' => self::diameter_max,
'diameter_frame' => self::diameter_frame,
default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDMeasurementType
*/
public static function fromInt(int $input):MDMeasurementType {
return match($input) {
1 => self::length,
2 => self::height,
3 => self::width,
4 => self::number_of_copies,
5 => self::weight,
6 => self::diameter,
7 => self::wall,
8 => self::number_of_parts,
9 => self::die_axis,
10 => self::length_socle,
11 => self::height_socle,
12 => self::width_socle,
13 => self::length_sheet_size,
14 => self::height_sheet_size,
15 => self::width_sheet_size,
16 => self::length_image_size,
17 => self::height_image_size,
18 => self::width_image_size,
19 => self::length_frame,
20 => self::height_frame,
21 => self::width_frame,
22 => self::length_min,
23 => self::length_max,
24 => self::height_min,
25 => self::height_max,
26 => self::width_min,
27 => self::width_max,
28 => self::diameter_min,
29 => self::diameter_max,
30 => self::diameter_frame,
default => throw new MDpageParameterNotFromListException("Unknown measurement 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;
}
/**
* Returns the highest level measurement type relative to the provided one.
*
* @return MDMeasurementType
*/
public function getHighestSuperordinate():MDMeasurementType {
return match($this) {
self::length => self::length,
self::height => self::height,
self::width => self::width,
self::number_of_copies => self::number_of_copies,
self::weight => self::weight,
self::diameter => self::diameter,
self::wall => self::wall,
self::number_of_parts => self::number_of_parts,
self::die_axis => self::die_axis,
self::length_socle => self::length,
self::height_socle => self::height,
self::width_socle => self::width,
self::length_sheet_size => self::length,
self::height_sheet_size => self::height,
self::width_sheet_size => self::width,
self::length_image_size => self::length,
self::height_image_size => self::height,
self::width_image_size => self::width,
self::length_frame => self::length,
self::height_frame => self::height,
self::width_frame => self::width,
self::length_min => self::length,
self::length_max => self::length,
self::height_min => self::height,
self::height_max => self::height,
self::width_min => self::width,
self::width_max => self::width,
self::diameter_min => self::diameter,
self::diameter_max => self::diameter,
self::diameter_frame => self::diameter,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns an integer representation of the collective (for storage in DB).
*
* @return integer
*/
public function toInt():int {
return match($this) {
self::length => 1,
self::height => 2,
self::width => 3,
self::number_of_copies => 4,
self::weight => 5,
self::diameter => 6,
self::wall => 7,
self::number_of_parts => 8,
self::die_axis => 9,
self::length_socle => 10,
self::height_socle => 11,
self::width_socle => 12,
self::length_sheet_size => 13,
self::height_sheet_size => 14,
self::width_sheet_size => 15,
self::length_image_size => 16,
self::height_image_size => 17,
self::width_image_size => 18,
self::length_frame => 19,
self::height_frame => 20,
self::width_frame => 21,
self::length_min => 22,
self::length_max => 23,
self::height_min => 24,
self::height_max => 25,
self::width_min => 26,
self::width_max => 27,
self::diameter_min => 28,
self::diameter_max => 29,
self::diameter_frame => 30,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns suitable measurement type.
*
* @return class-string
*/
public function getMeasurementUnit():string {
return match($this->getHighestSuperordinate()) {
self::length,
self::height,
self::width,
self::wall,
self::diameter => MDLengthUnit::Class,
self::number_of_copies => MDCountCopiesUnit::Class,
self::weight => MDWeightUnit::Class,
self::number_of_parts => MDCountPartsUnit::Class,
self::die_axis => MDDieAxisUnit::Class,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* 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(), "measurement_type_set", "measurement_type_set");
}
/**
* 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(), "measurement_type_set", "measurement_type_set");
}
/**
* 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("measurement_type_set", "measurement_type_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,801 @@
<?PHP
/**
* Represents an external norm data repository.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents an external norm data repository.
*/
enum MDNodaRepository implements MDValueEnumInterface, JsonSerializable {
case allgemein; // General link to a good source
case aat;
case ackerbau;
case bne;
case bnf;
case cona;
case editionhumboldtdigital;
case gnd;
case grobsystematik;
case iconclass;
case klbb;
case lcsh;
case loc; // Duplicate?
case mindatorg;
case moebeltypologie;
case ndb_adb;
case ndl;
case ndp_ikmk;
case ndp_ikmk_persons;
case nomisma;
case npg;
case oberbegriffsdatei;
case orcid;
case osm;
case pim;
case pleiades;
case rkd;
case ulan;
case viaf;
case wikidata;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDNodaRepository
*/
public static function fromString(string $input):MDNodaRepository {
return match($input) {
'allgemein' => self::allgemein, // General link to a good source
'AAT-ID',
'aat' => self::aat,
'ackerbau' => self::ackerbau,
'bne' => self::bne,
'bnf' => self::bnf,
'cona' => self::cona,
'edition humboldt digital' => self::editionhumboldtdigital,
'gnd',
'GND',
'o-gnd',
'O-GND',
'GND-Identnummer',
'GND-Nummer',
'pnd',
'http://d-nb.info/', // This is technically wrong, but used in practice...
'http://d-nb.info/gnd',
'http://d-nb.info/gnd/',
'd-nb.info',
'd-nb',
'https://portal.dnb.de',
'https://explore.gnd.network/gnd/' => self::gnd,
'grobsystematik' => self::grobsystematik,
'iconclass' => self::iconclass,
'Iconclass' => self::iconclass,
'http://iconclass.org' => self::iconclass,
'https://iconclass.org' => self::iconclass,
'klbb' => self::klbb,
'kl-bb' => self::klbb,
'lcsh' => self::lcsh,
'loc' => self::loc, // Duplicate?
'mindat.org' => self::mindatorg,
'moebeltypologie' => self::moebeltypologie,
'ndb/adb',
'NDB/ADB' => self::ndb_adb,
'ndl' => self::ndl,
'ndp-ikmk' => self::ndp_ikmk,
'ndp-ikmk-persons' => self::ndp_ikmk_persons,
'nomisma',
'nomisma.org' => self::nomisma,
'npg' => self::npg,
'oberbegriffsdatei' => self::oberbegriffsdatei,
'orcid' => self::orcid,
'osm' => self::osm,
'pim' => self::pim,
'pleiades' => self::pleiades,
'rkd' => self::rkd,
'ulan' => self::ulan,
'ULAN' => self::ulan,
'viaf',
'VIAF' => self::viaf,
'wikidata',
'Wikidata',
'www.wikidata.org',
'WIKIDATA' => self::wikidata,
default => throw new MDpageParameterNotFromListException("Unknown norm data repository: '" . $input . "'"),
};
}
/**
* Attempts to get a repository based on a provided link. This function is rather expensive
* and should be avoided as much as possible.
*
* @param string $input Input to get a value from.
*
* @return MDNodaRepository
*/
public static function fromUrl(string $input):MDNodaRepository {
$cases = self::cases();
foreach ($cases as $case) {
if ($case === self::allgemein) continue;
$output = $case->validateId($input);
if ($output !== false) return $case;
}
throw new MDInvalidNodaLink("Failed to get norm data repository based on the provided link");
}
/**
* Returns the name as stored in the DB.
*
* @return string
*/
public function toDbName():string {
return match($this) {
self::allgemein => 'allgemein', // General link to a good source
self::aat => 'aat',
self::ackerbau => 'ackerbau',
self::bne => 'bne',
self::bnf => 'bnf',
self::cona => 'cona',
self::editionhumboldtdigital => 'edition humboldt digital',
self::gnd => 'gnd',
self::grobsystematik => 'grobsystematik',
self::iconclass => 'iconclass',
self::klbb => 'kl-bb',
self::lcsh => 'lcsh',
self::loc => 'loc',
self::mindatorg => 'mindat.org',
self::moebeltypologie => 'moebeltypologie',
self::ndb_adb => 'NDB/ADB',
self::ndl => 'ndl',
self::ndp_ikmk => 'ndp-ikmk',
self::ndp_ikmk_persons => 'ndp-ikmk-persons',
self::nomisma => 'nomisma',
self::npg => 'npg',
self::oberbegriffsdatei => 'oberbegriffsdatei',
self::orcid => 'orcid',
self::osm => 'osm',
self::pim => 'pim',
self::pleiades => 'pleiades',
self::rkd => 'rkd',
self::ulan => 'ulan',
self::viaf => 'viaf',
self::wikidata => 'wikidata',
};
}
/**
* Returns the name as stored in the DB.
*
* @return string
*/
public function toFullName():string {
return match($this) {
self::allgemein => 'General', // General link to a good source
self::aat => 'Art & Architecture Thesaurus (AAT)',
self::ackerbau => 'Ackerbau-Thesaurus',
self::bne => 'Biblioteca Nacional de España (BNE)',
self::bnf => 'Bibliothèque nationale de France (BNF)',
self::cona => 'Cultural Objects Name Authority (CONA)',
self::editionhumboldtdigital => 'Edition Humboldt Digital',
self::gnd => 'GND (Gemeinsame Normdatei)',
self::grobsystematik => 'Grobsystematik',
self::iconclass => 'Iconclass',
self::klbb => 'Berlin-Brandenburgisches Künstlerlexikon',
self::lcsh => 'Library of Congress Subject Headings (LCSH)',
self::loc => 'Library of Congress (LOC)',
self::mindatorg => 'mindat.org',
self::moebeltypologie => 'Möbeltypologie',
self::ndb_adb => 'Neue / Allgemeine Deutsche Biographie',
self::ndl => 'National Diet Library, Japan (NDL)',
self::ndp_ikmk => 'IKMK (Places)',
self::ndp_ikmk_persons => 'IKMK (Persons)',
self::nomisma => 'Nomisma',
self::npg => 'National Portrait Gallery',
self::oberbegriffsdatei => 'Oberbegriffsdatei',
self::orcid => 'ORCID (Open Researcher and Contributor ID)',
self::osm => 'OpenStreetMap',
self::pim => 'Petőfi Irodalmi Múzeum',
self::pleiades => 'Pleiades',
self::rkd => 'RKDartists ID',
self::ulan => 'Union List of Artist Names',
self::viaf => 'VIAF (Virtual International Authority File)',
self::wikidata => 'Wikidata',
};
}
/**
* Returns the URL prefix for the current repository.
*
* @return string
*/
public function getUrlPrefix():string {
return match($this) {
self::allgemein => '',
self::aat => 'https://vocab.getty.edu/page/aat/',
self::ackerbau => 'https://term.museum-digital.de/ackerbau/tag/',
self::bne => 'http://datos.bne.es/persona/',
self::bnf => "https://catalogue.bnf.fr/ark:/12148/cb",
self::cona => 'https://vocab.getty.edu/page/cona/',
self::editionhumboldtdigital => 'https://edition-humboldt.de/register/personen/detail.xql?normid=http://d-nb.info/gnd/',
self::gnd => 'https://d-nb.info/gnd/',
self::grobsystematik => 'https://term.museum-digital.de/grobsystematik/tag/',
self::iconclass => 'http://iconclass.org/rkd/',
self::klbb => 'https://www.kl-bb.de/artist/',
self::lcsh => 'http://id.loc.gov/authorities/names/',
self::loc => 'http://id.loc.gov/authorities/names/',
self::mindatorg => 'https://www.mindat.org/min-', // Has suffix
self::moebeltypologie => 'https://term.museum-digital.de/moebel/tag/',
self::ndb_adb => 'https://www.deutsche-biographie.de/pnd',
self::ndl => 'https://id.ndl.go.jp/auth/ndlna/',
self::ndp_ikmk => 'https://ikmk.smb.museum/ndp/',
self::ndp_ikmk_persons => 'https://ikmk.smb.museum/ndp/person/',
self::nomisma => 'http://nomisma.org/id/',
self::npg => 'https://www.npg.org.uk/collections/search/person/',
self::oberbegriffsdatei => 'https://term.museum-digital.de/oberbegriffsdatei/tag/',
self::orcid => 'https://orcid.org/',
self::osm => 'https://www.openstreetmap.org/relation/',
self::pim => 'https://opac-nevter.pim.hu/en/record/-/record/',
self::pleiades => 'https://pleiades.stoa.org/places/',
self::rkd => 'https://rkd.nl/explore/artists/',
self::ulan => 'https://vocab.getty.edu/page/ulan/',
self::viaf => 'https://viaf.org/viaf/',
self::wikidata => 'https://www.wikidata.org/entity/',
};
}
/**
* Returns the base of the repository's entity page URLs.
*
* @param string $id Identifier to link to.
*
* @return string
*/
public function getEntityLink(string $id):string {
return match ($this) {
self::ndb_adb => 'https://www.deutsche-biographie.de/pnd' . $id . '.html',
self::mindatorg => 'https://www.mindat.org/min-' . $id . '.html',
default => $this->getUrlPrefix() . $id,
};
}
/**
* Returns a link to search for a given search term.
*
* @param string $searchTerm Search term.
*
* @return string
*/
public function getSearchLink(string $searchTerm):string {
return match($this) {
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&note=',
self::ackerbau => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|ackerbau',
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::cona => 'http://vocab.getty.edu/page/cona/' . urlencode($searchTerm),
self::editionhumboldtdigital => 'https://edition-humboldt.de/suche/ergebnisRegistersuche.xql?indexType=&q_text=' . urlencode($searchTerm),
self::gnd => 'https://explore.gnd.network/search?term=' . urlencode($searchTerm),
self::grobsystematik => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|grobsystematik',
self::iconclass => 'http://iconclass.org/rkd/48C51/?q=' . urlencode($searchTerm) . '&q_s=1',
self::lcsh => 'https://id.loc.gov/search/?q=cs:http://id.loc.gov/authorities/subjects&q=' . urlencode($searchTerm),
self::klbb => 'https://www.kl-bb.de/gezielte-suche?page=gezielte-suche&artist_name=' . urlencode($searchTerm),
self::loc => 'http://id.loc.gov/authorities/names/' . urlencode($searchTerm),
self::mindatorg => 'https://www.mindat.org/search.php?search=' . urlencode($searchTerm) . '&q_s=1',
self::moebeltypologie => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|moebel',
self::ndb_adb => 'https://www.deutsche-biographie.de/search?name=' . urlencode($searchTerm),
self::ndl => 'https://id.ndl.go.jp/auth/ndlna/' . urlencode($searchTerm),
self::ndp_ikmk => 'https://ikmk.smb.museum/ndp/list?lang=de&q=' . urlencode($searchTerm),
self::ndp_ikmk_persons => 'https://ikmk.smb.museum/ndp/list?lang=de&q=' . urlencode($searchTerm),
self::nomisma => 'http://nomisma.org/browse?q=' . urlencode($searchTerm),
self::npg => 'https://www.npg.org.uk/collections/search/person/' . urlencode($searchTerm),
self::oberbegriffsdatei => 'https://term.museum-digital.de/redir.php?search=' . urlencode($searchTerm) . '&kind=tag|oberbegriffsdatei',
self::orcid => 'https://orcid.org/' . urlencode($searchTerm),
self::osm => 'https://www.openstreetmap.org/relation/' . urlencode($searchTerm),
self::pim => 'https://opac-nevter.pim.hu/en/record/-/results/' . urlencode($searchTerm),
self::pleiades => 'https://pleiades.stoa.org/search?SearchableText=' . urlencode($searchTerm),
self::rkd => 'https://rkd.nl/en/explore#query=' . urlencode($searchTerm),
self::ulan => 'http://www.getty.edu/vow/ULANServlet?english=Y&find=' . urlencode($searchTerm) . '&role=&page=1&nation=',
self::viaf => 'https://viaf.org/viaf/search?query=local.names+all+' . urlencode('"' . $searchTerm . '"') . '"&sortKeys=holdingscount&recordSchema=BriefVIAF',
self::wikidata => 'https://www.wikidata.org/w/index.php?search=&search=' . urlencode($searchTerm) . '&ns0=1&ns120=1',
};
}
/**
* Extension of PHP's built-in is_numeric() that also supports large numbers.
*
* @param string $value Input to check.
*
* @return boolean
*/
private static function _is_numeric(string $value):bool {
// Strings starting with 0 are quite often linked, notably with the NDL.
// PHP's FILTER_VALIDATE_INT does not accept a leading 0 however, so it
// is stripped before checking.
if (filter_var(ltrim($value, '0'), FILTER_VALIDATE_INT) !== false) {
return true;
}
// FILTER_VALIDATE_INT fails on overly large IDs (e.g. VIAF IDs having
// more than 20 digits).
// In these cases, simply check for the existence of non-numeric characters.
if (strlen($value) > 9) {
if (empty(trim($value, '0123456789'))) {
return true;
}
}
return false;
}
/**
* Validates a numeric ID, returning a string or false.
*
* @param string $id ID to validate.
* @param string[] $prefixes Prefixes to strip off.
*
* @return string|false
*/
private static function validateNumericId(string $id, array $prefixes):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$toRemove = [];
foreach ($prefixes as $prefix) {
$toRemove[$prefix] = "";
}
$id = trim(strtr($id, $toRemove), '/');
}
if (!self::_is_numeric($id)) {
return false;
}
return $id;
}
/**
* Validates a iconclass ID, returning a string or false.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateIconclassId(string $id):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$id = strtr($id, ['http://iconclass.org/rkd/' => '', 'http://iconclass.org/' => '', 'https://iconclass.org/' => '']);
}
if (preg_match("/^[0-9a-z\/]*$/", $id) === false) return false;
return $id;
}
/**
* 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.
*
* @param string $id ID to validate.
* @param string[] $prefixes Prefixes to strip off.
*
* @return string|false
*/
private static function validateBneId(string $id, array $prefixes):string|false {
return self::validateGndId($id, $prefixes);
}
/**
* Validates a GND ID, returning a string or false.
*
* @param string $id ID to validate.
* @param string[] $prefixes Prefixes to strip off.
*
* @return string|false
*/
private static function validateGndId(string $id, array $prefixes):string|false {
if (str_contains($id, ' ')) {
$id = strtr($id, [' ' => '', "\t" => '']);
}
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$toRemove = [];
foreach ($prefixes as $prefix) $toRemove[$prefix] = "";
$id = strtr($id, $toRemove);
}
// There is an issue with this regex
if (preg_match("/^[0-9-X]*$/", $id) === false) {
return false;
}
if (self::_is_numeric(strtr($id, ['-' => '', 'X' => ''])) === false) {
return false;
}
return $id;
}
/**
* Validates a Library of Congress name ID, returning a string or false.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateLocId(string $id):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$id = strtr($id, [
'http://id.loc.gov/authorities/names/' => '',
'https://id.loc.gov/authorities/names/' => '',
'http://id.loc.gov/authorities/subjects/' => '',
'https://id.loc.gov/authorities/subjects/' => '',
]);
}
if (in_array(substr($id, 0, 2), ['nr', 'nb', 'no'], true)) {
if (filter_var(trim(substr($id, 2), '0'), FILTER_VALIDATE_INT) === false) return false;
}
else if (substr($id, 0, 1) === 'n') {
if (filter_var(trim(substr($id, 1), '0'), FILTER_VALIDATE_INT) === false) return false;
}
else if (substr($id, 0, 2) === 'sh') {
throw new MDInvalidNodaLinkLocIdIsSh("The link to the Library of Congress authority files refers to the LOC Subject Headings. The subject headings are listed as a separate vocabulary.");
}
else throw new MDInvalidNodaLinkException("LOC IDs must start with n or nr or nb (provided: " . strip_tags($id) . ")");
return (string)$id;
}
/**
* Validates a LCSH ID, returning a string or false.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateLcshId(string $id):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$id = strtr($id, [
'http://id.loc.gov/authorities/names/' => '',
'https://id.loc.gov/authorities/names/' => '',
'http://id.loc.gov/authorities/subjects/' => '',
'https://id.loc.gov/authorities/subjects/' => '',
'.html' => '',
]);
}
if (substr($id, 0, 2) !== 'sh') {
if (str_starts_with(substr($id, 0, 1), 'n')) {
throw new MDInvalidNodaLinkLcshIdIsGeneralLoc("LCSH IDs must start with sh. ID started with n. Use general LOC link instead.");
}
throw new MDInvalidNodaLinkException("LCSH IDs must start with sh. ID provided is: " . $id);
}
if (filter_var(ltrim(substr($id, 2), "0"), FILTER_VALIDATE_INT) === false) {
return false;
}
return $id;
}
/**
* Validates an NDP-IKMK ID. The IKMK vocabularies for places are actually quite
* numerous, identifying places, countries, regions separately.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateNdpIkmkForPlaces(string $id):string|false {
$id = str_replace("https://ikmk.smb.museum/ndp/", "", trim($id, '/'));
$parts = explode('/', $id);
if (count($parts) !== 2) {
return false;
}
if (!in_array($parts[0], ['ort', 'land', 'region'], true)) {
return false;
}
// There is an issue with this regex
if (self::_is_numeric($parts[1]) === false) {
return false;
}
return $parts[0] . '/' . $parts[1];
}
/**
* Validates OrCID IDs.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateOrcidId(string $id):string|false {
$id = strtr(trim($id, '/'), [
"http://orcid.org/" => "",
"https://orcid.org/" => "",
]);
return preg_match('/^[0-9]{4}-[0-9]{4}-[0-9]{4}-[0-9]{4}$/', $id) ? $id : false;
}
/**
* Validates a PIM ID, returning a string or false.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validatePimId(string $id):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$toRemove = [];
foreach ([
'https://opac-nevter.pim.hu/en/record/-/record/',
'https://resolver.pim.hu/auth/',
] as $prefix) {
$toRemove[$prefix] = "";
}
$id = strtr($id, $toRemove);
}
// There is an issue with this regex
if (preg_match("/^[0-9-PIM]*$/", $id) === false) {
return false;
}
if (self::_is_numeric(substr($id, 3)) === false) {
return false;
}
return $id;
}
/**
* Validates an NPG ID, returning a string or false.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateNpgId(string $id):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$id = strtr($id, ['https://www.npg.org.uk/collections/search/person/' => '']);
}
if (substr($id, 0, 2) === 'mp' && self::_is_numeric(substr($id, 2))) {
return $id;
}
if (self::_is_numeric($id) === false) {
return false;
}
return $id;
}
/**
* Validates a wikidata ID, returning a string or false.
*
* @param string $id ID to validate.
*
* @return string|false
*/
private static function validateWikidataId(string $id):string|false {
if (filter_var($id, FILTER_VALIDATE_URL) !== false) {
$id = strtr($id, [
'http://www.wikidata.org/wiki/' => '',
'http://www.wikidata.org/entity/' => '',
'https://www.wikidata.org/wiki/' => '',
'https://www.wikidata.org/entity/' => '',
'https://www.wikidata.org/w/index.php?search=&search=' => '',
]);
if (str_starts_with($id, 'https://www.wikidata.org/w/index.php?title=')) {
$id = str_replace('https://www.wikidata.org/w/index.php?title=', '', $id);
if (($endPos = strpos($id, '&')) !== false) {
$id = substr($id, 0, $endPos);
}
}
}
if (substr($id, 0, 1) !== 'Q') {
throw new MDInvalidNodaLinkException("Wikidata IDs must be Q IDs - and start with that letter (provided: $id)");
}
if (self::_is_numeric(substr($id, 1)) === false) {
return false;
}
return $id;
}
/**
* Validates a BNF ID. BNF IDs are either fully numeric or end on a single non-numeric character.
*
* @param string $id ID to validate.
*
* @return string|false
*/
public static function validateBnfId(string $id):string|false {
if (!is_numeric(substr($id, -1))) {
$validation = self::validateNumericId(substr($id, 0, -1), ["https://catalogue.bnf.fr/ark:/12148/cb"]);
}
else $validation = self::validateNumericId($id, ["https://catalogue.bnf.fr/ark:/12148/cb"]);
if ($validation === false) return false;
return $id;
}
/**
* Validates an ID.
*
* @param string $id Identifier to link to.
*
* @return string|false
*/
public function validateId(string $id):string|false {
return match($this) {
self::allgemein => filter_var($id, FILTER_VALIDATE_URL),
self::aat => self::validateNumericId($id, [
'http://vocab.getty.edu/aat/',
'http://vocab.getty.edu/page/aat/',
'https://vocab.getty.edu/aat/',
'https://vocab.getty.edu/page/aat/',
]),
self::ackerbau => self::validateNumericId($id, ['https://term.museum-digital.de/ackerbau/tag/']),
self::bne => self::validateBneId($id, ['http://datos.bne.es/persona/', 'https://datos.bne.es/persona/']),
self::bnf => self::validateBnfId($id),
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::gnd => self::validateGndId($id, ['http://d-nb.info/gnd/', 'https://d-nb.info/gnd/', 'https://explore.gnd.network/gnd/']),
self::grobsystematik => self::validateNumericId($id, ['https://term.museum-digital.de/grobsystematik/tag/']),
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::lcsh => self::validateLcshId($id),
self::loc => self::validateLocId($id),
self::mindatorg => self::validateNumericId($id, ['https://www.mindat.org/min-', '.html']),
self::moebeltypologie => self::validateNumericId($id, ['https://term.museum-digital.de/moebel/tag/']),
self::ndb_adb => self::validateGndId($id, ['https://www.deutsche-biographie.de/pnd', '.html', '#adbcontent', '#ndbcontent', '#indexcontent']),
self::ndl => self::validateNumericId($id, [
'http://id.ndl.go.jp/auth/ndlna/',
'https://id.ndl.go.jp/auth/ndlna/',
]),
self::ndp_ikmk => self::validateNdpIkmkForPlaces($id),
self::ndp_ikmk_persons => self::validateNumericId($id, ['https://ikmk.smb.museum/ndp/person/']),
self::nomisma => str_replace('http://nomisma.org/id/', '', $id),
self::npg => self::validateNpgId($id),
self::oberbegriffsdatei => self::validateNumericId($id, ['https://term.museum-digital.de/oberbegriffsdatei/tag/']),
self::orcid => self::validateOrcidId($id),
self::osm => self::validateNumericId($id, ['https://www.openstreetmap.org/relation/']),
self::pim => self::validatePimId($id),
self::pleiades => self::validateNumericId($id, ['https://pleiades.stoa.org/places/']),
self::rkd => self::validateNumericId($id, ['http://rkd.nl/explore/artists/', 'https://rkd.nl/explore/artists/']),
self::ulan => self::validateNumericId($id, [
'http://vocab.getty.edu/ulan/',
'http://vocab.getty.edu/page/ulan/',
'https://vocab.getty.edu/page/ulan/',
'http://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid=',
'https://www.getty.edu/vow/ULANFullDisplay?find=&role=&nation=&subjectid=',
]),
self::viaf => self::validateNumericId($id, [
'https://viaf.org/viaf/',
'http://viaf.org/viaf/',
]),
self::wikidata => self::validateWikidataId($id),
};
}
/**
* 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(), "attendance_status_set", "attendance_status_set");
}
/**
* 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(), "attendance_status_set", "attendance_status_set");
}
/**
* 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("attendance_status_set", "attendance_status_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,103 @@
<?PHP
/**
* Represents a type of check an object may be subject to (completeness, condition, general audit).
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of check an object may be subject to (completeness, condition, general audit).
*/
enum MDObjectCheckType implements MDValueEnumInterface, JsonSerializable {
case condition_check;
case completeness_check;
case data_correctness_check;
case location_accuracy_check;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDObjectCheckType
*/
public static function fromString(string $input):MDObjectCheckType {
return match($input) {
'condition_check' => self::condition_check,
'completeness_check' => self::completeness_check,
'data_correctness_check' => self::data_correctness_check,
'location_accuracy_check' => self::location_accuracy_check,
default => throw new MDpageParameterNotFromListException("Unknown check 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(), "object_check_types_set", "object_check_types_set");
}
/**
* 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(), "object_check_types_set", "object_check_types_set");
}
/**
* 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("object_check_types_set", "object_check_types_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,107 @@
<?PHP
/**
* Represents a type of status that can be assigned to an object in the process
* from identification to fixing or recognizing it is permanent.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of status that can be assigned to an object in the process
* from identification to fixing or recognizing it is permanent.
*/
enum MDObjectDamageStatus implements MDValueEnumInterface, JsonSerializable {
case identified;
case repair_possible;
case repair_scheduled; // By conservator
case repaired;
case irreparable;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDObjectDamageStatus
*/
public static function fromString(string $input):MDObjectDamageStatus {
return match($input) {
'identified' => self::identified,
'repair_possible' => self::repair_possible,
'repair_scheduled' => self::repair_scheduled,
'repaired' => self::repaired,
'irreparable' => self::irreparable,
default => throw new MDpageParameterNotFromListException("Unknown damage 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(), "object_damage_status_set", "object_damage_status_set");
}
/**
* 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(), "object_damage_status_set", "object_damage_status_set");
}
/**
* 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("object_damage_status_set", "object_damage_status_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,101 @@
<?PHP
/**
* Represents a type of damage an object may be subject to.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of damage an object may be subject to.
*/
enum MDObjectDamageType implements MDValueEnumInterface, JsonSerializable {
case water_damage;
case breakage;
case desiccation;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDObjectDamageType
*/
public static function fromString(string $input):MDObjectDamageType {
return match($input) {
'water_damage' => self::water_damage,
'breakage' => self::breakage,
'desiccation' => self::desiccation,
default => throw new MDpageParameterNotFromListException("Unknown damage 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(), "object_damage_types_set", "object_damage_types_set");
}
/**
* 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(), "object_damage_types_set", "object_damage_types_set");
}
/**
* 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("object_damage_types_set", "object_damage_types_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,169 @@
<?PHP
/**
* Represents a type of document published alongside an object.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of document published alongside an object.
*/
enum MDObjectDocumentType implements MDValueEnumInterface, JsonSerializable {
case undefined;
case provenance_report;
case purchase_contract;
case restoration_report;
case assessment;
case correspondence;
case legacy_documentation;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDObjectDocumentType
*/
public static function fromString(string $input):MDObjectDocumentType {
return match($input) {
"undefined" => self::undefined,
"provenance_report" => self::provenance_report,
"purchase_contract" => self::purchase_contract,
"restoration_report" => self::restoration_report,
"assessment" => self::assessment,
"correspondence" => self::correspondence,
"legacy_documentation" => self::legacy_documentation,
default => throw new MDpageParameterNotFromListException("Unknown document type"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDObjectDocumentType
*/
public static function fromInt(int $input):MDObjectDocumentType {
return match($input) {
0 => self::undefined,
1 => self::provenance_report,
2 => self::purchase_contract,
3 => self::restoration_report,
4 => self::assessment,
5 => self::correspondence,
6 => self::legacy_documentation,
default => throw new MDpageParameterNotFromListException("Unknown document 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(), "object_document_type_set", "object_document_type_set");
}
/**
* 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(), "object_document_type_set", "object_document_type_set");
}
/**
* 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::undefined => 0,
self::provenance_report => 1,
self::purchase_contract => 2,
self::restoration_report => 3,
self::assessment => 4,
self::correspondence => 5,
self::legacy_documentation => 6,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("object_document_type_set", "object_document_type_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,221 @@
<?PHP
/**
* Represents a status an object record is currently in, e.g. for determining
* whether the object record can be edited or is locked.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of link between tag and object (e.g. the tag being the object
* type, a material used for creating the object, etc.).
*/
enum MDObjectRecordStatus implements MDValueEnumInterface, JsonSerializable {
case unlocked;
case locked;
case revision;
case archived;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDObjectRecordStatus
*/
public static function fromString(string $input):MDObjectRecordStatus {
return match($input) {
'unlocked' => self::unlocked,
'locked' => self::locked,
'revision' => self::revision,
'archived' => self::archived,
default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDObjectRecordStatus
*/
public static function fromInt(int $input):MDObjectRecordStatus {
return match($input) {
0 => self::unlocked,
1 => self::locked,
2 => self::revision,
3 => self::archived,
default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns the default status.
*
* @return MDObjectRecordStatus
*/
public static function getDefault():MDObjectRecordStatus {
return self::unlocked;
}
/**
* 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;
}
/**
* 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::unlocked => 0,
self::locked => 1,
self::revision => 2,
self::archived => 3,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns string representation of object record status.
*
* @return string
*/
public function toString():string {
return match($this) {
self::unlocked => "unlocked",
self::locked => "locked",
self::revision => "revision",
self::archived => "archived",
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns CSS icon class for record status.
*
* @return string
*/
public function toCssIconClass():string {
return match($this) {
self::unlocked => "iconsLockOpen",
self::locked => "iconsLock",
self::revision => "iconsFolderDelete",
self::archived => "iconsEmojiSymbols",
// default => throw new MDpageParameterNotFromListException("Unknown tag relation type"),
};
}
/**
* 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(), "object_record_status", "object_record_status");
}
/**
* 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(), "object_record_status", "object_record_status");
}
/**
* 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("object_record_status", "object_record_status", $this->name);
}
/**
* Returns whether the status permits an updating of the object record.
*
* @return boolean
*/
public function checkWritingIsEnabled():bool {
return match($this) {
self::unlocked => true,
self::locked => false,
self::revision => false,
self::archived => false,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

138
src/enums/MDProcessType.php Normal file
View File

@ -0,0 +1,138 @@
<?PHP
/**
* Represents a possible type of internal processes in a museum.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a possible type of internal processes in a museum.
*/
enum MDProcessType implements MDValueEnumInterface, JsonSerializable {
case project;
case grant_application;
case exhibition;
case appointment; // This is MD's internally used name for events at the museum
case loan_incoming;
case loan_outgoing;
case employment_ad;
case purchase;
case deaccession;
case construction;
case pest_control_campaign;
case pr_campaign;
case relocation;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDProcessType
*/
public static function fromString(string $input):MDProcessType {
return match($input) {
'project' => self::project,
'grant_application' => self::grant_application,
'exhibition' => self::exhibition,
'appointment' => self::appointment,
'loan_incoming' => self::loan_incoming,
'loan_outgoing' => self::loan_outgoing,
'employment_ad' => self::employment_ad,
'purchase' => self::purchase,
'deaccession' => self::deaccession,
'construction' => self::construction,
'pest_control_campaign' => self::pest_control_campaign,
'pr_campaign' => self::pr_campaign,
'relocation' => self::relocation,
default => throw new MDpageParameterNotFromListException("Unknown process 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>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array {
return MDValueSet::getTlUnsortedList($tlLoader, self::caseNames(), "process_types", "process_types");
}
/**
* 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 MDValueSet::getTlSortedList($tlLoader, self::caseNames(), "process_types", "process_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("process_types", "process_types", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
/**
* Determines if there is a dedicated data type for the present process type in md.
*
* @return boolean
*/
public function hasOwnProcessType():bool {
return match ($this) {
self::exhibition => true,
self::appointment => true,
self::loan_incoming => true,
self::loan_outgoing => true,
default => false,
};
}
}

View File

@ -0,0 +1,221 @@
<?PHP
/**
* Represents a type of contribution to an object group.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of contribution to an object group.
*/
enum MDSeriesContributorRole implements MDValueEnumInterface, JsonSerializable {
case author;
case director;
case dramaturg;
case production_designer;
case costumer;
case musician;
case choreographer;
case make_up_artist;
case speech_trainer;
case puppet_maker;
case technician;
case inspector;
case assistant;
case actor;
case painter;
case creator;
case equipment_supplier;
case contributing_institution;
case event_organizer;
case movement_trainer;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDSeriesContributorRole
*/
public static function fromString(string $input):MDSeriesContributorRole {
return match($input) {
"author" => self::author,
"director" => self::director,
"dramaturg" => self::dramaturg,
"production_designer" => self::production_designer,
"costumer" => self::costumer,
"musician" => self::musician,
"choreographer" => self::choreographer,
"make_up_artist" => self::make_up_artist,
"speech_trainer" => self::speech_trainer,
"puppet_maker" => self::puppet_maker,
"technician" => self::technician,
"inspector" => self::inspector,
"assistant" => self::assistant,
"actor" => self::actor,
"painter" => self::painter,
"creator" => self::creator,
"equipment_supplier" => self::equipment_supplier,
"contributing_institution" => self::contributing_institution,
"event_organizer" => self::event_organizer,
"movement_trainer" => self::movement_trainer,
default => throw new MDpageParameterNotFromListException("Unknown series contributor role"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDSeriesContributorRole
*/
public static function fromInt(int $input):MDSeriesContributorRole {
return match($input) {
0 => self::author,
1 => self::director,
2 => self::dramaturg,
3 => self::production_designer,
4 => self::costumer,
5 => self::musician,
6 => self::choreographer,
7 => self::make_up_artist,
8 => self::speech_trainer,
9 => self::puppet_maker,
10 => self::technician,
11 => self::inspector,
12 => self::assistant,
13 => self::actor,
14 => self::painter,
15 => self::creator,
16 => self::equipment_supplier,
17 => self::contributing_institution,
18 => self::event_organizer,
19 => self::movement_trainer,
default => throw new MDpageParameterNotFromListException("Unknown series 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(), "series_contributor_role", "series_contributor_role");
}
/**
* 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(), "series_contributor_role", "series_contributor_role");
}
/**
* 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::author => 0,
self::director => 1,
self::dramaturg => 2,
self::production_designer => 3,
self::costumer => 4,
self::musician => 5,
self::choreographer => 6,
self::make_up_artist => 7,
self::speech_trainer => 8,
self::puppet_maker => 9,
self::technician => 10,
self::inspector => 11,
self::assistant => 12,
self::actor => 13,
self::painter => 14,
self::creator => 15,
self::equipment_supplier => 16,
self::contributing_institution => 17,
self::event_organizer => 18,
self::movement_trainer => 19,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("series_contributor_role", "series_contributor_role", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,153 @@
<?PHP
/**
* Represents a type of place related to an object group.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of place related to an object group.
*/
enum MDSeriesPlaceRole implements MDValueEnumInterface, JsonSerializable {
case place_of_production;
case performance_space;
case rehearsal_space;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDSeriesPlaceRole
*/
public static function fromString(string $input):MDSeriesPlaceRole {
return match($input) {
"place_of_production" => self::place_of_production,
"performance_space" => self::performance_space,
"rehearsal_space" => self::rehearsal_space,
default => throw new MDpageParameterNotFromListException("Unknown series place role"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDSeriesPlaceRole
*/
public static function fromInt(int $input):MDSeriesPlaceRole {
return match($input) {
0 => self::place_of_production,
1 => self::performance_space,
2 => self::rehearsal_space,
default => throw new MDpageParameterNotFromListException("Unknown series place 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(), "series_place_role", "series_place_role");
}
/**
* 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(), "series_place_role", "series_place_role");
}
/**
* 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::place_of_production => 0,
self::performance_space => 1,
self::rehearsal_space => 2,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("series_place_role", "series_place_role", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,149 @@
<?PHP
/**
* Represents a type of time related to an object group.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of time related to an object group.
*/
enum MDSeriesTimeRole implements MDValueEnumInterface, JsonSerializable {
case premiere;
case time_of_presentation;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDSeriesTimeRole
*/
public static function fromString(string $input):MDSeriesTimeRole {
return match($input) {
"premiere" => self::premiere,
"time_of_presentation" => self::time_of_presentation,
default => throw new MDpageParameterNotFromListException("Unknown series time role"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDSeriesTimeRole
*/
public static function fromInt(int $input):MDSeriesTimeRole {
return match($input) {
0 => self::premiere,
1 => self::time_of_presentation,
default => throw new MDpageParameterNotFromListException("Unknown series time 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(), "series_time_role", "series_time_role");
}
/**
* 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(), "series_time_role", "series_time_role");
}
/**
* 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::premiere => 0,
self::time_of_presentation => 1,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("series_time_role", "series_time_role", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,174 @@
<?PHP
/**
* Represents a type of link between tag and object (e.g. the tag being the object
* type, a material used for creating the object, etc.).
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of link between tag and object (e.g. the tag being the object
* type, a material used for creating the object, etc.).
*/
enum MDTagRelationType implements MDValueEnumInterface, JsonSerializable {
case tag;
case object_type;
case material;
case technique;
case display_subject;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDTagRelationType
*/
public static function fromString(string $input):MDTagRelationType {
return match($input) {
'tag' => self::tag,
'object_type' => self::object_type,
'material' => self::material,
'technique' => self::technique,
'display_subject' => self::display_subject,
default => throw new MDpageParameterNotFromListException("Unknown tag relation type"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDTagRelationType
*/
public static function fromInt(int $input):MDTagRelationType {
return match($input) {
0 => self::tag,
1 => self::object_type,
2 => self::material,
3 => self::technique,
4 => self::display_subject,
default => throw new MDpageParameterNotFromListException("Unknown tag relation type"),
};
}
/**
* Returns the default status.
*
* @return MDTagRelationType
*/
public static function getDefault():MDTagRelationType {
return self::tag;
}
/**
* 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;
}
/**
* 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 tag relations.
*
* @return integer
*/
public function toInt():int {
return match($this) {
self::tag => 0,
self::object_type => 1,
self::material => 2,
self::technique => 3,
self::display_subject => 4,
// default => throw new MDpageParameterNotFromListException("Unknown tag relation type"),
};
}
/**
* 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(), "tag_relation_type", "tag_relation_type");
}
/**
* 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(), "tag_relation_type", "tag_relation_type");
}
/**
* 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("tag_relation_type", "tag_relation_type", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,101 @@
<?PHP
/**
* Represents timing intervals for autogenerated exports etc.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents timing intervals for autogenerated exports etc.
*/
enum MDTimingInterval implements MDValueEnumInterface, JsonSerializable {
case weekly;
case monthly;
case annual;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDTimingInterval
*/
public static function fromString(string $input):MDTimingInterval {
return match($input) {
'weekly' => self::weekly,
'monthly' => self::weekly,
'annual' => self::weekly,
default => throw new MDpageParameterNotFromListException("Unknown timing interval: " . $input),
};
}
/**
* 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(), "timing_intervals_set", "timing_intervals_set");
}
/**
* 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(), "timing_intervals_set", "timing_intervals_set");
}
/**
* 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("timing_intervals_set", "timing_intervals_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

105
src/enums/MDTodoStatus.php Normal file
View File

@ -0,0 +1,105 @@
<?PHP
/**
* Represents a possible status for to-dos.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a possible status for to-dos.
*/
enum MDTodoStatus implements MDValueEnumInterface, JsonSerializable {
case suggested;
case planned;
case in_progress;
case done;
case cancelled;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDTodoStatus
*/
public static function fromString(string $input):MDTodoStatus {
return match($input) {
'suggested' => self::suggested,
'planned' => self::planned,
'in_progress' => self::in_progress,
'done' => self::done,
'cancelled' => self::cancelled,
default => throw new MDpageParameterNotFromListException("Unknown todo 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(), "todo_status", "todo_status");
}
/**
* 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(), "todo_status", "todo_status");
}
/**
* 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("todo_status", "todo_status", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,112 @@
<?PHP
/**
* Represents a method of transportation for objects.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a method of transportation for objects.
*/
enum MDTransportMethod implements MDValueEnumInterface, JsonSerializable {
case unknown;
case car;
case ship;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDTransportMethod
*/
public static function fromString(string $input):MDTransportMethod {
return match($input) {
'unknown' => self::unknown,
'car' => self::car,
'ship' => self::ship,
default => throw new MDpageParameterNotFromListException("Unknown shipment status"),
};
}
/**
* Returns the default status.
*
* @return MDTransportMethod
*/
public static function getDefault():MDTransportMethod {
return self::unknown;
}
/**
* 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(), "shipment_method_set", "shipment_method_set");
}
/**
* 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(), "shipment_method_set", "shipment_method_set");
}
/**
* 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("shipment_method_set", "shipment_method_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,51 @@
<?PHP
/**
* Lists the types of external conditions put upon user accounts in the md context.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Lists the types of external conditions put upon user accounts in the md context.
*/
enum MDUserAccountAction {
case none;
case email_reconfirmation_required;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDUserAccountAction
*/
public static function fromString(string $input):MDUserAccountAction {
return match($input) {
'none' => self::none,
'email_reconfirmation_required' => self::email_reconfirmation_required,
default => throw new MDpageParameterNotFromListException("Unknown user account action"),
};
}
/**
* 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;
}
}

View File

@ -0,0 +1,65 @@
<?PHP
/**
* Describes an interface for a fully implemented enum describing a
* list of controlled values at md. Expects the availabiliy of
* translations for each.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Describes an interface for a fully implemented enum describing a
* list of controlled values at md.
*/
interface MDValueEnumInterface {
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDValueEnumInterface
*/
public static function fromString(string $input):MDValueEnumInterface;
/**
* Lists the case names available.
*
* @return array<string>
*/
public static function caseNames():array;
/**
* Gets an unsorted array based on provided keys and their translations.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getUnsortedList(MDTlLoader $tlLoader):array;
/**
* Gets a list of entries in a translated version.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return array<string>
*/
public static function getSortedList(MDTlLoader $tlLoader):array;
/**
* Returns the name of the current value in translation.
*
* @param MDTlLoader $tlLoader Translation loader.
*
* @return string
*/
public function getTledName(MDTlLoader $tlLoader):string;
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string;
}

View File

@ -0,0 +1,174 @@
<?PHP
/**
* Represents a redaction level for vocabulary entries (checked, unchecked, questionable).
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a type of contribution to an object group.
*/
enum MDVocabularyRedactionLevel implements MDValueEnumInterface, JsonSerializable {
case checked;
case unchecked;
case questionable;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDVocabularyRedactionLevel
*/
public static function fromString(string $input):MDVocabularyRedactionLevel {
return match($input) {
"+" => self::checked,
"checked" => self::checked,
"-" => self::unchecked,
"unchecked" => self::unchecked,
"" => self::questionable,
"questionable" => self::questionable,
default => throw new MDpageParameterNotFromListException("Unknown vocabulary redaction level"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDVocabularyRedactionLevel
*/
public static function fromInt(int $input):MDVocabularyRedactionLevel {
return match($input) {
0 => self::checked,
1 => self::unchecked,
2 => self::questionable,
default => throw new MDpageParameterNotFromListException("Unknown vocabulary redaction level"),
};
}
/**
* 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(), "vocabulary_redaction_level", "vocabulary_redaction_level");
}
/**
* 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(), "vocabulary_redaction_level", "vocabulary_redaction_level");
}
/**
* 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 name as noted in DB.
*
* @return string
*/
public function toDbString():string {
return match($this) {
self::checked => '+',
self::unchecked => '-',
self::questionable => '',
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* Returns integer representation of object record status.
*
* @return integer
*/
public function toInt():int {
return match($this) {
self::checked => 0,
self::unchecked => 1,
self::questionable => 2,
# default => throw new MDpageParameterNotFromListException("Unknown object record status"),
};
}
/**
* 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("vocabulary_redaction_level", "vocabulary_redaction_level", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->toDbString();
}
}

158
src/enums/MDWeightUnit.php Normal file
View File

@ -0,0 +1,158 @@
<?PHP
/**
* Represents a measurement type.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
/**
* Represents a measurement type.
*/
enum MDWeightUnit implements MDValueEnumInterface, JsonSerializable, MDMeasurementUnitInterface {
case t;
case kg;
case g;
/**
* Returns a value of this type based on a string.
*
* @param string $input Input to get a value from.
*
* @return MDWeightUnit
*/
public static function fromString(string $input):MDWeightUnit {
return match($input) {
't' => self::t,
'kg' => self::kg,
'g' => self::g,
default => throw new MDpageParameterNotFromListException("Unknown length unit"),
};
}
/**
* Returns a value of this type based on an integer.
*
* @param integer $input Input to get a value from.
*
* @return MDWeightUnit
*/
public static function fromInt(int $input):MDWeightUnit {
return match($input) {
1 => self::t,
2 => self::kg,
3 => self::g,
default => throw new MDpageParameterNotFromListException("Unknown length unit"),
};
}
/**
*
*/
/**
* 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::t => 1,
self::kg => 2,
self::g => 3,
# default => throw new MDpageParameterNotFromListException("Unknown measurement type"),
};
}
/**
* Returns the measurement calculated down to the base unit (e.g. mm for lengths).
*
* @param float $value Measurement value.
*
* @return float
*/
public function convertToBaseUnit(float $value):float {
$multiplier = match($this) {
self::t => 1000000,
self::kg => 1000,
self::g => 1,
};
return floatval($value * $multiplier);
}
/**
* 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(), "units_weight_set", "units_weight_set");
}
/**
* 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(), "units_weight_set", "units_weight_set");
}
/**
* 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("units_weight_set", "units_weight_set", $this->name);
}
/**
* Provides the option to serialize as a string during json_encode().
*
* @return string
*/
public function jsonSerialize():string {
return $this->name;
}
}

View File

@ -0,0 +1,38 @@
<?PHP
/**
* This script contains tests for the home page.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
use PHPUnit\Framework\TestCase;
require __DIR__ . '/../src/MDLanguagesSet.php';
/**
* Tests for home page.
*/
final class MDLanguagesSetTest extends TestCase {
/**
* Test to check whether the HTML page is correctly generated.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
* @group ValidOutput
*
* @return void
*/
public function testIso639ListIsCorrect():void {
foreach (MDLanguagesSet::AVAILABLE_LANGUAGES as $language_code => $language_name) {
self::assertArrayHasKey($language_code, MDLanguagesSet::LANGUAGES_ISO639_2B, 'Language ' . $language_code . ' (' . $language_name . ') has no entry in ISO639-2b language code list');
self::assertEquals(3, strlen(MDLanguagesSet::LANGUAGES_ISO639_2B[$language_code]), 'ISO639-2b entry for language ' . $language_code . ' (' . $language_name . ') is not = 3');
}
foreach (MDLanguagesSet::LANGUAGES_ISO639_2B as $language_code => $language_name) {
self::assertArrayHasKey($language_code, MDLanguagesSet::AVAILABLE_LANGUAGES, 'Language ' . $language_code . ' (' . $language_name . ') has an entry in ISO639-2b language code list, but not in the main list.');
}
}
}

View File

@ -0,0 +1,84 @@
<?PHP
/**
* This script contains tests for the home page.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/enums/MDValueEnumInterface.php';
require_once __DIR__ . '/../src/enums/MDNodaRepository.php';
/**
* Tests for home page.
*/
final class MDNodaRepositoryTest extends TestCase {
/**
* Tests that valid IDs actually validate as valid.
*
* @return void
*/
public function testValidIdsValidate():void {
self::assertEquals("Q834961", MDNodaRepository::wikidata->validateId("https://www.wikidata.org/w/index.php?title=Q834961&oldid=2256125706"));
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("http://datos.bne.es/persona/XX5034943"));
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("https://datos.bne.es/persona/XX5034943"));
self::assertEquals("XX5034943", MDNodaRepository::bne->validateId("XX5034943"));
self::assertEquals(false, MDNodaRepository::bne->validateId("XX503494safdsaf;3"));
// GND (Germany)
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("https://d-nb.info/gnd/102423008"));
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("http://d-nb.info/gnd/102423008"));
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("http://d-nb.info/gnd/ 102423008"));
self::assertEquals("1037602218", MDNodaRepository::gnd->validateId("http://d-nb.info/gnd/1037602218"));
self::assertEquals("1037602218", MDNodaRepository::gnd->validateId("https://explore.gnd.network/gnd/1037602218"));
self::assertEquals("102423008", MDNodaRepository::gnd->validateId("102423008"));
self::assertEquals(false, MDNodaRepository::gnd->validateId("fkld;s102423008"));
// NDL (Japan)
self::assertEquals("00967046", MDNodaRepository::ndl->validateId("https://id.ndl.go.jp/auth/ndlna/00967046"));
self::assertEquals("00967046", MDNodaRepository::ndl->validateId("http://id.ndl.go.jp/auth/ndlna/00967046"));
self::assertEquals("00967046", MDNodaRepository::ndl->validateId("00967046"));
self::assertEquals(false, MDNodaRepository::ndl->validateId("http://id.ndl.go.jp/auth/ndlna/0096704;43s6"));
// NPG: National Portrait Gallery
self::assertEquals('mp01751', MDNodaRepository::npg->validateId("https://www.npg.org.uk/collections/search/person/mp01751"));
self::assertEquals('mp01751', MDNodaRepository::npg->validateId("mp01751"));
self::assertEquals(false, MDNodaRepository::npg->validateId("https://www.npg.org.uk/collections/search/person/mp017;51"));
// Library of Congress
self::assertEquals("n2022014604", MDNodaRepository::loc->validateId("https://id.loc.gov/authorities/names/n2022014604"));
self::assertEquals("n2022014604", MDNodaRepository::loc->validateId("http://id.loc.gov/authorities/names/n2022014604"));
self::assertEquals("n2022014604", MDNodaRepository::loc->validateId("n2022014604"));
self::assertEquals(false, MDNodaRepository::loc->validateId("n20220146;04"));
self::assertEquals("sh2022014604", MDNodaRepository::lcsh->validateId("https://id.loc.gov/authorities/names/sh2022014604"));
self::assertEquals("sh2022014604", MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/names/sh2022014604"));
self::assertEquals("sh85081569", MDNodaRepository::lcsh->validateId("http://id.loc.gov/authorities/subjects/sh85081569.html"));
self::assertEquals("sh2022014604", MDNodaRepository::lcsh->validateId("sh2022014604"));
self::assertEquals(false, MDNodaRepository::lcsh->validateId("sh20220146;;04"));
// PRIM
self::assertEquals("PIM71684", MDNodaRepository::pim->validateId("https://opac-nevter.pim.hu/en/record/-/record/PIM71684"));
self::assertEquals("PIM71684", MDNodaRepository::pim->validateId("https://resolver.pim.hu/auth/PIM71684"));
self::assertEquals("PIM71684", MDNodaRepository::pim->validateId("PIM71684"));
self::assertEquals(false, MDNodaRepository::pim->validateId("PIM7168;;4"));
self::assertEquals("248941990", MDNodaRepository::viaf->validateId("https://viaf.org/viaf/248941990"));
self::assertEquals("248941990", MDNodaRepository::viaf->validateId("http://viaf.org/viaf/248941990"));
self::assertEquals("42893419", MDNodaRepository::viaf->validateId("https://viaf.org/viaf/42893419/"));
self::assertEquals("86145857811423020454", MDNodaRepository::viaf->validateId("86145857811423020454"));
self::assertEquals("2869150688328112660005", MDNodaRepository::viaf->validateId("2869150688328112660005"));
self::assertEquals(false, MDNodaRepository::viaf->validateId("2869150688328112;;660005"));
# NDP-IKMK (Places)
self::assertEquals("ort/2847", MDNodaRepository::ndp_ikmk->validateId("https://ikmk.smb.museum/ndp/ort/2847"));
self::assertEquals("land/123", MDNodaRepository::ndp_ikmk->validateId("https://ikmk.smb.museum/ndp/land/123"));
self::assertEquals("region/123", MDNodaRepository::ndp_ikmk->validateId("https://ikmk.smb.museum/ndp/region/123"));
self::assertEquals("land/123", MDNodaRepository::ndp_ikmk->validateId("land/123"));
self::assertEquals(false, MDNodaRepository::ndp_ikmk->validateId("123123"));
}
}

34
tests/bootstrap.php Normal file
View File

@ -0,0 +1,34 @@
<?PHP
declare(strict_types = 1);
/**
* Autoloader for musdb.
*
* @param string $className Name of the class to load.
*
* @return void
*/
\spl_autoload_register(function(string $className):void {
// Try using class map as defined through /scripts/buildClassMap.php
foreach (array_merge([__DIR__ . '/../tests',
__DIR__ . '/../src',
__DIR__ . '/../src/enums',
__DIR__ . '/../src/classes',
__DIR__ . '/../exceptions',
__DIR__ . '/../../MD_STD/src',
__DIR__ . '/../../MDErrorReporter',
__DIR__ . '/../../MDErrorReporter/exceptions',
__DIR__ . '/../../MDErrorReporter/exceptions/generic',
__DIR__ . '/../../MDErrorReporter/exceptions/updates',
]) as $classDir) {
if (\file_exists("$classDir/$className.php")) {
include "$classDir/$className.php";
return;
}
}
});

40
tests/config.xml Normal file
View File

@ -0,0 +1,40 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/|version|/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutChangesToGlobalState="false"
beStrictAboutOutputDuringTests="false"
beStrictAboutResourceUsageDuringSmallTests="true"
beStrictAboutTodoAnnotatedTests="true"
beStrictAboutCoversAnnotation="false"
cacheResult="false"
colors="true"
convertErrorsToExceptions="true"
convertDeprecationsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
enforceTimeLimit="true"
failOnWarning="true"
forceCoversAnnotation="false"
printerClass="Codedungeon\PHPUnitPrettyResultPrinter\Printer"
processIsolation="true"
stopOnError="true"
stopOnFailure="true"
stopOnIncomplete="true"
stopOnSkipped="true"
stopOnRisky="true"
testSuiteLoaderClass="PHPUnit\Runner\StandardTestSuiteLoader"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="true">
<!-- <file>/path/to/file</file>
<exclude>
<directory suffix=".php">/path/to/files</directory>
<file>/path/to/file</file>
preserveGlobalState="false"
runTestInSeparateProcess="true"
</exclude>-->
</phpunit>