-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathExtendedRelationshipModuleTrait.php
354 lines (330 loc) · 25.6 KB
/
ExtendedRelationshipModuleTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?php
namespace Cissee\Webtrees\Module\ExtendedRelationships;
use Cissee\WebtreesExt\MoreI18N;
use Fisharebest\Webtrees\I18N;
use Vesta\CommonI18N;
use Vesta\ControlPanelUtils\Model\ControlPanelCheckbox;
use Vesta\ControlPanelUtils\Model\ControlPanelFactRestriction;
use Vesta\ControlPanelUtils\Model\ControlPanelPreferences;
use Vesta\ControlPanelUtils\Model\ControlPanelRadioButton;
use Vesta\ControlPanelUtils\Model\ControlPanelRadioButtons;
use Vesta\ControlPanelUtils\Model\ControlPanelSection;
use Vesta\ControlPanelUtils\Model\ControlPanelSubsection;
trait ExtendedRelationshipModuleTrait {
protected function getMainTitle() {
return CommonI18N::titleVestaExtendedRelationships();
}
public function getShortDescription() {
$originalBlock = MoreI18N::xlate('Who is online');
return
I18N::translate('A module providing various algorithms used to determine relationships. Includes a chart displaying relationships between two individuals, as a replacement for the original \'Relationships\' module.') . ' ' .
I18N::translate('Also includes an extended \'%1$s\' block.', $originalBlock);
}
protected function getFullDescription() {
$originalBlock = MoreI18N::xlate('Who is online');
$description = array();
$description[] =
/* I18N: Module Configuration */I18N::translate('A module providing various algorithms used to determine relationships. Includes an extended \'Relationships\' chart.') . ' ' .
/* I18N: Module Configuration */I18N::translate('Also includes an extended \'%1$s\' block.', $originalBlock) . ' ' .
/* I18N: Module Configuration */I18N::translate('Displays additional relationship information via the extended \'Families\' tab, and the extended \'Facts and Events\' tab.');
$description[] =
/* I18N: Module Configuration */I18N::translate('Intended as a replacement for the original \'Relationships\' module.');
$description[] =
CommonI18N::requires3(CommonI18N::titleVestaCommon(), CommonI18N::titleVestaRelatives(), CommonI18N::titleVestaPersonalFacts());
return $description;
}
protected function createPrefs() {
$generalSub = array();
$generalSub[] = new ControlPanelSubsection(
CommonI18N::displayedTitle(),
array(/*new ControlPanelCheckbox(
I18N::translate('Include the %1$s symbol in the module title', $this->getVestaSymbol()),
null,
'VESTA',
'1'),*/
new ControlPanelCheckbox(
CommonI18N::vestaSymbolInChartTitle(),
CommonI18N::vestaSymbolInTitle2(),
'VESTA_CHART',
'1'),
new ControlPanelCheckbox(
CommonI18N::vestaSymbolInListTitle(),
null,
'VESTA_LIST',
'1'),
new ControlPanelCheckbox(
CommonI18N::vestaSymbolInBlockTitle(),
null,
'VESTA_BLOCK',
'1')));
$chartSub = array();
$chartSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('Display'),
array(new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Show common ancestors on top of relationship paths'),
null,
'CHART_SHOW_CAS',
'1')));
$chartSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('Debugging'),
array(new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Show legacy relationship path names'),
null,
'CHART_SHOW_LEGACY',
'1')));
$chartSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('Options to show in the chart'),
array(new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors'),
/* I18N: Module Configuration */I18N::translate('Determines the shortest path between two individuals via a LCA (lowest common ancestor), i.e. a common ancestor who only appears on the path once.'),
'CHART_1',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find all smallest lowest common ancestors, show a closest connection for each'),
/* I18N: Module Configuration */I18N::translate('Each SLCA (smallest lowest common ancestor) essentially represents a part of the tree which both individuals share (as part of their ancestors). More technically, the SLCA set of two individuals is a subset of the LCA set (excluding all LCAs that are themselves ancestors of other LCAs).'),
'CHART_2',
'0'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find all relationships via lowest common ancestors'),
/* I18N: Module Configuration */I18N::translate('All paths between the two individuals that contribute to the CoR (Coefficient of Relationship), as defined here:') .
' <a href = "http://www.genetic-genealogy.co.uk/Toc115570135.html" target="_blank">Coefficient of Relationship</a>',
'CHART_3',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'),
/* I18N: Module Configuration */I18N::translate('Prefers partial paths via common ancestors, even if there is no direct common ancestor.'),
'CHART_4',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'),
/* I18N: Module Configuration */I18N::translate('For close relationships similar to the previous option, but faster. Internally just a combination of two other methods.'),
'CHART_7',
'0'), //just a combination of two other options, not really required in the chart.
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'),
/* I18N: Module Configuration */I18N::translate('Same option as in the original relationship chart.'),
'CHART_5',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'),
/* I18N: Module Configuration */I18N::translate('Same option as in the original relationship chart, further configurable via recursion level:'),
'CHART_6',
'0'), //not a fan of this ...
new ControlPanelRadioButtons(
true,
array(
//new ControlPanelRadioButton(I18N::number('none'), null, 0), //redundant, just disable the option instead
new ControlPanelRadioButton(I18N::number(1), null, 1),
new ControlPanelRadioButton(I18N::number(2), null, 2),
new ControlPanelRadioButton(I18N::number(3), null, 3),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('unlimited'), null, self::UNLIMITED_RECURSION)),
/* I18N: Module Configuration */MoreI18N::xlate('Searching for all possible relationships can take a lot of time in complex trees.'),
'RELATIONSHIP_RECURSION',
self::DEFAULT_RECURSION)));
$familiesSub = array();
$familiesSub[] = new ControlPanelSubsection(
CommonI18N::options(),
array(new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Allow persistent toggle (user may show/hide relationships)'),
null,
'TAB_TOGGLEABLE_RELS',
'1')/* ,
//disabled - direct ajax requests are buggy wrt I18N!
new ControlPanelCheckbox(
I18N::translate('Allow direct ajax requests (via \'moduleAjax.php\')'),
I18N::translate('The relationships are calculated asynchronously, via additional requests to the server. These are executed a bit faster if this option is checked. However, this may lead to problems with respect to url rewriting, php open_basedir configuration etc., depending on your server configuration. The safe option is to leave this unchecked.'),
'TAB_DIRECT_AJAX',
'0') */));
$familiesSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('How to determine relationships to the default individual'),
array(new ControlPanelRadioButtons(
false,
array(
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Do not show any relationship'),
/* I18N: Module Configuration */ I18N::translate('The following options refer to the same algorithms as used in the extended relationships chart:'),
'0'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors'), null, '1'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all smallest lowest common ancestors, show a closest connection for each'), null, '2'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all relationships via lowest common ancestors'), null, '3'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'), null, '4'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'), null, '7'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'), null, '5'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'), null, '6')),
null,
'TAB_REL_TO_DEFAULT_INDI',
'7'), //fast and reasonable default
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Show common ancestors'),
null,
'TAB_REL_TO_DEFAULT_INDI_SHOW_CA',
'1')));
$familiesSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('How to determine relationships between parents'),
array(new ControlPanelRadioButtons(
false,
array(
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Do not show any relationship'),
/* I18N: Module Configuration */I18N::translate('The following options refer to the same algorithms as used in the extended relationships chart:'),
'0'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors'), null, '1'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all smallest lowest common ancestors, show a closest connection for each'), null, '2'),
new ControlPanelRadioButton(
I18N::translate('Find all relationships via lowest common ancestors'),
/* I18N: Module Configuration */I18N::translate('Searching for regular overall connections would be pointless here because there is always a trivial HUSB - WIFE connection.') . ' ' .
/* I18N: Module Configuration */I18N::translate('Therefore, if one of the following options is selected, overall connections are determined via dated links, i.e. links that have been established before the date of the respective event.') . ' ' .
/* I18N: Module Configuration */I18N::translate('This allows you to present meaningful connections, such as \'widowed husband marries the sister of his dead wife\'.') . ' ' .
/* I18N: Module Configuration */I18N::translate('These relationships may only be calculated efficiently by preprocessing the tree data, via the synchronization link at the top of this page.'),
'3'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'), null, '4'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'), null, '7'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'), null, '5'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'), null, '6')),
null,
'TAB_REL_OF_PARENTS',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Show common ancestors'),
null,
'TAB_REL_OF_PARENTS_SHOW_CA',
'1')));
$familiesSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('How to determine relationships to spouses'),
array(new ControlPanelRadioButtons(
false,
array(
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Do not show any relationship'),
/* I18N: Module Configuration */I18N::translate('The following options refer to the same algorithms as used in the extended relationships chart:'),
'0'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors'), null, '1'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all smallest lowest common ancestors, show a closest connection for each'), null, '2'),
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Find all relationships via lowest common ancestors'),
/* I18N: Module Configuration */I18N::translate('Searching for regular overall connections would be pointless here because there is always a trivial HUSB - WIFE connection.') . ' ' .
/* I18N: Module Configuration */I18N::translate('Therefore, if one of the following options is selected, overall connections are determined via dated links, i.e. links that have been established before the date of the respective event.') . ' ' .
/* I18N: Module Configuration */I18N::translate('This allows you to present meaningful connections, such as \'widowed husband marries the sister of his dead wife\'.') . ' ' .
/* I18N: Module Configuration */I18N::translate('These relationships may only be calculated efficiently by preprocessing the tree data, via the synchronization link at the top of this page.'),
'3'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'), null, '4'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'), null, '7'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'), null, '5'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'), null, '6')),
null,
'TAB_REL_TO_SPOUSE',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Show common ancestors'),
null,
'TAB_REL_TO_SPOUSE_SHOW_CA',
'1')));
$factsSub = array();
$factsSub[] = new ControlPanelSubsection(
CommonI18N::options(),
array(new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Allow persistent toggle (user may show/hide relationships)'),
null,
'FTAB_TOGGLEABLE_RELS',
'1')/* ,
//disabled - direct ajax requests are buggy wrt I18N!
new ControlPanelCheckbox(
I18N::translate('Allow direct ajax requests (via \'moduleAjax.php\')'),
I18N::translate('The relationships are calculated asynchronously, via additional requests to the server. These are executed a bit faster if this option is checked. However, this may lead to problems with respect to url rewriting, php open_basedir configuration etc., depending on your server configuration. The safe option is to leave this unchecked.'),
'FTAB_DIRECT_AJAX',
'0') */));
$factsSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('How to determine relationships to the default individual'),
array(new ControlPanelRadioButtons(
false,
array(
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Do not show any relationship'),
/* I18N: Module Configuration */I18N::translate('The following options refer to the same algorithms as used in the extended relationships chart:'),
'0'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors'), null, '1'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all smallest lowest common ancestors, show a closest connection for each'), null, '2'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all relationships via lowest common ancestors'), null, '3'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'), null, '4'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'), null, '7'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'), null, '5'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'), null, '6')),
null,
'FTAB_REL_TO_DEFAULT_INDI',
'7'), //fast and reasonable default
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Show common ancestors'),
null,
'FTAB_REL_TO_DEFAULT_INDI_SHOW_CA',
'1')));
$factsSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('How to determine relationships to associated persons'),
array(new ControlPanelRadioButtons(
false,
array(
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Do not show any relationship'),
/* I18N: Module Configuration */I18N::translate('The following options refer to the same algorithms as used in the extended relationships chart:'),
'0'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors'), null, '1'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all smallest lowest common ancestors, show a closest connection for each'), null, '2'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find all relationships via lowest common ancestors'), null, '3'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'), null, '4'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'), null, '7'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'), null, '5'),
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'),
/* I18N: Module Configuration */I18N::translate('The following options use dated links, i.e. links that have been established before the date of the respective event.') .
/* I18N: Module Configuration */I18N::translate('This seems more useful in most cases (e.g. to determine the relationship to a godparent at the time of the baptism).'),
'6'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections (preferably via common ancestors)'), null, '14'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find a closest relationship via common ancestors, or fallback to the closest overall connection'), null, '17'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find the closest overall connections'), null, '15'),
new ControlPanelRadioButton(/* I18N: Module Configuration */I18N::translate('Find other/all overall connections'), null, '16')),
null,
'TAB_REL_TO_ASSO',
'15')));
$factsSub[] = new ControlPanelSubsection(
MoreI18N::xlate('Associated events'),
array(new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Only show relationships for specific facts and events'),
/* I18N: Module Configuration */I18N::translate('Associated facts and events are displayed when the respective toggle checkbox is selected on the tab.') . ' ' .
/* I18N: Module Configuration */I18N::translate('If this option is checked, relationships to the associated individuals are only shown for the following facts and events.') . ' ' .
/* I18N: Module Configuration */I18N::translate('In particular if both lists are empty, relationships will never be shown for these facts and events.') . ' ' .
/* I18N: Module Configuration */I18N::translate('Note that the facts and events to be displayed at all may be filtered via the preferences of the tab.'),
'TAB_REL_TO_ASSO_RESTRICTED',
'0'),
ControlPanelFactRestriction::createWithIndividualFacts(
CommonI18N::restrictIndi(),
'TAB_REL_TO_ASSO_RESTRICTED_INDI',
'CHR,BAPM'),
ControlPanelFactRestriction::createWithFamilyFacts(
CommonI18N::restrictFam(),
'TAB_REL_TO_ASSO_RESTRICTED_FAM',
'MARR')));
$sections = array();
$sections[] = new ControlPanelSection(
CommonI18N::general(),
null,
$generalSub);
$sections[] = new ControlPanelSection(
/* I18N: Module Configuration */I18N::translate('Chart Settings'),
/* I18N: Module Configuration */I18N::translate('If you do not want to use the chart functionality, hide this chart via Control Panel > Charts > %1$s Vesta Extended Relationships (note that the chart is listed under the module name).', $this->getVestaSymbol()),
$chartSub);
$sections[] = new ControlPanelSection(
/* I18N: Module Configuration */I18N::translate('Families Tab Settings'),
/* I18N: Module Configuration */I18N::translate('If you do not want to change the functionality with respect to the original Families tab, select \'Do not show any relationship\' everywhere.') . ' ' .
/* I18N: Module Configuration */I18N::translate('In that case, you should also disallow persistent toggle, as it has no visible effect.') . ' ' .
/* I18N: Module Configuration */I18N::translate('You may also adjust the access level of this part of the module.'),
$familiesSub);
$sections[] = new ControlPanelSection(
//TODO: also used on the family page!
CommonI18N::factsAndEventsTabSettings(),
/* I18N: Module Configuration */I18N::translate('If you do not want to change the functionality with respect to the original Facts and Events tab, select \'Do not show any relationship\' in the first block.') . ' ' .
/* I18N: Module Configuration */I18N::translate('If you select this option everywhere, you should also disallow persistent toggle, as it has no visible effect.') . ' ' .
/* I18N: Module Configuration */I18N::translate('You may also adjust the access level of this part of the module.'),
$factsSub);
return new ControlPanelPreferences($sections);
}
protected abstract function editConfigAfterFaq();
}