xref: /webtrees/app/Elements/RelationIsDescriptor.php (revision e5766395c1a71e715ebaadcf2d63d036d60fb649)
1c2ed51d1SGreg Roach<?php
2c2ed51d1SGreg Roach
3c2ed51d1SGreg Roach/**
4c2ed51d1SGreg Roach * webtrees: online genealogy
5d11be702SGreg 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
22c2ed51d1SGreg Roachuse Fisharebest\Webtrees\I18N;
23c2ed51d1SGreg Roach
24dc8b8957SGreg Roachuse function uasort;
25dc8b8957SGreg Roach
26c2ed51d1SGreg Roach/**
27c2ed51d1SGreg Roach * RELATION_IS_DESCRIPTOR := {Size=1:25}
28c2ed51d1SGreg Roach * A word or phrase that states object 1's relation is object 2. For example
29c2ed51d1SGreg Roach * you would read the following as "Joe Jacob's great grandson is the submitter
30c2ed51d1SGreg Roach * pointed to by the @XREF:SUBM@":
31c2ed51d1SGreg Roach * 0 INDI
32c2ed51d1SGreg Roach * 1 NAME Joe /Jacob/
33c2ed51d1SGreg Roach * 1 ASSO @<XREF:SUBM>@
34c2ed51d1SGreg Roach * 2 RELA great grandson
35c2ed51d1SGreg Roach */
36c2ed51d1SGreg Roachclass RelationIsDescriptor extends AbstractElement
37c2ed51d1SGreg Roach{
38ae0043b7SGreg Roach    protected const MAXIMUM_LENGTH = 25;
39c2ed51d1SGreg Roach
40c2ed51d1SGreg Roach    /**
41c2ed51d1SGreg Roach     * A list of controlled values for this element
42c2ed51d1SGreg Roach     *
43*e5766395SGreg Roach     * @param string $sex the text depends on the sex of the *linked* individual
44c2ed51d1SGreg Roach     *
45c2ed51d1SGreg Roach     * @return array<int|string,string>
46c2ed51d1SGreg Roach     */
47c2ed51d1SGreg Roach    public function values(string $sex = 'U'): array
48c2ed51d1SGreg Roach    {
49c2ed51d1SGreg Roach        $values = [
50c2ed51d1SGreg Roach            'M' => [
51c2ed51d1SGreg Roach                ''                 => '',
52c2ed51d1SGreg Roach                'attendant'        => I18N::translateContext('MALE', 'Attendant'),
53c2ed51d1SGreg Roach                'attending'        => I18N::translateContext('MALE', 'Attending'),
54c2ed51d1SGreg Roach                'buyer'            => I18N::translateContext('MALE', 'Buyer'),
55c2ed51d1SGreg Roach                'civil_registrar'  => I18N::translateContext('MALE', 'Civil registrar'),
56c2ed51d1SGreg Roach                'employee'         => I18N::translateContext('MALE', 'Employee'),
57c2ed51d1SGreg Roach                'employer'         => I18N::translateContext('MALE', 'Employer'),
58c2ed51d1SGreg Roach                'friend'           => I18N::translateContext('MALE', 'Friend'),
596cea2bdaSGreg Roach                'godparent'        => I18N::translate('Godfather'),
606cea2bdaSGreg Roach                'godchild'         => I18N::translate('Godson'),
61c2ed51d1SGreg Roach                'guardian'         => I18N::translateContext('MALE', 'Guardian'),
62c2ed51d1SGreg Roach                'informant'        => I18N::translateContext('MALE', 'Informant'),
63c2ed51d1SGreg Roach                'lodger'           => I18N::translateContext('MALE', 'Lodger'),
64c2ed51d1SGreg Roach                'nurse'            => I18N::translateContext('MALE', 'Nurse'),
65c2ed51d1SGreg Roach                'owner'            => I18N::translateContext('MALE', 'Owner'),
66c2ed51d1SGreg Roach                'registry_officer' => I18N::translateContext('MALE', 'Registry officer'),
67c2ed51d1SGreg Roach                'seller'           => I18N::translateContext('MALE', 'Seller'),
68c2ed51d1SGreg Roach                'servant'          => I18N::translateContext('MALE', 'Servant'),
69c2ed51d1SGreg Roach                'slave'            => I18N::translateContext('MALE', 'Slave'),
70c2ed51d1SGreg Roach                'ward'             => I18N::translateContext('MALE', 'Ward'),
71c2ed51d1SGreg Roach            ],
72c2ed51d1SGreg Roach            'F' => [
73c2ed51d1SGreg Roach                'attendant'        => I18N::translateContext('FEMALE', 'Attendant'),
74c2ed51d1SGreg Roach                'attending'        => I18N::translateContext('FEMALE', 'Attending'),
75c2ed51d1SGreg Roach                'buyer'            => I18N::translateContext('FEMALE', 'Buyer'),
76c2ed51d1SGreg Roach                'civil_registrar'  => I18N::translateContext('FEMALE', 'Civil registrar'),
77c2ed51d1SGreg Roach                'employee'         => I18N::translateContext('FEMALE', 'Employee'),
78c2ed51d1SGreg Roach                'employer'         => I18N::translateContext('FEMALE', 'Employer'),
79c2ed51d1SGreg Roach                'friend'           => I18N::translateContext('FEMALE', 'Friend'),
806cea2bdaSGreg Roach                'godparent'        => I18N::translate('Godmother'),
816cea2bdaSGreg Roach                'godchild'         => I18N::translate('Goddaughter'),
82c2ed51d1SGreg Roach                'guardian'         => I18N::translateContext('FEMALE', 'Guardian'),
83c2ed51d1SGreg Roach                'informant'        => I18N::translateContext('FEMALE', 'Informant'),
84c2ed51d1SGreg Roach                'lodger'           => I18N::translateContext('FEMALE', 'Lodger'),
85c2ed51d1SGreg Roach                'nurse'            => I18N::translateContext('FEMALE', 'Nurse'),
86c2ed51d1SGreg Roach                'owner'            => I18N::translateContext('FEMALE', 'Owner'),
87c2ed51d1SGreg Roach                'registry_officer' => I18N::translateContext('FEMALE', 'Registry officer'),
88c2ed51d1SGreg Roach                'seller'           => I18N::translateContext('FEMALE', 'Seller'),
89c2ed51d1SGreg Roach                'servant'          => I18N::translateContext('FEMALE', 'Servant'),
90c2ed51d1SGreg Roach                'slave'            => I18N::translateContext('FEMALE', 'Slave'),
91c2ed51d1SGreg Roach                'ward'             => I18N::translateContext('FEMALE', 'Ward'),
92c2ed51d1SGreg Roach            ],
93c2ed51d1SGreg Roach            'U' => [
94c2ed51d1SGreg Roach                'attendant'        => I18N::translate('Attendant'),
95c2ed51d1SGreg Roach                'attending'        => I18N::translate('Attending'),
96c2ed51d1SGreg Roach                'best_man'         => I18N::translate('Best man'),
97c2ed51d1SGreg Roach                'bridesmaid'       => I18N::translate('Bridesmaid'),
98c2ed51d1SGreg Roach                'buyer'            => I18N::translate('Buyer'),
99c2ed51d1SGreg Roach                'circumciser'      => I18N::translate('Circumciser'),
100c2ed51d1SGreg Roach                'civil_registrar'  => I18N::translate('Civil registrar'),
101c2ed51d1SGreg Roach                'employee'         => I18N::translate('Employee'),
102c2ed51d1SGreg Roach                'employer'         => I18N::translate('Employer'),
103c2ed51d1SGreg Roach                'foster_child'     => I18N::translate('Foster child'),
104c2ed51d1SGreg Roach                'foster_father'    => I18N::translate('Foster father'),
105c2ed51d1SGreg Roach                'foster_mother'    => I18N::translate('Foster mother'),
106c2ed51d1SGreg Roach                'friend'           => I18N::translate('Friend'),
107c2ed51d1SGreg Roach                'godfather'        => I18N::translate('Godfather'),
108c2ed51d1SGreg Roach                'godmother'        => I18N::translate('Godmother'),
109c2ed51d1SGreg Roach                'godparent'        => I18N::translate('Godparent'),
110c2ed51d1SGreg Roach                'godson'           => I18N::translate('Godson'),
111c2ed51d1SGreg Roach                'goddaughter'      => I18N::translate('Goddaughter'),
112c2ed51d1SGreg Roach                'godchild'         => I18N::translate('Godchild'),
113c2ed51d1SGreg Roach                'guardian'         => I18N::translate('Guardian'),
114c2ed51d1SGreg Roach                'informant'        => I18N::translate('Informant'),
115c2ed51d1SGreg Roach                'lodger'           => I18N::translate('Lodger'),
1166cafc112SGreg Roach                'multiple'         => /* I18N: twin, triplet, etc. */ I18N::translate('Multiple birth'),
117c2ed51d1SGreg Roach                'nanny'            => I18N::translate('Nanny'),
118c2ed51d1SGreg Roach                'nurse'            => I18N::translate('Nurse'),
119c2ed51d1SGreg Roach                'owner'            => I18N::translate('Owner'),
1206cea2bdaSGreg Roach                'proxy'            => /* I18N: An individual that represents another */ I18N::translate('Proxy'),
121c2ed51d1SGreg Roach                'priest'           => I18N::translate('Priest'),
122c2ed51d1SGreg Roach                'rabbi'            => I18N::translate('Rabbi'),
123c2ed51d1SGreg Roach                'registry_officer' => I18N::translate('Registry officer'),
124c2ed51d1SGreg Roach                'seller'           => I18N::translate('Seller'),
125c2ed51d1SGreg Roach                'servant'          => I18N::translate('Servant'),
126c2ed51d1SGreg Roach                'slave'            => I18N::translate('Slave'),
127c2ed51d1SGreg Roach                'ward'             => I18N::translate('Ward'),
128c2ed51d1SGreg Roach                'witness'          => I18N::translate('Witness'),
129c2ed51d1SGreg Roach            ],
130c2ed51d1SGreg Roach        ];
131c2ed51d1SGreg Roach
132dc8b8957SGreg Roach        $tmp = $values[$sex] ?? $values['U'];
133dc8b8957SGreg Roach
134dc8b8957SGreg Roach        uasort($tmp, I18N::comparator());
135dc8b8957SGreg Roach
136dc8b8957SGreg Roach        return $tmp;
137c2ed51d1SGreg Roach    }
138c2ed51d1SGreg Roach}
139