-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaliveinyear.php
215 lines (202 loc) · 10.2 KB
/
aliveinyear.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
<?php
/**
* Individual List
*
* The individual list shows all individuals from a chosen gedcom file. The list is
* setup in two sections. The alphabet bar and the details.
*
* The alphabet bar shows all the available letters users can click. The bar is built
* up from the lastnames first letter. Added to this bar is the symbol @, which is
* shown as a translated version of the variable <var>gm_lang["NN"]</var>, and a
* translated version of the word ALL by means of variable <var>GM_LANG_all</var>.
*
* The details can be shown in two ways, with surnames or without surnames. By default
* the user first sees a list of surnames of the chosen letter and by clicking on a
* surname a list with names of people with that chosen surname is displayed.
*
* Beneath the details list is the option to skip the surname list or show it.
* Depending on the current status of the list.
*
* @package Genmod
* @subpackage Lists
* @version $Id: aliveinyear.php 29 2022-07-17 13:18:20Z Boudewijn $
*/
/**
* Inclusion of the configuration file
*/
require("config.php");
$indilist_controller = new IndilistController();
$trace = false;
PrintHeader($indilist_controller->pagetitle);
print "<div id=\"AliveInYearPage\">";
print "<div class=\"AliveInYearOptionContainer\">";
print "\n\t<div class=\"PageTitleName\">";
PrintHelpLink("alive_in_year_help", "qm");
print str_replace("#YEAR#", $indilist_controller->year, GM_LANG_is_alive_in);
print "</div>";
if ($view != "preview") {
print "\n\t<form name=\"newyear\" action=\"aliveinyear.php\" method=\"get\">";
print "\n\t\t<input type=\"hidden\" name=\"surname_sublist\" value=\"".$indilist_controller->surname_sublist."\" />";
print "\n\t\t<input type=\"hidden\" name=\"alpha\" value=\"".$indilist_controller->alpha."\" />";
print "\n\t\t<input type=\"hidden\" name=\"falpha\" value=\"".$indilist_controller->falpha."\" />";
print "\n\t\t<input type=\"hidden\" name=\"surname\" value=\"".$indilist_controller->surname."\" />";
print "\n\t\t<input type=\"hidden\" name=\"show_all_firstnames\" value=\"".$indilist_controller->show_all_firstnames."\" />";
print "\n\t\t<input type=\"hidden\" name=\"show_all\" value=\"".$indilist_controller->show_all."\" />";
print "\n\t\t<table class=\"NavBlockTable\">\n\t\t\t<tr>";
print "\n\t\t\t<td class=\"NavBlockHeader\" colspan=\"4\">".GM_LANG_choose."</td></tr>";
print "<tr><td class=\"NavBlockLabel\" rowspan=\"4\"><div class=\"HelpIconContainer\">";
PrintHelpLink("year_help", "qm");
print "</div>".GM_LANG_year."</td>";
print "\n\t\t\t<td class=\"NavBlockField\" rowspan=\"4\">";
print "\n\t\t\t\t<input class=\"PidInputField\" type=\"text\" name=\"year\" size=\"3\" value=\"".$indilist_controller->year."\" />";
print "\n\t\t\t\t";
print "\n\t\t\t</td>";
print "<td class=\"NavBlockLabel\">".GM_LANG_aiy_usemaa."</td>";
print "<td class=\"NavBlockField\"><input type=\"checkbox\" name=\"useMAA\" value=\"1\" onclick=\"submit()\"";
if ($indilist_controller->useMAA == "1") print " checked=\"checked\"";
print " /></td></tr>";
print "<tr><td class=\"NavBlockLabel\">".GM_LANG_aiy_trueyears."</td>";
print "<td class=\"NavBlockField\"><input type=\"radio\" name=\"type\" value=\"true\" onclick=\"submit()\"";
if ($indilist_controller->type == "true") print " checked=\"checked\"";
print " /></td></tr>";
print "<tr><td class=\"NavBlockLabel\">".GM_LANG_aiy_narrowyears."</td>";
print "<td class=\"NavBlockField\"><input type=\"radio\" name=\"type\" value=\"narrow\" onclick=\"submit()\"";
if ($indilist_controller->type == "narrow") print " checked=\"checked\"";
print " /></td></tr>";
print "<tr><td class=\"NavBlockLabel\">".GM_LANG_aiy_wideyears."</td>";
print "<td class=\"NavBlockField\"><input type=\"radio\" name=\"type\" value=\"wide\" onclick=\"submit()\"";
if ($indilist_controller->type == "wide") print " checked=\"checked\"";
print " /></td></tr>";
print "\n\t\t\t<tr><td colspan=\"4\" class=\"NavBlockFooter\">";
print "<input type=\"submit\" value=\"".GM_LANG_view."\" /></td>";
print "\n\t\t\t</tr>\n\t\t</table>";
print "\n\t</form>\n";
}
print "</div>";
/**
* Check for the @ symbol
*
* This variable is used for checking if the @ symbol is present in the alphabet list.
* @var boolean $pass
*/
$pass = FALSE;
/**
* Total indilist array
*
* The tindilist array will contain individuals that are extracted from the database.
* @var array $tindilist
*/
$tindilist = array();
/**
* Individual alpha array
*
* The indialpha array will contain all first letters that are extracted from an individuals
* lastname.
* @var array $indialpha
*/
$indialpha = $indilist_controller->GetLetterBar();
// Print the letter bar
if (count($indialpha) > 0) {
print "<div class=\"IndiFamLetterBar\">";
PrintHelpLink("alpha_help", "qm");
print GM_LANG_first_letter_sname."<br />\n";
foreach($indialpha as $key=>$letter) {
if ($letter != "@") {
print "<a href=\"".SCRIPT_NAME."?alpha=".urlencode($letter)."&surname_sublist=".$indilist_controller->surname_sublist."&show_all=no&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year;
if ($indilist_controller->allgeds == "yes") print "&allgeds=yes";
print "\">";
if ($indilist_controller->alpha == $letter && $indilist_controller->show_all == "no") print "<span class=\"Warning\">".htmlspecialchars($letter)."</span>";
else print htmlspecialchars($letter);
print "</a> | \n";
}
if ($letter === "@") {
/**
* @ignore
*/
$pass = TRUE;
}
}
// Add the N.N. link
if ($pass == TRUE) {
if ($indilist_controller->alpha == "@") {
print "<a href=\"".SCRIPT_NAME."?alpha=".urlencode("@")."&surname_sublist=yes&[email protected].&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year;
if ($indilist_controller->allgeds == "yes") print "&allgeds=yes";
print "\"><span class=\"Warning\">".PrintReady(GM_LANG_NN)."</span></a>";
}
else {
print "<a href=\"".SCRIPT_NAME."?alpha=".urlencode("@")."&surname_sublist=yes&[email protected].&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year;
if ($indilist_controller->allgeds == "yes") print "&allgeds=yes";
print "\">".PrintReady(GM_LANG_NN)."</a>";
}
/**
* @ignore
*/
$pass = FALSE;
}
// Add the ALL link
if (GedcomConfig::$LISTS_ALL) {
print " | \n";
if ($indilist_controller->show_all == "yes") {
print "<a href=\"".SCRIPT_NAME."?show_all=yes&surname_sublist=".$indilist_controller->surname_sublist."&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year;
if ($indilist_controller->allgeds == "yes") print "&allgeds=yes";
print "\"><span class=\"Warning\">".GM_LANG_all."</span></a>\n";
}
else {
print "<a href=\"".SCRIPT_NAME."?show_all=yes&surname_sublist=".$indilist_controller->surname_sublist."&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year;
if ($indilist_controller->allgeds == "yes") print "&allgeds=yes";
print "\">".GM_LANG_all."</a>\n";
}
}
if (isset($startalpha)) $indilist_controller->alpha = $startalpha;
print "</div>";
}
//-- escaped letter for regular expressions
if ($indilist_controller->surname_sublist == "yes" && $indilist_controller->show_all == "yes") {
// Get the surnames of all individuals
if ($trace) print "option 1";
$surnames = $indilist_controller->GetAlphaIndiNames();
$indilist_controller->PrintSurnameList($surnames, "&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year);
}
else if ($indilist_controller->surname_sublist == "yes" && $indilist_controller->surname == "" && $indilist_controller->show_all == "no") {
if ($trace) print "option 2";
// NOTE: Get all of the individuals whose last names start with this letter
if ($indilist_controller->alpha != "") {
$surnames = $indilist_controller->GetAlphaIndiNames();
$indilist_controller->PrintSurnameList($surnames, "&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year);
}
}
else {
// NOTE: If the surname is set then only get the names in that surname list
if ($indilist_controller->surname != "" && $indilist_controller->surname_sublist == "yes") {
if ($trace) print "option 3";
$tindilist = $indilist_controller->GetIndis();
}
// NOTE: Get all individuals for the sublist
if ($indilist_controller->surname_sublist == "no" && $indilist_controller->alpha != "" && $indilist_controller->show_all == "no") {
if ($trace) print "option 4 for ".$indilist_controller->alpha;
$tindilist = $indilist_controller->GetIndis();
}
// NOTE: Simplify processing for ALL indilist
// NOTE: Skip surname is yes and ALL is chosen
if ($indilist_controller->surname_sublist == "no" && $indilist_controller->show_all == "yes") {
if ($trace) print "option 5";
$tindilist = $indilist_controller->GetIndis();
$indilist_controller->PrintPersonList($tindilist, true);
}
else {
if ($trace) print "option 6";
// NOTE: If user wishes to skip surname do not print the surname
$indilist_controller->PrintPersonList($tindilist, true);
}
}
if ($indilist_controller->alpha != "" && $indilist_controller->surname == "") {
print "<div class=\"IndiFamShowHideSurnameList\">";
PrintHelpLink("skip_sublist_help", "qm", "skip_surnames");
print "<br /><a href=\"".SCRIPT_NAME."?alpha=".urlencode($indilist_controller->alpha)."&surname_sublist=".($indilist_controller->surname_sublist == "yes" ? "no" : "yes")."&show_all=".$indilist_controller->show_all."&type=".$indilist_controller->type."&useMAA=".$indilist_controller->useMAA."&year=".$indilist_controller->year;
if ($indilist_controller->allgeds == "yes") print "&allgeds=yes";
print "\">".($indilist_controller->surname_sublist == "yes" ? GM_LANG_skip_surnames : GM_LANG_show_surnames)."</a>";
print "</div>";
}
print "</div>\n";
PrintFooter();
?>