xref: /webtrees/app/Elements/RelationIsDescriptor.php (revision dc8b895754d40dd9a4b5d21b287e625362c6d115)
1c2ed51d1SGreg Roach<?php
2c2ed51d1SGreg Roach
3c2ed51d1SGreg Roach/**
4c2ed51d1SGreg Roach * webtrees: online genealogy
5c2ed51d1SGreg Roach * Copyright (C) 2021 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
24*dc8b8957SGreg Roachuse function uasort;
25*dc8b8957SGreg 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     *
43c2ed51d1SGreg 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                'best_man'         => I18N::translate('Best man'),
55c2ed51d1SGreg Roach                'bridesmaid'       => I18N::translate('Bridesmaid'),
56c2ed51d1SGreg Roach                'buyer'            => I18N::translateContext('MALE', 'Buyer'),
57c2ed51d1SGreg Roach                'circumciser'      => I18N::translate('Circumciser'),
58c2ed51d1SGreg Roach                'civil_registrar'  => I18N::translateContext('MALE', 'Civil registrar'),
59c2ed51d1SGreg Roach                'employee'         => I18N::translateContext('MALE', 'Employee'),
60c2ed51d1SGreg Roach                'employer'         => I18N::translateContext('MALE', 'Employer'),
61c2ed51d1SGreg Roach                'foster_child'     => I18N::translate('Foster child'),
62c2ed51d1SGreg Roach                'foster_father'    => I18N::translate('Foster father'),
63c2ed51d1SGreg Roach                'foster_mother'    => I18N::translate('Foster mother'),
64c2ed51d1SGreg Roach                'friend'           => I18N::translateContext('MALE', 'Friend'),
65c2ed51d1SGreg Roach                'godfather'        => I18N::translate('Godfather'),
66c2ed51d1SGreg Roach                'godmother'        => I18N::translate('Godmother'),
67c2ed51d1SGreg Roach                'godparent'        => I18N::translate('Godparent'),
68c2ed51d1SGreg Roach                'godson'           => I18N::translate('Godson'),
69c2ed51d1SGreg Roach                'goddaughter'      => I18N::translate('Goddaughter'),
70c2ed51d1SGreg Roach                'godchild'         => I18N::translate('Godchild'),
71c2ed51d1SGreg Roach                'guardian'         => I18N::translateContext('MALE', 'Guardian'),
72c2ed51d1SGreg Roach                'informant'        => I18N::translateContext('MALE', 'Informant'),
73c2ed51d1SGreg Roach                'lodger'           => I18N::translateContext('MALE', 'Lodger'),
74c2ed51d1SGreg Roach                'nanny'            => I18N::translate('Nanny'),
75c2ed51d1SGreg Roach                'nurse'            => I18N::translateContext('MALE', 'Nurse'),
76c2ed51d1SGreg Roach                'owner'            => I18N::translateContext('MALE', 'Owner'),
77c2ed51d1SGreg Roach                'priest'           => I18N::translate('Priest'),
78c2ed51d1SGreg Roach                'rabbi'            => I18N::translate('Rabbi'),
79c2ed51d1SGreg Roach                'registry_officer' => I18N::translateContext('MALE', 'Registry officer'),
80c2ed51d1SGreg Roach                'seller'           => I18N::translateContext('MALE', 'Seller'),
81c2ed51d1SGreg Roach                'servant'          => I18N::translateContext('MALE', 'Servant'),
82c2ed51d1SGreg Roach                'slave'            => I18N::translateContext('MALE', 'Slave'),
83c2ed51d1SGreg Roach                'ward'             => I18N::translateContext('MALE', 'Ward'),
84c2ed51d1SGreg Roach                'witness'          => I18N::translate('Witness'),
85c2ed51d1SGreg Roach            ],
86c2ed51d1SGreg Roach            'F' => [
87c2ed51d1SGreg Roach                'attendant'        => I18N::translateContext('FEMALE', 'Attendant'),
88c2ed51d1SGreg Roach                'attending'        => I18N::translateContext('FEMALE', 'Attending'),
89c2ed51d1SGreg Roach                'best_man'         => I18N::translate('Best man'),
90c2ed51d1SGreg Roach                'bridesmaid'       => I18N::translate('Bridesmaid'),
91c2ed51d1SGreg Roach                'buyer'            => I18N::translateContext('FEMALE', 'Buyer'),
92c2ed51d1SGreg Roach                'circumciser'      => I18N::translate('Circumciser'),
93c2ed51d1SGreg Roach                'civil_registrar'  => I18N::translateContext('FEMALE', 'Civil registrar'),
94c2ed51d1SGreg Roach                'employee'         => I18N::translateContext('FEMALE', 'Employee'),
95c2ed51d1SGreg Roach                'employer'         => I18N::translateContext('FEMALE', 'Employer'),
96c2ed51d1SGreg Roach                'foster_child'     => I18N::translate('Foster child'),
97c2ed51d1SGreg Roach                'foster_father'    => I18N::translate('Foster father'),
98c2ed51d1SGreg Roach                'foster_mother'    => I18N::translate('Foster mother'),
99c2ed51d1SGreg Roach                'friend'           => I18N::translateContext('FEMALE', 'Friend'),
100c2ed51d1SGreg Roach                'godfather'        => I18N::translate('Godfather'),
101c2ed51d1SGreg Roach                'godmother'        => I18N::translate('Godmother'),
102c2ed51d1SGreg Roach                'godparent'        => I18N::translate('Godparent'),
103c2ed51d1SGreg Roach                'godson'           => I18N::translate('Godson'),
104c2ed51d1SGreg Roach                'goddaughter'      => I18N::translate('Goddaughter'),
105c2ed51d1SGreg Roach                'godchild'         => I18N::translate('Godchild'),
106c2ed51d1SGreg Roach                'guardian'         => I18N::translateContext('FEMALE', 'Guardian'),
107c2ed51d1SGreg Roach                'informant'        => I18N::translateContext('FEMALE', 'Informant'),
108c2ed51d1SGreg Roach                'lodger'           => I18N::translateContext('FEMALE', 'Lodger'),
109c2ed51d1SGreg Roach                'nanny'            => I18N::translate('Nanny'),
110c2ed51d1SGreg Roach                'nurse'            => I18N::translateContext('FEMALE', 'Nurse'),
111c2ed51d1SGreg Roach                'owner'            => I18N::translateContext('FEMALE', 'Owner'),
112c2ed51d1SGreg Roach                'priest'           => I18N::translate('Priest'),
113c2ed51d1SGreg Roach                'rabbi'            => I18N::translate('Rabbi'),
114c2ed51d1SGreg Roach                'registry_officer' => I18N::translateContext('FEMALE', 'Registry officer'),
115c2ed51d1SGreg Roach                'seller'           => I18N::translateContext('FEMALE', 'Seller'),
116c2ed51d1SGreg Roach                'servant'          => I18N::translateContext('FEMALE', 'Servant'),
117c2ed51d1SGreg Roach                'slave'            => I18N::translateContext('FEMALE', 'Slave'),
118c2ed51d1SGreg Roach                'ward'             => I18N::translateContext('FEMALE', 'Ward'),
119c2ed51d1SGreg Roach                'witness'          => I18N::translate('Witness'),
120c2ed51d1SGreg Roach            ],
121c2ed51d1SGreg Roach            'U' => [
122c2ed51d1SGreg Roach                'attendant'        => I18N::translate('Attendant'),
123c2ed51d1SGreg Roach                'attending'        => I18N::translate('Attending'),
124c2ed51d1SGreg Roach                'best_man'         => I18N::translate('Best man'),
125c2ed51d1SGreg Roach                'bridesmaid'       => I18N::translate('Bridesmaid'),
126c2ed51d1SGreg Roach                'buyer'            => I18N::translate('Buyer'),
127c2ed51d1SGreg Roach                'circumciser'      => I18N::translate('Circumciser'),
128c2ed51d1SGreg Roach                'civil_registrar'  => I18N::translate('Civil registrar'),
129c2ed51d1SGreg Roach                'employee'         => I18N::translate('Employee'),
130c2ed51d1SGreg Roach                'employer'         => I18N::translate('Employer'),
131c2ed51d1SGreg Roach                'foster_child'     => I18N::translate('Foster child'),
132c2ed51d1SGreg Roach                'foster_father'    => I18N::translate('Foster father'),
133c2ed51d1SGreg Roach                'foster_mother'    => I18N::translate('Foster mother'),
134c2ed51d1SGreg Roach                'friend'           => I18N::translate('Friend'),
135c2ed51d1SGreg Roach                'godfather'        => I18N::translate('Godfather'),
136c2ed51d1SGreg Roach                'godmother'        => I18N::translate('Godmother'),
137c2ed51d1SGreg Roach                'godparent'        => I18N::translate('Godparent'),
138c2ed51d1SGreg Roach                'godson'           => I18N::translate('Godson'),
139c2ed51d1SGreg Roach                'goddaughter'      => I18N::translate('Goddaughter'),
140c2ed51d1SGreg Roach                'godchild'         => I18N::translate('Godchild'),
141c2ed51d1SGreg Roach                'guardian'         => I18N::translate('Guardian'),
142c2ed51d1SGreg Roach                'informant'        => I18N::translate('Informant'),
143c2ed51d1SGreg Roach                'lodger'           => I18N::translate('Lodger'),
144c2ed51d1SGreg Roach                'nanny'            => I18N::translate('Nanny'),
145c2ed51d1SGreg Roach                'nurse'            => I18N::translate('Nurse'),
146c2ed51d1SGreg Roach                'owner'            => I18N::translate('Owner'),
147c2ed51d1SGreg Roach                'priest'           => I18N::translate('Priest'),
148c2ed51d1SGreg Roach                'rabbi'            => I18N::translate('Rabbi'),
149c2ed51d1SGreg Roach                'registry_officer' => I18N::translate('Registry officer'),
150c2ed51d1SGreg Roach                'seller'           => I18N::translate('Seller'),
151c2ed51d1SGreg Roach                'servant'          => I18N::translate('Servant'),
152c2ed51d1SGreg Roach                'slave'            => I18N::translate('Slave'),
153c2ed51d1SGreg Roach                'ward'             => I18N::translate('Ward'),
154c2ed51d1SGreg Roach                'witness'          => I18N::translate('Witness'),
155c2ed51d1SGreg Roach            ],
156c2ed51d1SGreg Roach        ];
157c2ed51d1SGreg Roach
158*dc8b8957SGreg Roach        $tmp = $values[$sex] ?? $values['U'];
159*dc8b8957SGreg Roach
160*dc8b8957SGreg Roach        uasort($tmp, I18N::comparator());
161*dc8b8957SGreg Roach
162*dc8b8957SGreg Roach        return $tmp;
163c2ed51d1SGreg Roach    }
164c2ed51d1SGreg Roach}
165