@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <div class="row form-group"> |
35 | 35 | <label for="xref" class="col-sm-3 col-form-label"> |
36 | 36 | <?= /* I18N: Label for a configuration option */ |
37 | - I18N::translate('Show this block for which languages') ?> |
|
37 | + I18N::translate('Show this block for which languages') ?> |
|
38 | 38 | </label> |
39 | 39 | |
40 | 40 | <div class="col-sm-9"> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | <?= Bootstrap4::select(['' => I18N::translate('All')] + $tree_names, $tree->getName(), ['id' => 'gedcom_id', 'name' => 'gedcom_id']) ?> |
62 | 62 | <p class="small text-muted"> |
63 | 63 | <?= /* I18N: FAQ = “Frequently Asked Question” */ |
64 | - I18N::translate('An FAQ can be displayed on just one of the family trees, or on all the family trees.') ?> |
|
64 | + I18N::translate('An FAQ can be displayed on just one of the family trees, or on all the family trees.') ?> |
|
65 | 65 | </p> |
66 | 66 | </div> |
67 | 67 | </div> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | <div class="row form-group"> |
16 | 16 | <label class="col-sm-3 col-form-label" for="relationship-ancestors-<?= $tree->getTreeId() ?>"> |
17 | 17 | <?= /* I18N: Configuration option */ |
18 | - I18N::translate('Relationships') ?> |
|
18 | + I18N::translate('Relationships') ?> |
|
19 | 19 | </label> |
20 | 20 | <div class="col-sm-9"> |
21 | 21 | <?= Bootstrap4::select($ancestors_options, $tree->getPreference('RELATIONSHIP_ANCESTORS', $default_ancestors), ['id' => 'relationship-ancestors-' . $tree->getTreeId(), 'name' => 'relationship-ancestors-' . $tree->getTreeId()]) ?> |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | <div class="row"> |
27 | 27 | <legend class="col-form-label col-sm-3"> |
28 | 28 | <?= /* I18N: Configuration option */ |
29 | - I18N::translate('How much recursion to use when searching for relationships') ?> |
|
29 | + I18N::translate('How much recursion to use when searching for relationships') ?> |
|
30 | 30 | </legend> |
31 | 31 | <div class="col-sm-9"> |
32 | 32 | <?= Bootstrap4::radioButtons('relationship-recursion-' . $tree->getTreeId(), $recursion_options, $tree->getPreference('RELATIONSHIP_RECURSION', $default_recursion), true) ?> |
@@ -42,24 +42,24 @@ discard block |
||
42 | 42 | </th> |
43 | 43 | <td class="wt-page-options-value" colspan="3"> |
44 | 44 | <?php |
45 | - for ($n = 1, $months_in_year = $cal_date->monthsInYear(); $n <= $months_in_year; ++$n) { |
|
46 | - $month_name = $cal_date->monthNameNominativeCase($n, $cal_date->isLeapYear()); |
|
47 | - $m = array_search($n, $cal_date::$MONTH_ABBREV); |
|
48 | - if ($n === 6 && $cal_date instanceof JewishDate && !$cal_date->isLeapYear()) { |
|
49 | - // No month 6 in Jewish non-leap years. |
|
50 | - continue; |
|
51 | - } |
|
52 | - if ($n === 7 && $cal_date instanceof JewishDate && !$cal_date->isLeapYear()) { |
|
53 | - // Month 7 is ADR in Jewish non-leap years. |
|
54 | - $m = 'ADR'; |
|
55 | - } |
|
56 | - if ($n === $cal_date->m) { |
|
57 | - $month_name = '<span class="error">' . $month_name . '</span>'; |
|
58 | - } |
|
59 | - echo '<a href="' . e(route('calendar', ['cal' => $cal, 'day' => $cal_date->d, 'month' => $m, 'year' => $cal_date->y, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'month', 'ged' => $tree->getName()])) . '" rel="nofollow">', $month_name, '</a>'; |
|
60 | - echo ' | '; |
|
61 | - } |
|
62 | - ?> |
|
45 | + for ($n = 1, $months_in_year = $cal_date->monthsInYear(); $n <= $months_in_year; ++$n) { |
|
46 | + $month_name = $cal_date->monthNameNominativeCase($n, $cal_date->isLeapYear()); |
|
47 | + $m = array_search($n, $cal_date::$MONTH_ABBREV); |
|
48 | + if ($n === 6 && $cal_date instanceof JewishDate && !$cal_date->isLeapYear()) { |
|
49 | + // No month 6 in Jewish non-leap years. |
|
50 | + continue; |
|
51 | + } |
|
52 | + if ($n === 7 && $cal_date instanceof JewishDate && !$cal_date->isLeapYear()) { |
|
53 | + // Month 7 is ADR in Jewish non-leap years. |
|
54 | + $m = 'ADR'; |
|
55 | + } |
|
56 | + if ($n === $cal_date->m) { |
|
57 | + $month_name = '<span class="error">' . $month_name . '</span>'; |
|
58 | + } |
|
59 | + echo '<a href="' . e(route('calendar', ['cal' => $cal, 'day' => $cal_date->d, 'month' => $m, 'year' => $cal_date->y, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'month', 'ged' => $tree->getName()])) . '" rel="nofollow">', $month_name, '</a>'; |
|
60 | + echo ' | '; |
|
61 | + } |
|
62 | + ?> |
|
63 | 63 | <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => min($cal_date->d, $today->daysInMonth()), 'month' => $today_month, 'year' => $today->y, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'month', 'ged' => $tree->getName()])) ?>" rel="nofollow"> |
64 | 64 | <b><?= $today->format('%F %Y') ?></b> |
65 | 65 | </a> |
@@ -169,16 +169,16 @@ discard block |
||
169 | 169 | </td> |
170 | 170 | <td class="topbottombar width50"> |
171 | 171 | <?php |
172 | - $n = 0; |
|
173 | - foreach (Date::calendarNames() as $newcal => $cal_name) { |
|
174 | - $tmp = $cal_date->convertToCalendar($newcal); |
|
175 | - if ($tmp->inValidRange()) { |
|
176 | - if ($n++) { |
|
177 | - echo ' | '; |
|
178 | - } |
|
179 | - echo '<a ' . (get_class($tmp) === get_class($cal_date) ? 'class="error"' : '') . 'href="' . e(route('calendar', ['cal' => $tmp->format('%@'), 'day' => $tmp->d, 'month' => $tmp->format('%O'), 'year' => $tmp->y, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => $view, 'ged' => $tree->getName()])) . '" rel="nofollow">', $cal_name, '</a>'; |
|
180 | - } |
|
181 | - } ?> |
|
172 | + $n = 0; |
|
173 | + foreach (Date::calendarNames() as $newcal => $cal_name) { |
|
174 | + $tmp = $cal_date->convertToCalendar($newcal); |
|
175 | + if ($tmp->inValidRange()) { |
|
176 | + if ($n++) { |
|
177 | + echo ' | '; |
|
178 | + } |
|
179 | + echo '<a ' . (get_class($tmp) === get_class($cal_date) ? 'class="error"' : '') . 'href="' . e(route('calendar', ['cal' => $tmp->format('%@'), 'day' => $tmp->d, 'month' => $tmp->format('%O'), 'year' => $tmp->y, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => $view, 'ged' => $tree->getName()])) . '" rel="nofollow">', $cal_name, '</a>'; |
|
180 | + } |
|
181 | + } ?> |
|
182 | 182 | </td> |
183 | 183 | </tr> |
184 | 184 | </table> |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | <p><?= I18N::translate('No results found.') ?></p> |
22 | 22 | <?php else: ?> |
23 | 23 | <?= view('lists/individuals-table', [ |
24 | - 'individuals' => $indilist, |
|
25 | - 'sosa' => false, |
|
26 | - 'tree' => $tree, |
|
27 | - ]) ?> |
|
24 | + 'individuals' => $indilist, |
|
25 | + 'sosa' => false, |
|
26 | + 'tree' => $tree, |
|
27 | + ]) ?> |
|
28 | 28 | <?php endif ?> |
29 | 29 | </div> |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | <p><?= I18N::translate('No results found.') ?></p> |
34 | 34 | <?php else: ?> |
35 | 35 | <?= view('lists/families-table', [ |
36 | - 'families' => $famlist, |
|
37 | - ]) ?> |
|
36 | + 'families' => $famlist, |
|
37 | + ]) ?> |
|
38 | 38 | <?php endif ?> |
39 | 39 | </div> |
40 | 40 | </div> |
@@ -25,7 +25,7 @@ |
||
25 | 25 | <div class="col-sm-3 wt-page-options-label"></div> |
26 | 26 | <div class="col-sm-9 wt-page-options-value"> |
27 | 27 | <input class="btn btn-primary" type="submit" value="<?= /* I18N: A button label. */ |
28 | - I18N::translate('view') ?>"> |
|
28 | + I18N::translate('view') ?>"> |
|
29 | 29 | </div> |
30 | 30 | </div> |
31 | 31 | </form> |
@@ -25,12 +25,12 @@ |
||
25 | 25 | <button class="btn btn-primary" type="submit"> |
26 | 26 | <?= FontAwesome::decorativeIcon('save') ?> |
27 | 27 | <?= /* I18N: A button label. */ |
28 | - I18N::translate('save') ?> |
|
28 | + I18N::translate('save') ?> |
|
29 | 29 | </button> |
30 | 30 | <a class="btn btn-secondary" href="<?= e($individual->url()) ?>"> |
31 | 31 | <?= FontAwesome::decorativeIcon('cancel') ?> |
32 | 32 | <?= /* I18N: A button label. */ |
33 | - I18N::translate('cancel') ?> |
|
33 | + I18N::translate('cancel') ?> |
|
34 | 34 | </a> |
35 | 35 | </div> |
36 | 36 | </div> |
@@ -73,12 +73,12 @@ |
||
73 | 73 | <button class="btn btn-primary" type="submit"> |
74 | 74 | <?= FontAwesome::decorativeIcon('save') ?> |
75 | 75 | <?= /* I18N: A button label. */ |
76 | - I18N::translate('save') ?> |
|
76 | + I18N::translate('save') ?> |
|
77 | 77 | </button> |
78 | 78 | <a class="btn btn-secondary" href="<?= e($family->url()) ?>"> |
79 | 79 | <?= FontAwesome::decorativeIcon('cancel') ?> |
80 | 80 | <?= /* I18N: A button label. */ |
81 | - I18N::translate('cancel') ?> |
|
81 | + I18N::translate('cancel') ?> |
|
82 | 82 | </a> |
83 | 83 | </div> |
84 | 84 | </div> |
@@ -16,47 +16,47 @@ discard block |
||
16 | 16 | |
17 | 17 | <?php if (($record::RECORD_TYPE === 'INDI' || $record::RECORD_TYPE === 'FAM') && $fact !== 'OBJE' && $fact !== 'NOTE' && $fact !== 'SHARED_NOTE' && $fact !== 'REPO' && $fact !== 'SOUR' && $fact !== 'SUBM' && $fact !== 'ASSO' && $fact !== 'ALIA' && $fact !== 'SEX'): ?> |
18 | 18 | <?= view('cards/add-source-citation', [ |
19 | - 'level' => 2, |
|
20 | - 'full_citations' => $tree->getPreference('FULL_SOURCES'), |
|
21 | - 'tree' => $tree, |
|
22 | - ]); ?> |
|
19 | + 'level' => 2, |
|
20 | + 'full_citations' => $tree->getPreference('FULL_SOURCES'), |
|
21 | + 'tree' => $tree, |
|
22 | + ]); ?> |
|
23 | 23 | |
24 | 24 | <?php if ($tree->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($tree)): ?> |
25 | 25 | <?= view('cards/add-media-object', [ |
26 | - 'level' => 2, |
|
27 | - 'tree' => $tree, |
|
28 | - ]) ?> |
|
26 | + 'level' => 2, |
|
27 | + 'tree' => $tree, |
|
28 | + ]) ?> |
|
29 | 29 | <?php endif ?> |
30 | 30 | |
31 | 31 | <?php if ($fact !== 'NOTE'): ?> |
32 | 32 | <?= view('cards/add-note', [ |
33 | - 'level' => 2, |
|
34 | - 'tree' => $tree, |
|
35 | - ]) ?> |
|
33 | + 'level' => 2, |
|
34 | + 'tree' => $tree, |
|
35 | + ]) ?> |
|
36 | 36 | |
37 | 37 | <?= view('cards/add-shared-note', [ |
38 | - 'level' => 2, |
|
39 | - 'tree' => $tree, |
|
40 | - ]) ?> |
|
38 | + 'level' => 2, |
|
39 | + 'tree' => $tree, |
|
40 | + ]) ?> |
|
41 | 41 | <?php endif ?> |
42 | 42 | |
43 | 43 | <?= view('cards/add-associate', [ |
44 | - 'id' => Uuid::uuid4()->toString(), |
|
45 | - 'level' => 2, |
|
46 | - 'tree' => $tree, |
|
47 | - ]) ?> |
|
44 | + 'id' => Uuid::uuid4()->toString(), |
|
45 | + 'level' => 2, |
|
46 | + 'tree' => $tree, |
|
47 | + ]) ?> |
|
48 | 48 | <?php if (in_array($fact, Config::twoAssociates())): ?> |
49 | 49 | <?= view('cards/add-associate', [ |
50 | - 'id' => Uuid::uuid4()->toString(), |
|
51 | - 'level' => 2, |
|
52 | - 'tree' => $tree, |
|
53 | - ]) ?> |
|
50 | + 'id' => Uuid::uuid4()->toString(), |
|
51 | + 'level' => 2, |
|
52 | + 'tree' => $tree, |
|
53 | + ]) ?> |
|
54 | 54 | <?php endif ?> |
55 | 55 | |
56 | 56 | <?= view('cards/add-restriction', [ |
57 | - 'level' => 2, |
|
58 | - 'tree' => $tree, |
|
59 | - ]) ?> |
|
57 | + 'level' => 2, |
|
58 | + 'tree' => $tree, |
|
59 | + ]) ?> |
|
60 | 60 | <?php endif ?> |
61 | 61 | |
62 | 62 | <div class="form-group row"> |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | <button class="btn btn-primary" type="submit"> |
78 | 78 | <?= FontAwesome::decorativeIcon('save') ?> |
79 | 79 | <?= /* I18N: A button label. */ |
80 | - I18N::translate('save') ?> |
|
80 | + I18N::translate('save') ?> |
|
81 | 81 | </button> |
82 | 82 | <a class="btn btn-secondary" href="<?= e($record->url()) ?>"> |
83 | 83 | <?= FontAwesome::decorativeIcon('cancel') ?> |
84 | 84 | <?= /* I18N: A button label. */ |
85 | - I18N::translate('cancel') ?> |
|
85 | + I18N::translate('cancel') ?> |
|
86 | 86 | </a> |
87 | 87 | </div> |
88 | 88 | </div> |
@@ -10,116 +10,116 @@ discard block |
||
10 | 10 | |
11 | 11 | <?php |
12 | 12 | if ($individual !== null) { |
13 | - $xref = $individual->getXref(); |
|
14 | - $cancel_url = $individual->url(); |
|
13 | + $xref = $individual->getXref(); |
|
14 | + $cancel_url = $individual->url(); |
|
15 | 15 | } elseif ($family !== null) { |
16 | - $xref = $family->getXref(); |
|
17 | - $cancel_url = $family->url(); |
|
16 | + $xref = $family->getXref(); |
|
17 | + $cancel_url = $family->url(); |
|
18 | 18 | } else { |
19 | - $cancel_url = route('admin-trees'); |
|
20 | - $xref = 'new'; |
|
19 | + $cancel_url = route('admin-trees'); |
|
20 | + $xref = 'new'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | // Different cultures do surnames differently |
24 | 24 | $surname_tradition = SurnameTradition::create($tree->getPreference('SURNAME_TRADITION')); |
25 | 25 | |
26 | 26 | if ($name_fact !== null) { |
27 | - // Editing an existing name |
|
28 | - $name_fact_id = $name_fact->getFactId(); |
|
29 | - $namerec = $name_fact->getGedcom(); |
|
30 | - $name_fields = [ |
|
31 | - 'NAME' => $name_fact->getValue(), |
|
32 | - 'TYPE' => $name_fact->getAttribute('TYPE'), |
|
33 | - 'NPFX' => $name_fact->getAttribute('NPFX'), |
|
34 | - 'GIVN' => $name_fact->getAttribute('GIVN'), |
|
35 | - 'NICK' => $name_fact->getAttribute('NICK'), |
|
36 | - 'SPFX' => $name_fact->getAttribute('SPFX'), |
|
37 | - 'SURN' => $name_fact->getAttribute('SURN'), |
|
38 | - 'NSFX' => $name_fact->getAttribute('NSFX'), |
|
39 | - ]; |
|
40 | - |
|
41 | - // Populate any missing subfields from the NAME field |
|
42 | - $npfx_accept = implode('|', Config::namePrefixes()); |
|
43 | - if (preg_match('/(((' . $npfx_accept . ')\.? +)*)([^\n\/"]*)("(.*)")? *\/(([a-z]{2,3} +)*)(.*)\/ *(.*)/i', $name_fields['NAME'], $name_bits)) { |
|
44 | - $name_fields['NPFX'] = $name_fields['NPFX'] ?: $name_bits[1]; |
|
45 | - $name_fields['GIVN'] = $name_fields['GIVN'] ?: $name_bits[4]; |
|
46 | - $name_fields['NICK'] = $name_fields['NICK'] ?: $name_bits[6]; |
|
47 | - $name_fields['SPFX'] = $name_fields['SPFX'] ?: trim($name_bits[7]); |
|
48 | - $name_fields['SURN'] = $name_fields['SURN'] ?: preg_replace('~/[^/]*/~', ',', $name_bits[9]); |
|
49 | - $name_fields['NSFX'] = $name_fields['NSFX'] ?: $name_bits[10]; |
|
50 | - } |
|
27 | + // Editing an existing name |
|
28 | + $name_fact_id = $name_fact->getFactId(); |
|
29 | + $namerec = $name_fact->getGedcom(); |
|
30 | + $name_fields = [ |
|
31 | + 'NAME' => $name_fact->getValue(), |
|
32 | + 'TYPE' => $name_fact->getAttribute('TYPE'), |
|
33 | + 'NPFX' => $name_fact->getAttribute('NPFX'), |
|
34 | + 'GIVN' => $name_fact->getAttribute('GIVN'), |
|
35 | + 'NICK' => $name_fact->getAttribute('NICK'), |
|
36 | + 'SPFX' => $name_fact->getAttribute('SPFX'), |
|
37 | + 'SURN' => $name_fact->getAttribute('SURN'), |
|
38 | + 'NSFX' => $name_fact->getAttribute('NSFX'), |
|
39 | + ]; |
|
40 | + |
|
41 | + // Populate any missing subfields from the NAME field |
|
42 | + $npfx_accept = implode('|', Config::namePrefixes()); |
|
43 | + if (preg_match('/(((' . $npfx_accept . ')\.? +)*)([^\n\/"]*)("(.*)")? *\/(([a-z]{2,3} +)*)(.*)\/ *(.*)/i', $name_fields['NAME'], $name_bits)) { |
|
44 | + $name_fields['NPFX'] = $name_fields['NPFX'] ?: $name_bits[1]; |
|
45 | + $name_fields['GIVN'] = $name_fields['GIVN'] ?: $name_bits[4]; |
|
46 | + $name_fields['NICK'] = $name_fields['NICK'] ?: $name_bits[6]; |
|
47 | + $name_fields['SPFX'] = $name_fields['SPFX'] ?: trim($name_bits[7]); |
|
48 | + $name_fields['SURN'] = $name_fields['SURN'] ?: preg_replace('~/[^/]*/~', ',', $name_bits[9]); |
|
49 | + $name_fields['NSFX'] = $name_fields['NSFX'] ?: $name_bits[10]; |
|
50 | + } |
|
51 | 51 | } else { |
52 | - // Creating a new name |
|
53 | - $name_fact_id = ''; |
|
54 | - $namerec = ''; |
|
55 | - $name_fields = [ |
|
56 | - 'NAME' => '', |
|
57 | - 'TYPE' => '', |
|
58 | - 'NPFX' => '', |
|
59 | - 'GIVN' => '', |
|
60 | - 'NICK' => '', |
|
61 | - 'SPFX' => '', |
|
62 | - 'SURN' => '', |
|
63 | - 'NSFX' => '', |
|
64 | - ]; |
|
65 | - |
|
66 | - // Inherit surname from parents, spouse or child |
|
67 | - if ($family) { |
|
68 | - $father = $family->getHusband(); |
|
69 | - if ($father && $father->getFirstFact('NAME')) { |
|
70 | - $father_name = $father->getFirstFact('NAME')->getValue(); |
|
71 | - } else { |
|
72 | - $father_name = ''; |
|
73 | - } |
|
74 | - $mother = $family->getWife(); |
|
75 | - if ($mother && $mother->getFirstFact('NAME')) { |
|
76 | - $mother_name = $mother->getFirstFact('NAME')->getValue(); |
|
77 | - } else { |
|
78 | - $mother_name = ''; |
|
79 | - } |
|
80 | - } else { |
|
81 | - $father = null; |
|
82 | - $mother = null; |
|
83 | - $father_name = ''; |
|
84 | - $mother_name = ''; |
|
85 | - } |
|
86 | - if ($individual && $individual->getFirstFact('NAME')) { |
|
87 | - $indi_name = $individual->getFirstFact('NAME')->getValue(); |
|
88 | - } else { |
|
89 | - $indi_name = ''; |
|
90 | - } |
|
91 | - |
|
92 | - switch ($nextaction) { |
|
93 | - case 'add_child_to_family_action': |
|
94 | - $name_fields = array_merge($name_fields, $surname_tradition->newChildNames($father_name, $mother_name, $gender)); |
|
95 | - break; |
|
96 | - case 'add_child_to_individual_action': |
|
97 | - if ($individual->getSex() === 'F') { |
|
98 | - $name_fields = array_merge($name_fields, $surname_tradition->newChildNames('', $indi_name, $gender)); |
|
99 | - } else { |
|
100 | - $name_fields = array_merge($name_fields, $surname_tradition->newChildNames($indi_name, '', $gender)); |
|
101 | - } |
|
102 | - break; |
|
103 | - case 'add_parent_to_individual_action': |
|
104 | - $name_fields = array_merge($name_fields, $surname_tradition->newParentNames($indi_name, $gender)); |
|
105 | - break; |
|
106 | - case 'add_spouse_to_family_action': |
|
107 | - if ($father) { |
|
108 | - $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($father_name, $gender)); |
|
109 | - } else { |
|
110 | - $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($mother_name, $gender)); |
|
111 | - } |
|
112 | - break; |
|
113 | - case 'add_spouse_to_individual_action': |
|
114 | - $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($indi_name, $gender)); |
|
115 | - break; |
|
116 | - case 'add_unlinked_indi_action': |
|
117 | - case 'update': |
|
118 | - if ($surname_tradition->hasSurnames()) { |
|
119 | - $name_fields['NAME'] = '//'; |
|
120 | - } |
|
121 | - break; |
|
122 | - } |
|
52 | + // Creating a new name |
|
53 | + $name_fact_id = ''; |
|
54 | + $namerec = ''; |
|
55 | + $name_fields = [ |
|
56 | + 'NAME' => '', |
|
57 | + 'TYPE' => '', |
|
58 | + 'NPFX' => '', |
|
59 | + 'GIVN' => '', |
|
60 | + 'NICK' => '', |
|
61 | + 'SPFX' => '', |
|
62 | + 'SURN' => '', |
|
63 | + 'NSFX' => '', |
|
64 | + ]; |
|
65 | + |
|
66 | + // Inherit surname from parents, spouse or child |
|
67 | + if ($family) { |
|
68 | + $father = $family->getHusband(); |
|
69 | + if ($father && $father->getFirstFact('NAME')) { |
|
70 | + $father_name = $father->getFirstFact('NAME')->getValue(); |
|
71 | + } else { |
|
72 | + $father_name = ''; |
|
73 | + } |
|
74 | + $mother = $family->getWife(); |
|
75 | + if ($mother && $mother->getFirstFact('NAME')) { |
|
76 | + $mother_name = $mother->getFirstFact('NAME')->getValue(); |
|
77 | + } else { |
|
78 | + $mother_name = ''; |
|
79 | + } |
|
80 | + } else { |
|
81 | + $father = null; |
|
82 | + $mother = null; |
|
83 | + $father_name = ''; |
|
84 | + $mother_name = ''; |
|
85 | + } |
|
86 | + if ($individual && $individual->getFirstFact('NAME')) { |
|
87 | + $indi_name = $individual->getFirstFact('NAME')->getValue(); |
|
88 | + } else { |
|
89 | + $indi_name = ''; |
|
90 | + } |
|
91 | + |
|
92 | + switch ($nextaction) { |
|
93 | + case 'add_child_to_family_action': |
|
94 | + $name_fields = array_merge($name_fields, $surname_tradition->newChildNames($father_name, $mother_name, $gender)); |
|
95 | + break; |
|
96 | + case 'add_child_to_individual_action': |
|
97 | + if ($individual->getSex() === 'F') { |
|
98 | + $name_fields = array_merge($name_fields, $surname_tradition->newChildNames('', $indi_name, $gender)); |
|
99 | + } else { |
|
100 | + $name_fields = array_merge($name_fields, $surname_tradition->newChildNames($indi_name, '', $gender)); |
|
101 | + } |
|
102 | + break; |
|
103 | + case 'add_parent_to_individual_action': |
|
104 | + $name_fields = array_merge($name_fields, $surname_tradition->newParentNames($indi_name, $gender)); |
|
105 | + break; |
|
106 | + case 'add_spouse_to_family_action': |
|
107 | + if ($father) { |
|
108 | + $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($father_name, $gender)); |
|
109 | + } else { |
|
110 | + $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($mother_name, $gender)); |
|
111 | + } |
|
112 | + break; |
|
113 | + case 'add_spouse_to_individual_action': |
|
114 | + $name_fields = array_merge($name_fields, $surname_tradition->newSpouseNames($indi_name, $gender)); |
|
115 | + break; |
|
116 | + case 'add_unlinked_indi_action': |
|
117 | + case 'update': |
|
118 | + if ($surname_tradition->hasSurnames()) { |
|
119 | + $name_fields['NAME'] = '//'; |
|
120 | + } |
|
121 | + break; |
|
122 | + } |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | $bdm = ''; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR |
@@ -141,196 +141,196 @@ discard block |
||
141 | 141 | <?php endif ?> |
142 | 142 | |
143 | 143 | <?php |
144 | - // First - standard name fields |
|
145 | - foreach ($name_fields as $tag => $value) { |
|
146 | - if (substr_compare($tag, '_', 0, 1) !== 0) { |
|
147 | - echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value, '', '', null, $individual); |
|
148 | - } |
|
149 | - } |
|
150 | - |
|
151 | - // Second - advanced name fields |
|
152 | - if ($surname_tradition->hasMarriedNames() || preg_match('/\n2 _MARNM /', $namerec)) { |
|
153 | - $adv_name_fields = ['_MARNM' => '']; |
|
154 | - } else { |
|
155 | - $adv_name_fields = []; |
|
156 | - } |
|
157 | - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('ADVANCED_NAME_FACTS'), $match)) { |
|
158 | - foreach ($match[1] as $tag) { |
|
159 | - // Ignore advanced facts that duplicate standard facts |
|
160 | - if (!in_array($tag, ['TYPE', 'NPFX', 'GIVN', 'NICK', 'SPFX', 'SURN', 'NSFX'])) { |
|
161 | - $adv_name_fields[$tag] = ''; |
|
162 | - } |
|
163 | - } |
|
164 | - } |
|
165 | - |
|
166 | - foreach (array_keys($adv_name_fields) as $tag) { |
|
167 | - // Edit existing tags, grouped together |
|
168 | - if (preg_match_all('/2 ' . $tag . ' (.+)/', $namerec, $match)) { |
|
169 | - foreach ($match[1] as $value) { |
|
170 | - echo FunctionsEdit::addSimpleTag($tree, '2 ' . $tag . ' ' . $value, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); |
|
171 | - if ($tag === '_MARNM') { |
|
172 | - preg_match_all('/\/([^\/]*)\//', $value, $matches); |
|
173 | - echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); |
|
174 | - } |
|
175 | - } |
|
176 | - } |
|
177 | - // Allow a new tag to be entered |
|
178 | - if (!array_key_exists($tag, $name_fields)) { |
|
179 | - echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); |
|
180 | - if ($tag === '_MARNM') { |
|
181 | - echo FunctionsEdit::addSimpleTag($tree, '0 _MARNM_SURN'); |
|
182 | - } |
|
183 | - } |
|
184 | - } |
|
185 | - |
|
186 | - // Third - new/existing custom name fields |
|
187 | - foreach ($name_fields as $tag => $value) { |
|
188 | - if (substr_compare($tag, '_', 0, 1) === 0) { |
|
189 | - echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value); |
|
190 | - if ($tag === '_MARNM') { |
|
191 | - preg_match_all('/\/([^\/]*)\//', $value, $matches); |
|
192 | - echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); |
|
193 | - } |
|
194 | - } |
|
195 | - } |
|
196 | - |
|
197 | - // Fourth - SOUR, NOTE, _CUSTOM, etc. |
|
198 | - if ($namerec !== '') { |
|
199 | - $gedlines = explode("\n", $namerec); // -- find the number of lines in the record |
|
200 | - $fields = explode(' ', $gedlines[0]); |
|
201 | - $glevel = $fields[0]; |
|
202 | - $level = $glevel; |
|
203 | - $type = $fields[1]; |
|
204 | - $tags = []; |
|
205 | - $i = 0; |
|
206 | - do { |
|
207 | - if ($type !== 'TYPE' && !array_key_exists($type, $name_fields) && !array_key_exists($type, $adv_name_fields)) { |
|
208 | - $text = ''; |
|
209 | - for ($j = 2; $j < count($fields); $j++) { |
|
210 | - if ($j > 2) { |
|
211 | - $text .= ' '; |
|
212 | - } |
|
213 | - $text .= $fields[$j]; |
|
214 | - } |
|
215 | - while (($i + 1 < count($gedlines)) && (preg_match('/' . ($level + 1) . ' CONT ?(.*)/', $gedlines[$i + 1], $cmatch) > 0)) { |
|
216 | - $text .= "\n" . $cmatch[1]; |
|
217 | - $i++; |
|
218 | - } |
|
219 | - echo FunctionsEdit::addSimpleTag($tree, $level . ' ' . $type . ' ' . $text); |
|
220 | - } |
|
221 | - $tags[] = $type; |
|
222 | - $i++; |
|
223 | - if (isset($gedlines[$i])) { |
|
224 | - $fields = explode(' ', $gedlines[$i]); |
|
225 | - $level = $fields[0]; |
|
226 | - if (isset($fields[1])) { |
|
227 | - $type = $fields[1]; |
|
228 | - } |
|
229 | - } |
|
230 | - } while (($level > $glevel) && ($i < count($gedlines))); |
|
231 | - } |
|
232 | - |
|
233 | - // If we are adding a new individual, add the basic details |
|
234 | - if ($nextaction !== 'update') { |
|
235 | - echo '</table><br><table class="table wt-facts-table">'; |
|
236 | - // 1 SEX |
|
237 | - if ($famtag === 'HUSB' || $gender === 'M') { |
|
238 | - echo FunctionsEdit::addSimpleTag($tree, '0 SEX M'); |
|
239 | - } elseif ($famtag === 'WIFE' || $gender === 'F') { |
|
240 | - echo FunctionsEdit::addSimpleTag($tree, '0 SEX F'); |
|
241 | - } else { |
|
242 | - echo FunctionsEdit::addSimpleTag($tree, '0 SEX U'); |
|
243 | - } |
|
244 | - $bdm = 'BD'; |
|
245 | - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { |
|
246 | - foreach ($matches[1] as $match) { |
|
247 | - if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { |
|
248 | - FunctionsEdit::addSimpleTags($tree, $match); |
|
249 | - } |
|
250 | - } |
|
251 | - } |
|
252 | - //-- if adding a spouse add the option to add a marriage fact to the new family |
|
253 | - if ($nextaction === 'add_spouse_to_individual_action' || $nextaction === 'add_spouse_to_family_action') { |
|
254 | - $bdm .= 'M'; |
|
255 | - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { |
|
256 | - foreach ($matches[1] as $match) { |
|
257 | - FunctionsEdit::addSimpleTags($tree, $match); |
|
258 | - } |
|
259 | - } |
|
260 | - } |
|
261 | - if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { |
|
262 | - foreach ($matches[1] as $match) { |
|
263 | - if (in_array($match, explode('|', WT_EVENTS_DEAT))) { |
|
264 | - FunctionsEdit::addSimpleTags($tree, $match); |
|
265 | - } |
|
266 | - } |
|
267 | - } |
|
268 | - } |
|
269 | - |
|
270 | - echo '</table>'; |
|
271 | - if ($nextaction === 'update') { |
|
272 | - // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE |
|
273 | - echo view('cards/add-source-citation', [ |
|
274 | - 'level' => 2, |
|
275 | - 'full_citations' => $tree->getPreference('FULL_SOURCES'), |
|
276 | - 'tree' => $tree, |
|
277 | - ]); |
|
278 | - echo view('cards/add-note', [ |
|
279 | - 'level' => 2, |
|
280 | - 'tree' => $tree, |
|
281 | - ]); |
|
282 | - echo view('cards/add-shared-note', [ |
|
283 | - 'level' => 2, |
|
284 | - 'tree' => $tree, |
|
285 | - ]); |
|
286 | - echo view('cards/add-restriction', [ |
|
287 | - 'level' => 2, |
|
288 | - 'tree' => $tree, |
|
289 | - ]); |
|
290 | - } else { |
|
291 | - echo view('cards/add-source-citation', [ |
|
292 | - 'bdm' => $bdm, |
|
293 | - 'level' => 1, |
|
294 | - 'full_citations' => $tree->getPreference('FULL_SOURCES'), |
|
295 | - 'prefer_level2_sources' => $tree->getPreference('PREFER_LEVEL2_SOURCES'), |
|
296 | - 'quick_required_facts' => $tree->getPreference('QUICK_REQUIRED_FACTS'), |
|
297 | - 'quick_required_famfacts' => $tree->getPreference('QUICK_REQUIRED_FAMFACTS'), |
|
298 | - 'tree' => $tree, |
|
299 | - ]); |
|
300 | - echo view('cards/add-note', [ |
|
301 | - 'level' => 1, |
|
302 | - 'tree' => $tree, |
|
303 | - ]); |
|
304 | - echo view('cards/add-shared-note', [ |
|
305 | - 'level' => 1, |
|
306 | - 'tree' => $tree, |
|
307 | - ]); |
|
308 | - echo view('cards/add-restriction', [ |
|
309 | - 'level' => 1, |
|
310 | - 'tree' => $tree, |
|
311 | - ]); |
|
312 | - } |
|
313 | - |
|
314 | - ?> |
|
144 | + // First - standard name fields |
|
145 | + foreach ($name_fields as $tag => $value) { |
|
146 | + if (substr_compare($tag, '_', 0, 1) !== 0) { |
|
147 | + echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value, '', '', null, $individual); |
|
148 | + } |
|
149 | + } |
|
150 | + |
|
151 | + // Second - advanced name fields |
|
152 | + if ($surname_tradition->hasMarriedNames() || preg_match('/\n2 _MARNM /', $namerec)) { |
|
153 | + $adv_name_fields = ['_MARNM' => '']; |
|
154 | + } else { |
|
155 | + $adv_name_fields = []; |
|
156 | + } |
|
157 | + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('ADVANCED_NAME_FACTS'), $match)) { |
|
158 | + foreach ($match[1] as $tag) { |
|
159 | + // Ignore advanced facts that duplicate standard facts |
|
160 | + if (!in_array($tag, ['TYPE', 'NPFX', 'GIVN', 'NICK', 'SPFX', 'SURN', 'NSFX'])) { |
|
161 | + $adv_name_fields[$tag] = ''; |
|
162 | + } |
|
163 | + } |
|
164 | + } |
|
165 | + |
|
166 | + foreach (array_keys($adv_name_fields) as $tag) { |
|
167 | + // Edit existing tags, grouped together |
|
168 | + if (preg_match_all('/2 ' . $tag . ' (.+)/', $namerec, $match)) { |
|
169 | + foreach ($match[1] as $value) { |
|
170 | + echo FunctionsEdit::addSimpleTag($tree, '2 ' . $tag . ' ' . $value, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); |
|
171 | + if ($tag === '_MARNM') { |
|
172 | + preg_match_all('/\/([^\/]*)\//', $value, $matches); |
|
173 | + echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); |
|
174 | + } |
|
175 | + } |
|
176 | + } |
|
177 | + // Allow a new tag to be entered |
|
178 | + if (!array_key_exists($tag, $name_fields)) { |
|
179 | + echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag, '', GedcomTag::getLabel('NAME:' . $tag, $individual)); |
|
180 | + if ($tag === '_MARNM') { |
|
181 | + echo FunctionsEdit::addSimpleTag($tree, '0 _MARNM_SURN'); |
|
182 | + } |
|
183 | + } |
|
184 | + } |
|
185 | + |
|
186 | + // Third - new/existing custom name fields |
|
187 | + foreach ($name_fields as $tag => $value) { |
|
188 | + if (substr_compare($tag, '_', 0, 1) === 0) { |
|
189 | + echo FunctionsEdit::addSimpleTag($tree, '0 ' . $tag . ' ' . $value); |
|
190 | + if ($tag === '_MARNM') { |
|
191 | + preg_match_all('/\/([^\/]*)\//', $value, $matches); |
|
192 | + echo FunctionsEdit::addSimpleTag($tree, '2 _MARNM_SURN ' . implode(',', $matches[1])); |
|
193 | + } |
|
194 | + } |
|
195 | + } |
|
196 | + |
|
197 | + // Fourth - SOUR, NOTE, _CUSTOM, etc. |
|
198 | + if ($namerec !== '') { |
|
199 | + $gedlines = explode("\n", $namerec); // -- find the number of lines in the record |
|
200 | + $fields = explode(' ', $gedlines[0]); |
|
201 | + $glevel = $fields[0]; |
|
202 | + $level = $glevel; |
|
203 | + $type = $fields[1]; |
|
204 | + $tags = []; |
|
205 | + $i = 0; |
|
206 | + do { |
|
207 | + if ($type !== 'TYPE' && !array_key_exists($type, $name_fields) && !array_key_exists($type, $adv_name_fields)) { |
|
208 | + $text = ''; |
|
209 | + for ($j = 2; $j < count($fields); $j++) { |
|
210 | + if ($j > 2) { |
|
211 | + $text .= ' '; |
|
212 | + } |
|
213 | + $text .= $fields[$j]; |
|
214 | + } |
|
215 | + while (($i + 1 < count($gedlines)) && (preg_match('/' . ($level + 1) . ' CONT ?(.*)/', $gedlines[$i + 1], $cmatch) > 0)) { |
|
216 | + $text .= "\n" . $cmatch[1]; |
|
217 | + $i++; |
|
218 | + } |
|
219 | + echo FunctionsEdit::addSimpleTag($tree, $level . ' ' . $type . ' ' . $text); |
|
220 | + } |
|
221 | + $tags[] = $type; |
|
222 | + $i++; |
|
223 | + if (isset($gedlines[$i])) { |
|
224 | + $fields = explode(' ', $gedlines[$i]); |
|
225 | + $level = $fields[0]; |
|
226 | + if (isset($fields[1])) { |
|
227 | + $type = $fields[1]; |
|
228 | + } |
|
229 | + } |
|
230 | + } while (($level > $glevel) && ($i < count($gedlines))); |
|
231 | + } |
|
232 | + |
|
233 | + // If we are adding a new individual, add the basic details |
|
234 | + if ($nextaction !== 'update') { |
|
235 | + echo '</table><br><table class="table wt-facts-table">'; |
|
236 | + // 1 SEX |
|
237 | + if ($famtag === 'HUSB' || $gender === 'M') { |
|
238 | + echo FunctionsEdit::addSimpleTag($tree, '0 SEX M'); |
|
239 | + } elseif ($famtag === 'WIFE' || $gender === 'F') { |
|
240 | + echo FunctionsEdit::addSimpleTag($tree, '0 SEX F'); |
|
241 | + } else { |
|
242 | + echo FunctionsEdit::addSimpleTag($tree, '0 SEX U'); |
|
243 | + } |
|
244 | + $bdm = 'BD'; |
|
245 | + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { |
|
246 | + foreach ($matches[1] as $match) { |
|
247 | + if (!in_array($match, explode('|', WT_EVENTS_DEAT))) { |
|
248 | + FunctionsEdit::addSimpleTags($tree, $match); |
|
249 | + } |
|
250 | + } |
|
251 | + } |
|
252 | + //-- if adding a spouse add the option to add a marriage fact to the new family |
|
253 | + if ($nextaction === 'add_spouse_to_individual_action' || $nextaction === 'add_spouse_to_family_action') { |
|
254 | + $bdm .= 'M'; |
|
255 | + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) { |
|
256 | + foreach ($matches[1] as $match) { |
|
257 | + FunctionsEdit::addSimpleTags($tree, $match); |
|
258 | + } |
|
259 | + } |
|
260 | + } |
|
261 | + if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $tree->getPreference('QUICK_REQUIRED_FACTS'), $matches)) { |
|
262 | + foreach ($matches[1] as $match) { |
|
263 | + if (in_array($match, explode('|', WT_EVENTS_DEAT))) { |
|
264 | + FunctionsEdit::addSimpleTags($tree, $match); |
|
265 | + } |
|
266 | + } |
|
267 | + } |
|
268 | + } |
|
269 | + |
|
270 | + echo '</table>'; |
|
271 | + if ($nextaction === 'update') { |
|
272 | + // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE |
|
273 | + echo view('cards/add-source-citation', [ |
|
274 | + 'level' => 2, |
|
275 | + 'full_citations' => $tree->getPreference('FULL_SOURCES'), |
|
276 | + 'tree' => $tree, |
|
277 | + ]); |
|
278 | + echo view('cards/add-note', [ |
|
279 | + 'level' => 2, |
|
280 | + 'tree' => $tree, |
|
281 | + ]); |
|
282 | + echo view('cards/add-shared-note', [ |
|
283 | + 'level' => 2, |
|
284 | + 'tree' => $tree, |
|
285 | + ]); |
|
286 | + echo view('cards/add-restriction', [ |
|
287 | + 'level' => 2, |
|
288 | + 'tree' => $tree, |
|
289 | + ]); |
|
290 | + } else { |
|
291 | + echo view('cards/add-source-citation', [ |
|
292 | + 'bdm' => $bdm, |
|
293 | + 'level' => 1, |
|
294 | + 'full_citations' => $tree->getPreference('FULL_SOURCES'), |
|
295 | + 'prefer_level2_sources' => $tree->getPreference('PREFER_LEVEL2_SOURCES'), |
|
296 | + 'quick_required_facts' => $tree->getPreference('QUICK_REQUIRED_FACTS'), |
|
297 | + 'quick_required_famfacts' => $tree->getPreference('QUICK_REQUIRED_FAMFACTS'), |
|
298 | + 'tree' => $tree, |
|
299 | + ]); |
|
300 | + echo view('cards/add-note', [ |
|
301 | + 'level' => 1, |
|
302 | + 'tree' => $tree, |
|
303 | + ]); |
|
304 | + echo view('cards/add-shared-note', [ |
|
305 | + 'level' => 1, |
|
306 | + 'tree' => $tree, |
|
307 | + ]); |
|
308 | + echo view('cards/add-restriction', [ |
|
309 | + 'level' => 1, |
|
310 | + 'tree' => $tree, |
|
311 | + ]); |
|
312 | + } |
|
313 | + |
|
314 | + ?> |
|
315 | 315 | <div class="row form-group"> |
316 | 316 | <div class="col-sm-9 offset-sm-3"> |
317 | 317 | <button class="btn btn-primary" type="submit"> |
318 | 318 | <?= FontAwesome::decorativeIcon('save') ?> |
319 | 319 | <?= /* I18N: A button label. */ |
320 | - I18N::translate('save') ?> |
|
320 | + I18N::translate('save') ?> |
|
321 | 321 | </button> |
322 | 322 | <?php if (preg_match('/^add_(child|spouse|parent|unlinked_indi)/', $nextaction)): ?> |
323 | 323 | |
324 | 324 | <button class="btn btn-primary" type="submit" name="goto" value="<?= $xref ?>"> |
325 | 325 | <?= FontAwesome::decorativeIcon('save') ?> |
326 | 326 | <?= /* I18N: A button label. */ |
327 | - I18N::translate('go to new individual') ?> |
|
327 | + I18N::translate('go to new individual') ?> |
|
328 | 328 | </button> |
329 | 329 | <?php endif ?> |
330 | 330 | <a class="btn btn-secondary" href="<?= e($cancel_url) ?>"> |
331 | 331 | <?= FontAwesome::decorativeIcon('cancel') ?> |
332 | 332 | <?= /* I18N: A button label. */ |
333 | - I18N::translate('cancel') ?> |
|
333 | + I18N::translate('cancel') ?> |
|
334 | 334 | </a> |
335 | 335 | |
336 | 336 | <?php if ($name_fact instanceof Fact && (Auth::isAdmin() || $tree->getPreference('SHOW_GEDCOM_RECORD'))): ?> |