From 1108398437787e81f21254fa0e0adef2b5591d9c Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Sun, 29 Oct 2023 01:27:32 +0200 Subject: [PATCH] Add functions for listing event actor names, time names, place names --- l18n | 2 +- src/MDEventsSet.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/l18n b/l18n index eea9008..8a2501a 160000 --- a/l18n +++ b/l18n @@ -1 +1 @@ -Subproject commit eea900820d19567f28d87bae7afda04e8cfde7b8 +Subproject commit 8a2501a62c581a86dd4e08191376974ae3a6d3bc diff --git a/src/MDEventsSet.php b/src/MDEventsSet.php index f4e16df..c38337a 100644 --- a/src/MDEventsSet.php +++ b/src/MDEventsSet.php @@ -95,4 +95,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 + */ + 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 + */ + 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 + */ + 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; + + } }