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
|
<?php
namespace Fisharebest\Webtrees;
/**
* webtrees: online genealogy
* Copyright (C) 2015 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
define('WT_SCRIPT_NAME', 'ancestry.php');
require './includes/session.php';
$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
$controller = new AncestryController;
$controller
->pageHeader()
->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
?>
<div id="ancestry-page">
<h2><?php echo $controller->getPageTitle(); ?></h2>
<form name="people" id="people" method="get" action="?">
<input type="hidden" name="ged" value="<?php echo Filter::escapeHtml(WT_GEDCOM); ?>">
<table class="list_table">
<tr>
<td class="descriptionbox">
<label for="rootid"><?php echo I18N::translate('Individual'); ?></label>
</td>
<td class="optionbox">
<input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php echo $controller->root->getXref(); ?>">
<?php echo print_findindi_link('rootid'); ?>
</td>
<td rowspan="3" class="descriptionbox">
<label><?php echo I18N::translate('Layout'); ?></label>
</td>
<td rowspan="3" class="optionbox">
<label><input type="radio" name="chart_style" value="0" onclick="statusDisable('cousins');"
<?php
if ($controller->chart_style == 0) {
echo 'checked';
}
echo '>', I18N::translate('List'), '</label>';
?>
<label><input type="radio" name="chart_style" value="1" onclick="statusEnable('cousins');"
<?php
if ($controller->chart_style == 1) {
echo 'checked';
}
echo '>', I18N::translate('Booklet'), '</label>';
$disabled = $controller->chart_style === 1 ? '' : 'disabled';
echo '<label>', two_state_checkbox('show_cousins', $controller->show_cousins, "id='cousins' $disabled");
echo I18N::translate('Show cousins'), '</label>';
?>
<label><input type="radio" name="chart_style" value="2" onclick="statusDisable('cousins');"
<?php
if ($controller->chart_style == 2) {
echo 'checked';
}
echo '>', I18N::translate('Individuals'), '</label>';
?>
<label><input type="radio" name="chart_style" value="3"' onclick="statusDisable('cousins');"
<?php
if ($controller->chart_style == 3) {
echo 'checked';
}
echo '>', I18N::translate('Families'), '</label>';
?>
</td>
<td rowspan="3" class="facts_label03">
<input type="submit" value="<?php echo I18N::translate('View'); ?>">
</td>
</tr>
<tr>
<td class="descriptionbox">
<?php echo '<label>', I18N::translate('Generations'), '</label>'; ?>
</td>
<td class="optionbox">
<select name="PEDIGREE_GENERATIONS">
<?php
for ($i = 2; $i <= $MAX_PEDIGREE_GENERATIONS; $i++) {
echo '<option value="', $i, '" ';
if ($i == $controller->generations) {
echo 'selected';
}
echo '>', I18N::number($i), '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td class="descriptionbox">
<?php echo '<label>', I18N::translate('Show details'), '</label>'; ?>
</td>
<td class="optionbox">
<?php echo checkbox('show_full', $controller->showFull());?>
</td>
</tr>
</table>
</form>
<?php
if ($controller->error_message) {
echo '<p class="ui-state-error">', $controller->error_message, '</p>';
return;
}
switch ($controller->chart_style) {
case 0:
// List
echo '<ul id="ancestry_chart" class="chart_common">';
$controller->printChildAscendancy($controller->root, 1, $controller->generations - 1);
echo '</ul>';
echo '<br>';
break;
case 1:
echo '<div id="ancestry_booklet">';
// Booklet
// first page : show indi facts
print_pedigree_person($controller->root, $controller->showFull());
// process the tree
$ancestors = $controller->sosaAncestors($controller->generations - 1);
$ancestors = array_filter($ancestors); // The SOSA array includes empty placeholders
foreach ($ancestors as $sosa => $individual) {
foreach ($individual->getChildFamilies() as $family) {
print_sosa_family($family->getXref(), $individual->getXref(), $sosa, '', '', '', $controller->show_cousins, $controller->showFull());
}
}
echo '</div>';
break;
case 2:
// Individual list
$ancestors = $controller->sosaAncestors($controller->generations);
$ancestors = array_filter($ancestors); // The SOSA array includes empty placeholders
echo '<div id="ancestry-list">', format_indi_table($ancestors, 'sosa'), '</div>';
break;
case 3:
// Family list
$ancestors = $controller->sosaAncestors($controller->generations - 1);
$ancestors = array_filter($ancestors); // The SOSA array includes empty placeholders
$families = array();
foreach ($ancestors as $individual) {
foreach ($individual->getChildFamilies() as $family) {
$families[$family->getXref()] = $family;
}
}
echo '<div id="ancestry-list">', format_fam_table($families), '</div>';
break;
}
echo '</div>';
|