1c2ed51d1SGreg Roach<?php 2c2ed51d1SGreg Roach 3c2ed51d1SGreg Roach/** 4c2ed51d1SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 6c2ed51d1SGreg Roach * This program is free software: you can redistribute it and/or modify 7c2ed51d1SGreg Roach * it under the terms of the GNU General Public License as published by 8c2ed51d1SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9c2ed51d1SGreg Roach * (at your option) any later version. 10c2ed51d1SGreg Roach * This program is distributed in the hope that it will be useful, 11c2ed51d1SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12c2ed51d1SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13c2ed51d1SGreg Roach * GNU General Public License for more details. 14c2ed51d1SGreg Roach * You should have received a copy of the GNU General Public License 15c2ed51d1SGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16c2ed51d1SGreg Roach */ 17c2ed51d1SGreg Roach 18c2ed51d1SGreg Roachdeclare(strict_types=1); 19c2ed51d1SGreg Roach 20c2ed51d1SGreg Roachnamespace Fisharebest\Webtrees\Elements; 21c2ed51d1SGreg Roach 2258bab7fcSGreg Roachuse Fisharebest\Webtrees\Family; 2358bab7fcSGreg Roachuse Fisharebest\Webtrees\I18N; 2458bab7fcSGreg Roachuse Fisharebest\Webtrees\Individual; 2558bab7fcSGreg Roachuse Fisharebest\Webtrees\Registry; 2658bab7fcSGreg Roach 2758bab7fcSGreg Roachuse function uasort; 2858bab7fcSGreg Roach 29c2ed51d1SGreg Roach/** 30c2ed51d1SGreg Roach * EVENT_OR_FACT_CLASSIFICATION := {Size=1:15} 31c2ed51d1SGreg Roach * [ <EVENT_ATTRIBUTE_TYPE> ] 32c2ed51d1SGreg Roach * A code that indicates the type of event which was responsible for the source 33c2ed51d1SGreg Roach * entry being recorded. For example, if the entry was created to record a 34c2ed51d1SGreg Roach * birth of a child, then the type would be BIRT regardless of the assertions 35c2ed51d1SGreg Roach * made from that record, such as the mother's name or mother's birth date. 36c2ed51d1SGreg Roach * This will allow a prioritized best view choice and a determination of the 37c2ed51d1SGreg Roach * certainty associated with the source used in asserting the cited fact. 38c2ed51d1SGreg Roach */ 39c2ed51d1SGreg Roachclass EventTypeCitedFrom extends AbstractElement 40c2ed51d1SGreg Roach{ 41ae0043b7SGreg Roach protected const MAXIMUM_LENGTH = 15; 4258bab7fcSGreg Roach 43a5c812b2SGreg Roach protected const SUBTAGS = [ 44a5c812b2SGreg Roach 'ROLE' => '0:1', 45a5c812b2SGreg Roach ]; 46a5c812b2SGreg Roach 4758bab7fcSGreg Roach protected const FAMILY_EVENTS = [ 4858bab7fcSGreg Roach 'ANUL', 4958bab7fcSGreg Roach 'CENS', 5058bab7fcSGreg Roach 'DIV', 5158bab7fcSGreg Roach 'DIVF', 5258bab7fcSGreg Roach 'ENGA', 5358bab7fcSGreg Roach 'MARR', 5458bab7fcSGreg Roach 'MARB', 5558bab7fcSGreg Roach 'MARC', 5658bab7fcSGreg Roach 'MARL', 5758bab7fcSGreg Roach 'MARS', 5858bab7fcSGreg Roach 'EVEN', 5958bab7fcSGreg Roach ]; 6058bab7fcSGreg Roach 6158bab7fcSGreg Roach protected const INDIVIDUAL_EVENTS = [ 6258bab7fcSGreg Roach 'ADOP', 6358bab7fcSGreg Roach 'BIRT', 6458bab7fcSGreg Roach 'BAPM', 6558bab7fcSGreg Roach 'BARM', 6658bab7fcSGreg Roach 'BASM', 6758bab7fcSGreg Roach 'BLES', 6858bab7fcSGreg Roach 'BURI', 6958bab7fcSGreg Roach 'CENS', 7058bab7fcSGreg Roach 'CHR', 7158bab7fcSGreg Roach 'CHRA', 7258bab7fcSGreg Roach 'CONF', 7358bab7fcSGreg Roach 'CREM', 7458bab7fcSGreg Roach 'DEAT', 7558bab7fcSGreg Roach 'EMIG', 7658bab7fcSGreg Roach 'FCOM', 7758bab7fcSGreg Roach 'GRAD', 7858bab7fcSGreg Roach 'IMMI', 7958bab7fcSGreg Roach 'NATU', 8058bab7fcSGreg Roach 'ORDN', 8158bab7fcSGreg Roach 'RETI', 8258bab7fcSGreg Roach 'PROB', 8358bab7fcSGreg Roach 'WILL', 8458bab7fcSGreg Roach 'EVEN', 8558bab7fcSGreg Roach ]; 8658bab7fcSGreg Roach 8758bab7fcSGreg Roach protected const ATTRIBUTE_TYPES = [ 8858bab7fcSGreg Roach 'CAST', 8958bab7fcSGreg Roach 'EDUC', 9058bab7fcSGreg Roach 'NATI', 9158bab7fcSGreg Roach 'OCCU', 9258bab7fcSGreg Roach 'PROP', 9358bab7fcSGreg Roach 'RELI', 9458bab7fcSGreg Roach 'RESI', 9558bab7fcSGreg Roach 'TITL', 9658bab7fcSGreg Roach 'FACT', 9758bab7fcSGreg Roach ]; 9858bab7fcSGreg Roach 9958bab7fcSGreg Roach /** 10058bab7fcSGreg Roach * A list of controlled values for this element 10158bab7fcSGreg Roach * 10258bab7fcSGreg Roach * @return array<int|string,string> 10358bab7fcSGreg Roach */ 10458bab7fcSGreg Roach public function values(): array 10558bab7fcSGreg Roach { 10658bab7fcSGreg Roach $data = [ 10758bab7fcSGreg Roach Family::RECORD_TYPE => static::FAMILY_EVENTS, 10858bab7fcSGreg Roach Individual::RECORD_TYPE => array_merge(static::INDIVIDUAL_EVENTS, static::ATTRIBUTE_TYPES), 10958bab7fcSGreg Roach ]; 11058bab7fcSGreg Roach 11158bab7fcSGreg Roach $values = ['' => '']; 11258bab7fcSGreg Roach 11358bab7fcSGreg Roach foreach ($data as $record_type => $subtags) { 11458bab7fcSGreg Roach foreach ($subtags as $subtag) { 11558bab7fcSGreg Roach $element = Registry::elementFactory()->make($record_type . ':' . $subtag); 11658bab7fcSGreg Roach 11758bab7fcSGreg Roach if (!$element instanceof UnknownElement) { 11858bab7fcSGreg Roach $values[$subtag] = $element->label(); 11958bab7fcSGreg Roach } 12058bab7fcSGreg Roach } 12158bab7fcSGreg Roach } 12258bab7fcSGreg Roach 12358bab7fcSGreg Roach uasort($values, I18N::comparator()); 12458bab7fcSGreg Roach 12558bab7fcSGreg Roach return $values; 12658bab7fcSGreg Roach } 127c2ed51d1SGreg Roach} 128