|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/** |
|
3
|
|
|
* webtrees: online genealogy |
|
4
|
|
|
* Copyright (C) 2016 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
|
|
|
#media-links table.facts_table { |
|
39
|
|
|
width: 270px; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/* top Search box */ |
|
43
|
|
|
input[type='text'] { |
|
44
|
|
|
background: #fff; |
|
45
|
|
|
color: #000; |
|
46
|
|
|
border: 1px solid #000; |
|
47
|
|
|
width: 120px; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/* "Head" button images */ |
|
51
|
|
|
.headimg { |
|
52
|
|
|
margin-top: -4px; |
|
53
|
|
|
border: 0; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/* Prevents clickable td for Search <td> */ |
|
57
|
|
|
td #srch a { |
|
58
|
|
|
display: inline; |
|
59
|
|
|
} |
|
60
|
|
|
</style> |
|
61
|
|
|
<div id="media-links"> |
|
62
|
|
|
<table class="facts_table center"> |
|
63
|
|
|
<tr> |
|
64
|
|
|
<td class="topbottombar"> |
|
65
|
|
|
<b><?php echo $controller->getPageTitle(); ?></b> |
|
66
|
|
|
</td> |
|
67
|
|
|
</tr> |
|
68
|
|
|
<tr> |
|
69
|
|
|
<td> |
|
70
|
|
|
<table class="outer_nav"> |
|
71
|
|
|
<tr> |
|
72
|
|
|
<th class="descriptionbox"><?php echo I18N::translate('Find an individual'); ?></th> |
|
73
|
|
|
</tr> |
|
74
|
|
|
<tr> |
|
75
|
|
|
<td id="srch" class="optionbox center"> |
|
76
|
|
|
<script> |
|
77
|
|
|
function findindi() { |
|
78
|
|
|
var findInput = document.getElementById('personid'); |
|
79
|
|
|
var txt = findInput.value; |
|
80
|
|
|
if (txt === "") { |
|
81
|
|
|
alert("<?php echo I18N::translate('You must enter a name'); ?>"); |
|
82
|
|
|
} else { |
|
83
|
|
|
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(); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
</script> |
|
87
|
|
|
<input id="personid" type="text" value=""> |
|
88
|
|
|
<a type="submit" onclick="findindi();"> |
|
89
|
|
|
<?php echo I18N::translate('Search'); ?> |
|
90
|
|
|
</a> |
|
91
|
|
|
</td> |
|
92
|
|
|
</tr> |
|
93
|
|
|
<tr> |
|
94
|
|
|
<td> |
|
95
|
|
|
<table width="100%" class="fact_table" cellspacing="0" border="0"> |
|
96
|
|
|
<tr> |
|
97
|
|
|
<td colspan=3 class="descriptionbox wrap"> |
|
98
|
|
|
<i class="headimg vmiddle icon-button_head"></i> |
|
99
|
|
|
<?php echo I18N::translate('View this family'); ?> |
|
100
|
|
|
</td> |
|
101
|
|
|
</tr> |
|
102
|
|
|
<?php |
|
103
|
|
|
foreach ($person->getChildFamilies() as $family) { |
|
104
|
|
|
echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>'; |
|
105
|
|
|
print_navigator_family($family, $person); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
foreach ($person->getChildStepFamilies() as $family) { |
|
109
|
|
|
echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>'; |
|
110
|
|
|
print_navigator_family($family, $person); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
foreach ($person->getSpouseFamilies() as $family) { |
|
114
|
|
|
echo '<tr><th colspan="2">', $family->getFullName(), '</td></tr>'; |
|
115
|
|
|
print_navigator_family($family, $person); |
|
116
|
|
|
} |
|
117
|
|
|
?> |
|
118
|
|
|
</table> |
|
119
|
|
|
</td> |
|
120
|
|
|
</tr> |
|
121
|
|
|
</table> |
|
122
|
|
|
</td> |
|
123
|
|
|
</tr> |
|
124
|
|
|
</table> |
|
125
|
|
|
</div> |
|
126
|
|
|
<?php |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* Display family members with clickable links |
|
130
|
|
|
* |
|
131
|
|
|
* @param Family $family |
|
132
|
|
|
* @param Individual $individual |
|
133
|
|
|
*/ |
|
134
|
|
|
function print_navigator_family(Family $family, Individual $individual) { |
|
135
|
|
View Code Duplication |
foreach ($family->getSpouses() as $spouse) { |
|
136
|
|
|
?> |
|
137
|
|
|
<tr class="fact_value"> |
|
138
|
|
|
<td class="facts_value" > |
|
139
|
|
|
<a href="#" onclick="opener.insertRowToTable('<?php echo $spouse->getXref(); ?>', '<?php echo Filter::escapeJs($spouse->getFullName()); ?>', '', '', '', '', '', '', '', ''); return false;"> |
|
|
|
|
|
|
140
|
|
|
<?php echo $spouse === $individual ? '<b>' : ''; ?> |
|
141
|
|
|
<?php echo $spouse->getFullName(); ?> <?php echo $spouse->getLifeSpan(); ?> |
|
142
|
|
|
<?php echo $spouse === $individual ? '</b>' : ''; ?> |
|
143
|
|
|
</a> |
|
144
|
|
|
</td> |
|
145
|
|
|
<td class="facts_value"> |
|
146
|
|
|
<?php if ($individual !== $spouse): ?> |
|
147
|
|
|
<a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?php echo $spouse->getXref(); ?>&gedcom=<?php echo $spouse->getTree()->getNameUrl(); ?>"> |
|
|
|
|
|
|
148
|
|
|
<i class="headimg vmiddle icon-button_head"></i> |
|
149
|
|
|
</a> |
|
150
|
|
|
<?php endif; ?> |
|
151
|
|
|
</td> |
|
152
|
|
|
<tr> |
|
153
|
|
|
<?php |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
View Code Duplication |
foreach ($family->getChildren() as $child) { |
|
157
|
|
|
?> |
|
158
|
|
|
<tr> |
|
159
|
|
|
<td class="facts_value"> |
|
160
|
|
|
<a href="#" onclick="opener.insertRowToTable('<?php echo $child->getXref(); ?>', '<?php echo Filter::escapeJs($child->getFullName()); ?>', '', '', '', '', '', '', '', ''); return false;"> |
|
|
|
|
|
|
161
|
|
|
<?php echo $child === $individual ? '<b>' : ''; ?> |
|
162
|
|
|
<?php echo $child->getFullName(); ?> <?php echo $child->getLifeSpan(); ?> |
|
163
|
|
|
<?php echo $child === $individual ? '</b>' : ''; ?> |
|
164
|
|
|
</a> |
|
165
|
|
|
</td> |
|
166
|
|
|
<td class="facts_value" > |
|
167
|
|
|
<?php if ($individual !== $child): ?> |
|
168
|
|
|
<a href="edit_interface.php?action=addmedia_links&noteid=newnote&pid=<?php echo $child->getXref(); ?>&gedcom=<?php echo $child->getTree()->getNameUrl(); ?>"> |
|
|
|
|
|
|
169
|
|
|
<i class="headimg vmiddle icon-button_head"></i> |
|
170
|
|
|
</a> |
|
171
|
|
|
<?php endif; ?> |
|
172
|
|
|
</td> |
|
173
|
|
|
</tr> |
|
174
|
|
|
<?php |
|
175
|
|
|
} |
|
176
|
|
|
} |
|
177
|
|
|
|
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.