1
|
|
|
<?php |
|
|
|
|
2
|
|
|
/** |
3
|
|
|
* webtrees: online genealogy |
4
|
|
|
* Copyright (C) 2018 webtrees development team |
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
6
|
|
|
* it under the terms of the GNU General Public License as published by |
7
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
8
|
|
|
* (at your option) any later version. |
9
|
|
|
* This program is distributed in the hope that it will be useful, |
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12
|
|
|
* GNU General Public License for more details. |
13
|
|
|
* You should have received a copy of the GNU General Public License |
14
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
15
|
|
|
*/ |
16
|
|
|
namespace Fisharebest\Webtrees; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Defined in edit_interface.php |
20
|
|
|
* |
21
|
|
|
* @global Individual $person |
22
|
|
|
*/ |
23
|
|
|
global $person; |
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Defined in edit_interface.php |
26
|
|
|
* |
27
|
|
|
* @global Controller\PageController $controller |
28
|
|
|
*/ |
29
|
|
|
global $controller; |
|
|
|
|
30
|
|
|
|
31
|
|
|
?> |
32
|
|
|
<style> |
33
|
|
|
/* Outer border around nav elements */ |
34
|
|
|
.outer_nav { |
35
|
|
|
border: 3px #808080 outset; |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/* top Search box */ |
39
|
|
|
input[type='text'] { |
40
|
|
|
background: #fff; |
41
|
|
|
color: #000; |
42
|
|
|
border: 1px solid #000; |
43
|
|
|
width: 120px; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/* "Head" button images */ |
47
|
|
|
.headimg { |
48
|
|
|
margin-top: -4px; |
49
|
|
|
border: 0; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/* Prevents clickable td for Search <td> */ |
53
|
|
|
td #srch a { |
54
|
|
|
display: inline; |
55
|
|
|
} |
56
|
|
|
</style> |
57
|
|
|
<div id="media-links"> |
58
|
|
|
<table class="center"> |
59
|
|
|
<tr> |
60
|
|
|
<td class="topbottombar"> |
61
|
|
|
<b><?= $controller->getPageTitle() ?></b> |
62
|
|
|
</td> |
63
|
|
|
</tr> |
64
|
|
|
<tr> |
65
|
|
|
<td> |
66
|
|
|
<table class="outer_nav"> |
67
|
|
|
<tr> |
68
|
|
|
<th class="descriptionbox"><?= I18N::translate('Find an individual') ?></th> |
69
|
|
|
</tr> |
70
|
|
|
<tr> |
71
|
|
|
<td id="srch" class="optionbox center"> |
72
|
|
|
<script> |
73
|
|
|
function findindi() { |
74
|
|
|
var findInput = document.getElementById('personid'); |
75
|
|
|
var txt = findInput.value; |
76
|
|
|
if (txt === "") { |
77
|
|
|
alert("<?= I18N::translate('You must enter a name') ?>"); |
78
|
|
|
} else { |
79
|
|
|
window.open("module.php?mod=GEDFact_assistant&mod_action=media_find&callback=paste_id&action=filter&type=indi&multiple=&filter=" + txt, "win02", "resizable=1, menubar=0, scrollbars=1, top=180, left=600, height=600, width=450 ").focus(); |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
</script> |
83
|
|
|
<input id="personid" type="text" value=""> |
84
|
|
|
<a type="submit" onclick="findindi();"> |
85
|
|
|
<?= I18N::translate('Search') ?> |
86
|
|
|
</a> |
87
|
|
|
</td> |
88
|
|
|
</tr> |
89
|
|
|
<tr> |
90
|
|
|
<td> |
91
|
|
|
<table width="100%" class="fact_table" cellspacing="0" border="0"> |
92
|
|
|
<tr> |
93
|
|
|
<td colspan=3 class="descriptionbox wrap"> |
94
|
|
|
<i class="headimg vmiddle icon-button_head"></i> |
95
|
|
|
<?= I18N::translate('View this family') ?> |
96
|
|
|
</td> |
97
|
|
|
</tr> |
98
|
|
|
<?php |
99
|
|
|
foreach ($person->getChildFamilies() as $family) { |
100
|
|
|
echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>'; |
101
|
|
|
print_navigator_family($family, $person); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
foreach ($person->getChildStepFamilies() as $family) { |
105
|
|
|
echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>'; |
106
|
|
|
print_navigator_family($family, $person); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
foreach ($person->getSpouseFamilies() as $family) { |
110
|
|
|
echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>'; |
111
|
|
|
print_navigator_family($family, $person); |
112
|
|
|
} |
113
|
|
|
?> |
114
|
|
|
</table> |
115
|
|
|
</td> |
116
|
|
|
</tr> |
117
|
|
|
</table> |
118
|
|
|
</td> |
119
|
|
|
</tr> |
120
|
|
|
</table> |
121
|
|
|
</div> |
122
|
|
|
<?php |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Display family members with clickable links |
126
|
|
|
* |
127
|
|
|
* @param Family $family |
128
|
|
|
* @param Individual $individual |
129
|
|
|
*/ |
130
|
|
|
function print_navigator_family(Family $family, Individual $individual) { |
131
|
|
|
foreach ($family->getSpouses() as $spouse) { |
132
|
|
|
?> |
133
|
|
|
<tr> |
134
|
|
|
<td> |
135
|
|
|
<a href="#" onclick="opener.insertRowToTable('<?= $spouse->getXref() ?>', '<?= e($spouse->getFullName()) ?>', '', '', '', '', '', '', '', ''); return false;"> |
136
|
|
|
<?= $spouse === $individual ? '<b>' : '' ?> |
137
|
|
|
<?= $spouse->getFullName() ?> <?= $spouse->getLifeSpan() ?> |
138
|
|
|
<?= $spouse === $individual ? '</b>' : '' ?> |
139
|
|
|
</a> |
140
|
|
|
</td> |
141
|
|
|
<td> |
142
|
|
|
<?php if ($individual !== $spouse): ?> |
143
|
|
|
<a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?= $spouse->getXref() ?>&gedcom=<?= $spouse->getTree()->getNameUrl() ?>"> |
144
|
|
|
<i class="headimg vmiddle icon-button_head"></i> |
145
|
|
|
</a> |
146
|
|
|
<?php endif ?> |
147
|
|
|
</td> |
148
|
|
|
<tr> |
149
|
|
|
<?php |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
foreach ($family->getChildren() as $child) { |
153
|
|
|
?> |
154
|
|
|
<tr> |
155
|
|
|
<td> |
156
|
|
|
<a href="#" onclick="opener.insertRowToTable('<?= $child->getXref() ?>', '<?= e($child->getFullName()) ?>', '', '', '', '', '', '', '', ''); return false;"> |
157
|
|
|
<?= $child === $individual ? '<b>' : '' ?> |
158
|
|
|
<?= $child->getFullName() ?> <?= $child->getLifeSpan() ?> |
159
|
|
|
<?= $child === $individual ? '</b>' : '' ?> |
160
|
|
|
</a> |
161
|
|
|
</td> |
162
|
|
|
<td> |
163
|
|
|
<?php if ($individual !== $child): ?> |
164
|
|
|
<a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?= $child->getXref() ?>&gedcom=<?= $child->getTree()->getNameUrl() ?>"> |
165
|
|
|
<i class="headimg vmiddle icon-button_head"></i> |
166
|
|
|
</a> |
167
|
|
|
<?php endif ?> |
168
|
|
|
</td> |
169
|
|
|
</tr> |
170
|
|
|
<?php |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.