@@ -19,401 +19,401 @@ |
||
19 | 19 | * A GEDCOM family (FAM) object. |
20 | 20 | */ |
21 | 21 | class Family extends GedcomRecord { |
22 | - const RECORD_TYPE = 'FAM'; |
|
23 | - const URL_PREFIX = 'family.php?famid='; |
|
24 | - |
|
25 | - /** @var Individual|null The husband (or first spouse for same-sex couples) */ |
|
26 | - private $husb; |
|
27 | - |
|
28 | - /** @var Individual|null The wife (or second spouse for same-sex couples) */ |
|
29 | - private $wife; |
|
30 | - |
|
31 | - /** |
|
32 | - * Create a GedcomRecord object from raw GEDCOM data. |
|
33 | - * |
|
34 | - * @param string $xref |
|
35 | - * @param string $gedcom an empty string for new/pending records |
|
36 | - * @param string|null $pending null for a record with no pending edits, |
|
37 | - * empty string for records with pending deletions |
|
38 | - * @param Tree $tree |
|
39 | - */ |
|
40 | - public function __construct($xref, $gedcom, $pending, $tree) { |
|
41 | - parent::__construct($xref, $gedcom, $pending, $tree); |
|
42 | - |
|
43 | - // Fetch family members |
|
44 | - if (preg_match_all('/^1 (?:HUSB|WIFE|CHIL) @(.+)@/m', $gedcom . $pending, $match)) { |
|
45 | - Individual::load($tree, $match[1]); |
|
46 | - } |
|
47 | - |
|
48 | - if (preg_match('/^1 HUSB @(.+)@/m', $gedcom . $pending, $match)) { |
|
49 | - $this->husb = Individual::getInstance($match[1], $tree); |
|
50 | - } |
|
51 | - if (preg_match('/^1 WIFE @(.+)@/m', $gedcom . $pending, $match)) { |
|
52 | - $this->wife = Individual::getInstance($match[1], $tree); |
|
53 | - } |
|
54 | - |
|
55 | - // Make sure husb/wife are the right way round. |
|
56 | - if ($this->husb && $this->husb->getSex() === 'F' || $this->wife && $this->wife->getSex() === 'M') { |
|
57 | - list($this->husb, $this->wife) = array($this->wife, $this->husb); |
|
58 | - } |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * Generate a private version of this record |
|
63 | - * |
|
64 | - * @param int $access_level |
|
65 | - * |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - protected function createPrivateGedcomRecord($access_level) { |
|
69 | - $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
70 | - |
|
71 | - $rec = '0 @' . $this->xref . '@ FAM'; |
|
72 | - // Just show the 1 CHIL/HUSB/WIFE tag, not any subtags, which may contain private data |
|
73 | - preg_match_all('/\n1 (?:CHIL|HUSB|WIFE) @(' . WT_REGEX_XREF . ')@/', $this->gedcom, $matches, PREG_SET_ORDER); |
|
74 | - foreach ($matches as $match) { |
|
75 | - $rela = Individual::getInstance($match[1], $this->tree); |
|
76 | - if ($rela && ($SHOW_PRIVATE_RELATIONSHIPS || $rela->canShow($access_level))) { |
|
77 | - $rec .= $match[0]; |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - return $rec; |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * Fetch data from the database |
|
86 | - * |
|
87 | - * @param string $xref |
|
88 | - * @param int $tree_id |
|
89 | - * |
|
90 | - * @return null|string |
|
91 | - */ |
|
92 | - protected static function fetchGedcomRecord($xref, $tree_id) { |
|
93 | - return Database::prepare( |
|
94 | - "SELECT f_gedcom FROM `##families` WHERE f_id = :xref AND f_file = :tree_id" |
|
95 | - )->execute(array( |
|
96 | - 'xref' => $xref, |
|
97 | - 'tree_id' => $tree_id, |
|
98 | - ))->fetchOne(); |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * Get the male (or first female) partner of the family |
|
103 | - * |
|
104 | - * @param $access_level int|null |
|
105 | - * |
|
106 | - * @return Individual|null |
|
107 | - */ |
|
108 | - public function getHusband($access_level = null) { |
|
109 | - $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
110 | - |
|
111 | - if ($this->husb && ($SHOW_PRIVATE_RELATIONSHIPS || $this->husb->canShowName($access_level))) { |
|
112 | - return $this->husb; |
|
113 | - } else { |
|
114 | - return null; |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * Get the female (or second male) partner of the family |
|
120 | - * |
|
121 | - * @param $access_level int|null |
|
122 | - * |
|
123 | - * @return Individual|null |
|
124 | - */ |
|
125 | - public function getWife($access_level = null) { |
|
126 | - $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
127 | - |
|
128 | - if ($this->wife && ($SHOW_PRIVATE_RELATIONSHIPS || $this->wife->canShowName($access_level))) { |
|
129 | - return $this->wife; |
|
130 | - } else { |
|
131 | - return null; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Each object type may have its own special rules, and re-implement this function. |
|
137 | - * |
|
138 | - * @param int $access_level |
|
139 | - * |
|
140 | - * @return bool |
|
141 | - */ |
|
142 | - protected function canShowByType($access_level) { |
|
143 | - // Hide a family if any member is private |
|
144 | - preg_match_all('/\n1 (?:CHIL|HUSB|WIFE) @(' . WT_REGEX_XREF . ')@/', $this->gedcom, $matches); |
|
145 | - foreach ($matches[1] as $match) { |
|
146 | - $person = Individual::getInstance($match, $this->tree); |
|
147 | - if ($person && !$person->canShow($access_level)) { |
|
148 | - return false; |
|
149 | - } |
|
150 | - } |
|
151 | - |
|
152 | - return true; |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Can the name of this record be shown? |
|
157 | - * |
|
158 | - * @param int|null $access_level |
|
159 | - * |
|
160 | - * @return bool |
|
161 | - */ |
|
162 | - public function canShowName($access_level = null) { |
|
163 | - // We can always see the name (Husband-name + Wife-name), however, |
|
164 | - // the name will often be "private + private" |
|
165 | - return true; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Find the spouse of a person. |
|
170 | - * |
|
171 | - * @param Individual $person |
|
172 | - * @param int|null $access_level |
|
173 | - * |
|
174 | - * @return Individual|null |
|
175 | - */ |
|
176 | - public function getSpouse(Individual $person, $access_level = null) { |
|
177 | - if ($person === $this->wife) { |
|
178 | - return $this->getHusband($access_level); |
|
179 | - } else { |
|
180 | - return $this->getWife($access_level); |
|
181 | - } |
|
182 | - } |
|
183 | - |
|
184 | - /** |
|
185 | - * Get the (zero, one or two) spouses from this family. |
|
186 | - * |
|
187 | - * @param int|null $access_level |
|
188 | - * |
|
189 | - * @return Individual[] |
|
190 | - */ |
|
191 | - public function getSpouses($access_level = null) { |
|
192 | - return array_filter(array( |
|
193 | - $this->getHusband($access_level), |
|
194 | - $this->getWife($access_level), |
|
195 | - )); |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * Get a list of this family’s children. |
|
200 | - * |
|
201 | - * @param int|null $access_level |
|
202 | - * |
|
203 | - * @return Individual[] |
|
204 | - */ |
|
205 | - public function getChildren($access_level = null) { |
|
206 | - if ($access_level === null) { |
|
207 | - $access_level = Auth::accessLevel($this->tree); |
|
208 | - } |
|
209 | - |
|
210 | - $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
211 | - |
|
212 | - $children = array(); |
|
213 | - foreach ($this->getFacts('CHIL', false, $access_level, $SHOW_PRIVATE_RELATIONSHIPS) as $fact) { |
|
214 | - $child = $fact->getTarget(); |
|
215 | - if ($child && ($SHOW_PRIVATE_RELATIONSHIPS || $child->canShowName($access_level))) { |
|
216 | - $children[] = $child; |
|
217 | - } |
|
218 | - } |
|
219 | - |
|
220 | - return $children; |
|
221 | - } |
|
222 | - |
|
223 | - /** |
|
224 | - * Static helper function to sort an array of families by marriage date |
|
225 | - * |
|
226 | - * @param Family $x |
|
227 | - * @param Family $y |
|
228 | - * |
|
229 | - * @return int |
|
230 | - */ |
|
231 | - public static function compareMarrDate(Family $x, Family $y) { |
|
232 | - return Date::compare($x->getMarriageDate(), $y->getMarriageDate()); |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * Number of children - for the individual list |
|
237 | - * |
|
238 | - * @return int |
|
239 | - */ |
|
240 | - public function getNumberOfChildren() { |
|
241 | - $nchi = count($this->getChildren()); |
|
242 | - foreach ($this->getFacts('NCHI') as $fact) { |
|
243 | - $nchi = max($nchi, (int) $fact->getValue()); |
|
244 | - } |
|
245 | - |
|
246 | - return $nchi; |
|
247 | - } |
|
248 | - |
|
249 | - /** |
|
250 | - * get the marriage event |
|
251 | - * |
|
252 | - * @return Fact |
|
253 | - */ |
|
254 | - public function getMarriage() { |
|
255 | - return $this->getFirstFact('MARR'); |
|
256 | - } |
|
257 | - |
|
258 | - /** |
|
259 | - * Get marriage date |
|
260 | - * |
|
261 | - * @return Date |
|
262 | - */ |
|
263 | - public function getMarriageDate() { |
|
264 | - $marriage = $this->getMarriage(); |
|
265 | - if ($marriage) { |
|
266 | - return $marriage->getDate(); |
|
267 | - } else { |
|
268 | - return new Date(''); |
|
269 | - } |
|
270 | - } |
|
271 | - |
|
272 | - /** |
|
273 | - * Get the marriage year - displayed on lists of families |
|
274 | - * |
|
275 | - * @return int |
|
276 | - */ |
|
277 | - public function getMarriageYear() { |
|
278 | - return $this->getMarriageDate()->minimumDate()->y; |
|
279 | - } |
|
280 | - |
|
281 | - /** |
|
282 | - * Get the type for this marriage |
|
283 | - * |
|
284 | - * @return string|null |
|
285 | - */ |
|
286 | - public function getMarriageType() { |
|
287 | - $marriage = $this->getMarriage(); |
|
288 | - if ($marriage) { |
|
289 | - return $marriage->getAttribute('TYPE'); |
|
290 | - } else { |
|
291 | - return null; |
|
292 | - } |
|
293 | - } |
|
294 | - |
|
295 | - /** |
|
296 | - * Get the marriage place |
|
297 | - * |
|
298 | - * @return Place |
|
299 | - */ |
|
300 | - public function getMarriagePlace() { |
|
301 | - $marriage = $this->getMarriage(); |
|
302 | - |
|
303 | - return $marriage->getPlace(); |
|
304 | - } |
|
305 | - |
|
306 | - /** |
|
307 | - * Get a list of all marriage dates - for the family lists. |
|
308 | - * |
|
309 | - * @return Date[] |
|
310 | - */ |
|
311 | - public function getAllMarriageDates() { |
|
312 | - foreach (explode('|', WT_EVENTS_MARR) as $event) { |
|
313 | - if ($array = $this->getAllEventDates($event)) { |
|
314 | - return $array; |
|
315 | - } |
|
316 | - } |
|
317 | - |
|
318 | - return array(); |
|
319 | - } |
|
320 | - |
|
321 | - /** |
|
322 | - * Get a list of all marriage places - for the family lists. |
|
323 | - * |
|
324 | - * @return string[] |
|
325 | - */ |
|
326 | - public function getAllMarriagePlaces() { |
|
327 | - foreach (explode('|', WT_EVENTS_MARR) as $event) { |
|
328 | - if ($array = $this->getAllEventPlaces($event)) { |
|
329 | - return $array; |
|
330 | - } |
|
331 | - } |
|
332 | - |
|
333 | - return array(); |
|
334 | - } |
|
335 | - |
|
336 | - /** |
|
337 | - * Derived classes should redefine this function, otherwise the object will have no name |
|
338 | - * |
|
339 | - * @return string[][] |
|
340 | - */ |
|
341 | - public function getAllNames() { |
|
342 | - if (is_null($this->_getAllNames)) { |
|
343 | - // Check the script used by each name, so we can match cyrillic with cyrillic, greek with greek, etc. |
|
344 | - $husb_names = array(); |
|
345 | - if ($this->husb) { |
|
346 | - $husb_names = array_filter($this->husb->getAllNames(), function(array $x) { return $x['type'] !== '_MARNM'; } ); |
|
347 | - } |
|
348 | - // If the individual only has married names, create a dummy birth name. |
|
349 | - if (empty($husb_names)) { |
|
350 | - $husb_names[] = array( |
|
351 | - 'type' => 'BIRT', |
|
352 | - 'sort' => '@N.N.', |
|
353 | - 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…'), |
|
354 | - ); |
|
355 | - } |
|
356 | - foreach ($husb_names as $n => $husb_name) { |
|
357 | - $husb_names[$n]['script'] = I18N::textScript($husb_name['full']); |
|
358 | - } |
|
359 | - |
|
360 | - $wife_names = array(); |
|
361 | - if ($this->wife) { |
|
362 | - $wife_names = array_filter($this->wife->getAllNames(), function(array $x) { return $x['type'] !== '_MARNM'; } ); |
|
363 | - } |
|
364 | - // If the individual only has married names, create a dummy birth name. |
|
365 | - if (empty($wife_names)) { |
|
366 | - $wife_names[] = array( |
|
367 | - 'type' => 'BIRT', |
|
368 | - 'sort' => '@N.N.', |
|
369 | - 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…'), |
|
370 | - ); |
|
371 | - } |
|
372 | - foreach ($wife_names as $n => $wife_name) { |
|
373 | - $wife_names[$n]['script'] = I18N::textScript($wife_name['full']); |
|
374 | - } |
|
375 | - |
|
376 | - // Add the matched names first |
|
377 | - foreach ($husb_names as $husb_name) { |
|
378 | - foreach ($wife_names as $wife_name) { |
|
379 | - if ($husb_name['script'] == $wife_name['script']) { |
|
380 | - $this->_getAllNames[] = array( |
|
381 | - 'type' => $husb_name['type'], |
|
382 | - 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], |
|
383 | - 'full' => $husb_name['full'] . ' + ' . $wife_name['full'], |
|
384 | - // No need for a fullNN entry - we do not currently store FAM names in the database |
|
385 | - ); |
|
386 | - } |
|
387 | - } |
|
388 | - } |
|
389 | - |
|
390 | - // Add the unmatched names second (there may be no matched names) |
|
391 | - foreach ($husb_names as $husb_name) { |
|
392 | - foreach ($wife_names as $wife_name) { |
|
393 | - if ($husb_name['script'] != $wife_name['script']) { |
|
394 | - $this->_getAllNames[] = array( |
|
395 | - 'type' => $husb_name['type'], |
|
396 | - 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], |
|
397 | - 'full' => $husb_name['full'] . ' + ' . $wife_name['full'], |
|
398 | - // No need for a fullNN entry - we do not currently store FAM names in the database |
|
399 | - ); |
|
400 | - } |
|
401 | - } |
|
402 | - } |
|
403 | - } |
|
404 | - |
|
405 | - return $this->_getAllNames; |
|
406 | - } |
|
407 | - |
|
408 | - /** |
|
409 | - * This function should be redefined in derived classes to show any major |
|
410 | - * identifying characteristics of this record. |
|
411 | - * |
|
412 | - * @return string |
|
413 | - */ |
|
414 | - public function formatListDetails() { |
|
415 | - return |
|
416 | - $this->formatFirstMajorFact(WT_EVENTS_MARR, 1) . |
|
417 | - $this->formatFirstMajorFact(WT_EVENTS_DIV, 1); |
|
418 | - } |
|
22 | + const RECORD_TYPE = 'FAM'; |
|
23 | + const URL_PREFIX = 'family.php?famid='; |
|
24 | + |
|
25 | + /** @var Individual|null The husband (or first spouse for same-sex couples) */ |
|
26 | + private $husb; |
|
27 | + |
|
28 | + /** @var Individual|null The wife (or second spouse for same-sex couples) */ |
|
29 | + private $wife; |
|
30 | + |
|
31 | + /** |
|
32 | + * Create a GedcomRecord object from raw GEDCOM data. |
|
33 | + * |
|
34 | + * @param string $xref |
|
35 | + * @param string $gedcom an empty string for new/pending records |
|
36 | + * @param string|null $pending null for a record with no pending edits, |
|
37 | + * empty string for records with pending deletions |
|
38 | + * @param Tree $tree |
|
39 | + */ |
|
40 | + public function __construct($xref, $gedcom, $pending, $tree) { |
|
41 | + parent::__construct($xref, $gedcom, $pending, $tree); |
|
42 | + |
|
43 | + // Fetch family members |
|
44 | + if (preg_match_all('/^1 (?:HUSB|WIFE|CHIL) @(.+)@/m', $gedcom . $pending, $match)) { |
|
45 | + Individual::load($tree, $match[1]); |
|
46 | + } |
|
47 | + |
|
48 | + if (preg_match('/^1 HUSB @(.+)@/m', $gedcom . $pending, $match)) { |
|
49 | + $this->husb = Individual::getInstance($match[1], $tree); |
|
50 | + } |
|
51 | + if (preg_match('/^1 WIFE @(.+)@/m', $gedcom . $pending, $match)) { |
|
52 | + $this->wife = Individual::getInstance($match[1], $tree); |
|
53 | + } |
|
54 | + |
|
55 | + // Make sure husb/wife are the right way round. |
|
56 | + if ($this->husb && $this->husb->getSex() === 'F' || $this->wife && $this->wife->getSex() === 'M') { |
|
57 | + list($this->husb, $this->wife) = array($this->wife, $this->husb); |
|
58 | + } |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * Generate a private version of this record |
|
63 | + * |
|
64 | + * @param int $access_level |
|
65 | + * |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + protected function createPrivateGedcomRecord($access_level) { |
|
69 | + $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
70 | + |
|
71 | + $rec = '0 @' . $this->xref . '@ FAM'; |
|
72 | + // Just show the 1 CHIL/HUSB/WIFE tag, not any subtags, which may contain private data |
|
73 | + preg_match_all('/\n1 (?:CHIL|HUSB|WIFE) @(' . WT_REGEX_XREF . ')@/', $this->gedcom, $matches, PREG_SET_ORDER); |
|
74 | + foreach ($matches as $match) { |
|
75 | + $rela = Individual::getInstance($match[1], $this->tree); |
|
76 | + if ($rela && ($SHOW_PRIVATE_RELATIONSHIPS || $rela->canShow($access_level))) { |
|
77 | + $rec .= $match[0]; |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + return $rec; |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * Fetch data from the database |
|
86 | + * |
|
87 | + * @param string $xref |
|
88 | + * @param int $tree_id |
|
89 | + * |
|
90 | + * @return null|string |
|
91 | + */ |
|
92 | + protected static function fetchGedcomRecord($xref, $tree_id) { |
|
93 | + return Database::prepare( |
|
94 | + "SELECT f_gedcom FROM `##families` WHERE f_id = :xref AND f_file = :tree_id" |
|
95 | + )->execute(array( |
|
96 | + 'xref' => $xref, |
|
97 | + 'tree_id' => $tree_id, |
|
98 | + ))->fetchOne(); |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * Get the male (or first female) partner of the family |
|
103 | + * |
|
104 | + * @param $access_level int|null |
|
105 | + * |
|
106 | + * @return Individual|null |
|
107 | + */ |
|
108 | + public function getHusband($access_level = null) { |
|
109 | + $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
110 | + |
|
111 | + if ($this->husb && ($SHOW_PRIVATE_RELATIONSHIPS || $this->husb->canShowName($access_level))) { |
|
112 | + return $this->husb; |
|
113 | + } else { |
|
114 | + return null; |
|
115 | + } |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * Get the female (or second male) partner of the family |
|
120 | + * |
|
121 | + * @param $access_level int|null |
|
122 | + * |
|
123 | + * @return Individual|null |
|
124 | + */ |
|
125 | + public function getWife($access_level = null) { |
|
126 | + $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
127 | + |
|
128 | + if ($this->wife && ($SHOW_PRIVATE_RELATIONSHIPS || $this->wife->canShowName($access_level))) { |
|
129 | + return $this->wife; |
|
130 | + } else { |
|
131 | + return null; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Each object type may have its own special rules, and re-implement this function. |
|
137 | + * |
|
138 | + * @param int $access_level |
|
139 | + * |
|
140 | + * @return bool |
|
141 | + */ |
|
142 | + protected function canShowByType($access_level) { |
|
143 | + // Hide a family if any member is private |
|
144 | + preg_match_all('/\n1 (?:CHIL|HUSB|WIFE) @(' . WT_REGEX_XREF . ')@/', $this->gedcom, $matches); |
|
145 | + foreach ($matches[1] as $match) { |
|
146 | + $person = Individual::getInstance($match, $this->tree); |
|
147 | + if ($person && !$person->canShow($access_level)) { |
|
148 | + return false; |
|
149 | + } |
|
150 | + } |
|
151 | + |
|
152 | + return true; |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Can the name of this record be shown? |
|
157 | + * |
|
158 | + * @param int|null $access_level |
|
159 | + * |
|
160 | + * @return bool |
|
161 | + */ |
|
162 | + public function canShowName($access_level = null) { |
|
163 | + // We can always see the name (Husband-name + Wife-name), however, |
|
164 | + // the name will often be "private + private" |
|
165 | + return true; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Find the spouse of a person. |
|
170 | + * |
|
171 | + * @param Individual $person |
|
172 | + * @param int|null $access_level |
|
173 | + * |
|
174 | + * @return Individual|null |
|
175 | + */ |
|
176 | + public function getSpouse(Individual $person, $access_level = null) { |
|
177 | + if ($person === $this->wife) { |
|
178 | + return $this->getHusband($access_level); |
|
179 | + } else { |
|
180 | + return $this->getWife($access_level); |
|
181 | + } |
|
182 | + } |
|
183 | + |
|
184 | + /** |
|
185 | + * Get the (zero, one or two) spouses from this family. |
|
186 | + * |
|
187 | + * @param int|null $access_level |
|
188 | + * |
|
189 | + * @return Individual[] |
|
190 | + */ |
|
191 | + public function getSpouses($access_level = null) { |
|
192 | + return array_filter(array( |
|
193 | + $this->getHusband($access_level), |
|
194 | + $this->getWife($access_level), |
|
195 | + )); |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * Get a list of this family’s children. |
|
200 | + * |
|
201 | + * @param int|null $access_level |
|
202 | + * |
|
203 | + * @return Individual[] |
|
204 | + */ |
|
205 | + public function getChildren($access_level = null) { |
|
206 | + if ($access_level === null) { |
|
207 | + $access_level = Auth::accessLevel($this->tree); |
|
208 | + } |
|
209 | + |
|
210 | + $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
|
211 | + |
|
212 | + $children = array(); |
|
213 | + foreach ($this->getFacts('CHIL', false, $access_level, $SHOW_PRIVATE_RELATIONSHIPS) as $fact) { |
|
214 | + $child = $fact->getTarget(); |
|
215 | + if ($child && ($SHOW_PRIVATE_RELATIONSHIPS || $child->canShowName($access_level))) { |
|
216 | + $children[] = $child; |
|
217 | + } |
|
218 | + } |
|
219 | + |
|
220 | + return $children; |
|
221 | + } |
|
222 | + |
|
223 | + /** |
|
224 | + * Static helper function to sort an array of families by marriage date |
|
225 | + * |
|
226 | + * @param Family $x |
|
227 | + * @param Family $y |
|
228 | + * |
|
229 | + * @return int |
|
230 | + */ |
|
231 | + public static function compareMarrDate(Family $x, Family $y) { |
|
232 | + return Date::compare($x->getMarriageDate(), $y->getMarriageDate()); |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * Number of children - for the individual list |
|
237 | + * |
|
238 | + * @return int |
|
239 | + */ |
|
240 | + public function getNumberOfChildren() { |
|
241 | + $nchi = count($this->getChildren()); |
|
242 | + foreach ($this->getFacts('NCHI') as $fact) { |
|
243 | + $nchi = max($nchi, (int) $fact->getValue()); |
|
244 | + } |
|
245 | + |
|
246 | + return $nchi; |
|
247 | + } |
|
248 | + |
|
249 | + /** |
|
250 | + * get the marriage event |
|
251 | + * |
|
252 | + * @return Fact |
|
253 | + */ |
|
254 | + public function getMarriage() { |
|
255 | + return $this->getFirstFact('MARR'); |
|
256 | + } |
|
257 | + |
|
258 | + /** |
|
259 | + * Get marriage date |
|
260 | + * |
|
261 | + * @return Date |
|
262 | + */ |
|
263 | + public function getMarriageDate() { |
|
264 | + $marriage = $this->getMarriage(); |
|
265 | + if ($marriage) { |
|
266 | + return $marriage->getDate(); |
|
267 | + } else { |
|
268 | + return new Date(''); |
|
269 | + } |
|
270 | + } |
|
271 | + |
|
272 | + /** |
|
273 | + * Get the marriage year - displayed on lists of families |
|
274 | + * |
|
275 | + * @return int |
|
276 | + */ |
|
277 | + public function getMarriageYear() { |
|
278 | + return $this->getMarriageDate()->minimumDate()->y; |
|
279 | + } |
|
280 | + |
|
281 | + /** |
|
282 | + * Get the type for this marriage |
|
283 | + * |
|
284 | + * @return string|null |
|
285 | + */ |
|
286 | + public function getMarriageType() { |
|
287 | + $marriage = $this->getMarriage(); |
|
288 | + if ($marriage) { |
|
289 | + return $marriage->getAttribute('TYPE'); |
|
290 | + } else { |
|
291 | + return null; |
|
292 | + } |
|
293 | + } |
|
294 | + |
|
295 | + /** |
|
296 | + * Get the marriage place |
|
297 | + * |
|
298 | + * @return Place |
|
299 | + */ |
|
300 | + public function getMarriagePlace() { |
|
301 | + $marriage = $this->getMarriage(); |
|
302 | + |
|
303 | + return $marriage->getPlace(); |
|
304 | + } |
|
305 | + |
|
306 | + /** |
|
307 | + * Get a list of all marriage dates - for the family lists. |
|
308 | + * |
|
309 | + * @return Date[] |
|
310 | + */ |
|
311 | + public function getAllMarriageDates() { |
|
312 | + foreach (explode('|', WT_EVENTS_MARR) as $event) { |
|
313 | + if ($array = $this->getAllEventDates($event)) { |
|
314 | + return $array; |
|
315 | + } |
|
316 | + } |
|
317 | + |
|
318 | + return array(); |
|
319 | + } |
|
320 | + |
|
321 | + /** |
|
322 | + * Get a list of all marriage places - for the family lists. |
|
323 | + * |
|
324 | + * @return string[] |
|
325 | + */ |
|
326 | + public function getAllMarriagePlaces() { |
|
327 | + foreach (explode('|', WT_EVENTS_MARR) as $event) { |
|
328 | + if ($array = $this->getAllEventPlaces($event)) { |
|
329 | + return $array; |
|
330 | + } |
|
331 | + } |
|
332 | + |
|
333 | + return array(); |
|
334 | + } |
|
335 | + |
|
336 | + /** |
|
337 | + * Derived classes should redefine this function, otherwise the object will have no name |
|
338 | + * |
|
339 | + * @return string[][] |
|
340 | + */ |
|
341 | + public function getAllNames() { |
|
342 | + if (is_null($this->_getAllNames)) { |
|
343 | + // Check the script used by each name, so we can match cyrillic with cyrillic, greek with greek, etc. |
|
344 | + $husb_names = array(); |
|
345 | + if ($this->husb) { |
|
346 | + $husb_names = array_filter($this->husb->getAllNames(), function(array $x) { return $x['type'] !== '_MARNM'; } ); |
|
347 | + } |
|
348 | + // If the individual only has married names, create a dummy birth name. |
|
349 | + if (empty($husb_names)) { |
|
350 | + $husb_names[] = array( |
|
351 | + 'type' => 'BIRT', |
|
352 | + 'sort' => '@N.N.', |
|
353 | + 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…'), |
|
354 | + ); |
|
355 | + } |
|
356 | + foreach ($husb_names as $n => $husb_name) { |
|
357 | + $husb_names[$n]['script'] = I18N::textScript($husb_name['full']); |
|
358 | + } |
|
359 | + |
|
360 | + $wife_names = array(); |
|
361 | + if ($this->wife) { |
|
362 | + $wife_names = array_filter($this->wife->getAllNames(), function(array $x) { return $x['type'] !== '_MARNM'; } ); |
|
363 | + } |
|
364 | + // If the individual only has married names, create a dummy birth name. |
|
365 | + if (empty($wife_names)) { |
|
366 | + $wife_names[] = array( |
|
367 | + 'type' => 'BIRT', |
|
368 | + 'sort' => '@N.N.', |
|
369 | + 'full' => I18N::translateContext('Unknown given name', '…') . ' ' . I18N::translateContext('Unknown surname', '…'), |
|
370 | + ); |
|
371 | + } |
|
372 | + foreach ($wife_names as $n => $wife_name) { |
|
373 | + $wife_names[$n]['script'] = I18N::textScript($wife_name['full']); |
|
374 | + } |
|
375 | + |
|
376 | + // Add the matched names first |
|
377 | + foreach ($husb_names as $husb_name) { |
|
378 | + foreach ($wife_names as $wife_name) { |
|
379 | + if ($husb_name['script'] == $wife_name['script']) { |
|
380 | + $this->_getAllNames[] = array( |
|
381 | + 'type' => $husb_name['type'], |
|
382 | + 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], |
|
383 | + 'full' => $husb_name['full'] . ' + ' . $wife_name['full'], |
|
384 | + // No need for a fullNN entry - we do not currently store FAM names in the database |
|
385 | + ); |
|
386 | + } |
|
387 | + } |
|
388 | + } |
|
389 | + |
|
390 | + // Add the unmatched names second (there may be no matched names) |
|
391 | + foreach ($husb_names as $husb_name) { |
|
392 | + foreach ($wife_names as $wife_name) { |
|
393 | + if ($husb_name['script'] != $wife_name['script']) { |
|
394 | + $this->_getAllNames[] = array( |
|
395 | + 'type' => $husb_name['type'], |
|
396 | + 'sort' => $husb_name['sort'] . ' + ' . $wife_name['sort'], |
|
397 | + 'full' => $husb_name['full'] . ' + ' . $wife_name['full'], |
|
398 | + // No need for a fullNN entry - we do not currently store FAM names in the database |
|
399 | + ); |
|
400 | + } |
|
401 | + } |
|
402 | + } |
|
403 | + } |
|
404 | + |
|
405 | + return $this->_getAllNames; |
|
406 | + } |
|
407 | + |
|
408 | + /** |
|
409 | + * This function should be redefined in derived classes to show any major |
|
410 | + * identifying characteristics of this record. |
|
411 | + * |
|
412 | + * @return string |
|
413 | + */ |
|
414 | + public function formatListDetails() { |
|
415 | + return |
|
416 | + $this->formatFirstMajorFact(WT_EVENTS_MARR, 1) . |
|
417 | + $this->formatFirstMajorFact(WT_EVENTS_DIV, 1); |
|
418 | + } |
|
419 | 419 | } |
@@ -21,33 +21,33 @@ |
||
21 | 21 | * Was the individual born in "foreign parts". |
22 | 22 | */ |
23 | 23 | class CensusColumnBornForeignParts extends AbstractCensusColumn implements CensusColumnInterface { |
24 | - /** |
|
25 | - * Generate the likely value of this census column, based on available information. |
|
26 | - * |
|
27 | - * @param Individual $individual |
|
28 | - * @param Individual|null $head |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function generate(Individual $individual, Individual $head = null) { |
|
33 | - $birth_place = explode(', ', $individual->getBirthPlace()); |
|
34 | - $birth_place = end($birth_place); |
|
35 | - $census_place = $this->place(); |
|
24 | + /** |
|
25 | + * Generate the likely value of this census column, based on available information. |
|
26 | + * |
|
27 | + * @param Individual $individual |
|
28 | + * @param Individual|null $head |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function generate(Individual $individual, Individual $head = null) { |
|
33 | + $birth_place = explode(', ', $individual->getBirthPlace()); |
|
34 | + $birth_place = end($birth_place); |
|
35 | + $census_place = $this->place(); |
|
36 | 36 | |
37 | - if ($birth_place === 'Wales') { |
|
38 | - $birth_place = 'England'; |
|
39 | - } |
|
37 | + if ($birth_place === 'Wales') { |
|
38 | + $birth_place = 'England'; |
|
39 | + } |
|
40 | 40 | |
41 | - if ($census_place === 'Wales') { |
|
42 | - $census_place = 'England'; |
|
43 | - } |
|
41 | + if ($census_place === 'Wales') { |
|
42 | + $census_place = 'England'; |
|
43 | + } |
|
44 | 44 | |
45 | - if ($birth_place === $census_place || $birth_place === '') { |
|
46 | - return ''; |
|
47 | - } elseif ($birth_place === 'England' || $birth_place === 'Scotland' || $birth_place === 'Ireland') { |
|
48 | - return substr($birth_place, 0, 1); |
|
49 | - } else { |
|
50 | - return 'F'; |
|
51 | - } |
|
52 | - } |
|
45 | + if ($birth_place === $census_place || $birth_place === '') { |
|
46 | + return ''; |
|
47 | + } elseif ($birth_place === 'England' || $birth_place === 'Scotland' || $birth_place === 'Ireland') { |
|
48 | + return substr($birth_place, 0, 1); |
|
49 | + } else { |
|
50 | + return 'F'; |
|
51 | + } |
|
52 | + } |
|
53 | 53 | } |
@@ -19,27 +19,27 @@ |
||
19 | 19 | * Definitions for a census |
20 | 20 | */ |
21 | 21 | class CensusOfDenmark1801 extends CensusOfDenmark implements CensusInterface { |
22 | - /** |
|
23 | - * When did this census occur. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function censusDate() { |
|
28 | - return '01 FEB 1801'; |
|
29 | - } |
|
22 | + /** |
|
23 | + * When did this census occur. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function censusDate() { |
|
28 | + return '01 FEB 1801'; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * The columns of the census. |
|
33 | - * |
|
34 | - * @return CensusColumnInterface[] |
|
35 | - */ |
|
36 | - public function columns() { |
|
37 | - return array( |
|
38 | - new CensusColumnFullName($this, 'Navn', ''), |
|
39 | - new CensusColumnRelationToHead($this, 'Stilling i familien', ''), |
|
40 | - new CensusColumnAge($this, 'Alder', ''), |
|
41 | - new CensusColumnConditionDanish($this, 'Civilstand', ''), |
|
42 | - new CensusColumnOccupation($this, 'Erhverv', ''), |
|
43 | - ); |
|
44 | - } |
|
31 | + /** |
|
32 | + * The columns of the census. |
|
33 | + * |
|
34 | + * @return CensusColumnInterface[] |
|
35 | + */ |
|
36 | + public function columns() { |
|
37 | + return array( |
|
38 | + new CensusColumnFullName($this, 'Navn', ''), |
|
39 | + new CensusColumnRelationToHead($this, 'Stilling i familien', ''), |
|
40 | + new CensusColumnAge($this, 'Alder', ''), |
|
41 | + new CensusColumnConditionDanish($this, 'Civilstand', ''), |
|
42 | + new CensusColumnOccupation($this, 'Erhverv', ''), |
|
43 | + ); |
|
44 | + } |
|
45 | 45 | } |
@@ -19,23 +19,23 @@ |
||
19 | 19 | * Marital status. |
20 | 20 | */ |
21 | 21 | class CensusColumnConditionFrenchHomme extends AbstractCensusColumnCondition { |
22 | - /* Text to display for married individuals */ |
|
23 | - protected $husband = '1'; |
|
24 | - protected $wife = ''; |
|
22 | + /* Text to display for married individuals */ |
|
23 | + protected $husband = '1'; |
|
24 | + protected $wife = ''; |
|
25 | 25 | |
26 | - /* Text to display for unmarried individuals */ |
|
27 | - protected $bachelor = ''; |
|
28 | - protected $spinster = ''; |
|
26 | + /* Text to display for unmarried individuals */ |
|
27 | + protected $bachelor = ''; |
|
28 | + protected $spinster = ''; |
|
29 | 29 | |
30 | - /* Text to display for children */ |
|
31 | - protected $boy = ''; |
|
32 | - protected $girl = ''; |
|
30 | + /* Text to display for children */ |
|
31 | + protected $boy = ''; |
|
32 | + protected $girl = ''; |
|
33 | 33 | |
34 | - /* Text to display for divorced individuals */ |
|
35 | - protected $divorce = '1'; |
|
36 | - protected $divorcee = ''; |
|
34 | + /* Text to display for divorced individuals */ |
|
35 | + protected $divorce = '1'; |
|
36 | + protected $divorcee = ''; |
|
37 | 37 | |
38 | - /* Text to display for widowed individuals (not yet implemented) */ |
|
39 | - protected $widower = ''; |
|
40 | - protected $widow = ''; |
|
38 | + /* Text to display for widowed individuals (not yet implemented) */ |
|
39 | + protected $widower = ''; |
|
40 | + protected $widow = ''; |
|
41 | 41 | } |
@@ -21,15 +21,15 @@ |
||
21 | 21 | * The individual's father's birth place. |
22 | 22 | */ |
23 | 23 | class CensusColumnFatherBirthPlaceSimple extends CensusColumnFatherBirthPlace implements CensusColumnInterface { |
24 | - /** |
|
25 | - * Generate the likely value of this census column, based on available information. |
|
26 | - * |
|
27 | - * @param Individual $individual |
|
28 | - * @param Individual|null $head |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function generate(Individual $individual, Individual $head = null) { |
|
33 | - return $this->lastPartOfPlace(parent::generate($individual, $head)); |
|
34 | - } |
|
24 | + /** |
|
25 | + * Generate the likely value of this census column, based on available information. |
|
26 | + * |
|
27 | + * @param Individual $individual |
|
28 | + * @param Individual|null $head |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function generate(Individual $individual, Individual $head = null) { |
|
33 | + return $this->lastPartOfPlace(parent::generate($individual, $head)); |
|
34 | + } |
|
35 | 35 | } |
@@ -19,31 +19,31 @@ |
||
19 | 19 | * Definitions for a census |
20 | 20 | */ |
21 | 21 | class CensusOfEngland extends Census implements CensusPlaceInterface { |
22 | - /** |
|
23 | - * All available censuses for this census place. |
|
24 | - * |
|
25 | - * @return CensusInterface[] |
|
26 | - */ |
|
27 | - public function allCensusDates() { |
|
28 | - return array( |
|
29 | - new CensusOfEngland1841(), |
|
30 | - new CensusOfEngland1851(), |
|
31 | - new CensusOfEngland1861(), |
|
32 | - new CensusOfEngland1871(), |
|
33 | - new CensusOfEngland1881(), |
|
34 | - new CensusOfEngland1891(), |
|
35 | - new CensusOfEngland1901(), |
|
36 | - new CensusOfEngland1911(), |
|
37 | - new RegisterOfEngland1939(), |
|
38 | - ); |
|
39 | - } |
|
22 | + /** |
|
23 | + * All available censuses for this census place. |
|
24 | + * |
|
25 | + * @return CensusInterface[] |
|
26 | + */ |
|
27 | + public function allCensusDates() { |
|
28 | + return array( |
|
29 | + new CensusOfEngland1841(), |
|
30 | + new CensusOfEngland1851(), |
|
31 | + new CensusOfEngland1861(), |
|
32 | + new CensusOfEngland1871(), |
|
33 | + new CensusOfEngland1881(), |
|
34 | + new CensusOfEngland1891(), |
|
35 | + new CensusOfEngland1901(), |
|
36 | + new CensusOfEngland1911(), |
|
37 | + new RegisterOfEngland1939(), |
|
38 | + ); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Where did this census occur, in GEDCOM format. |
|
43 | - * |
|
44 | - * @return string |
|
45 | - */ |
|
46 | - public function censusPlace() { |
|
47 | - return 'England'; |
|
48 | - } |
|
41 | + /** |
|
42 | + * Where did this census occur, in GEDCOM format. |
|
43 | + * |
|
44 | + * @return string |
|
45 | + */ |
|
46 | + public function censusPlace() { |
|
47 | + return 'England'; |
|
48 | + } |
|
49 | 49 | } |
@@ -19,29 +19,29 @@ |
||
19 | 19 | * Definitions for a census |
20 | 20 | */ |
21 | 21 | class CensusOfDenmark1845 extends CensusOfDenmark implements CensusInterface { |
22 | - /** |
|
23 | - * When did this census occur. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function censusDate() { |
|
28 | - return '01 FEB 1845'; |
|
29 | - } |
|
22 | + /** |
|
23 | + * When did this census occur. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function censusDate() { |
|
28 | + return '01 FEB 1845'; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * The columns of the census. |
|
33 | - * |
|
34 | - * @return CensusColumnInterface[] |
|
35 | - */ |
|
36 | - public function columns() { |
|
37 | - return array( |
|
38 | - new CensusColumnFullName($this, 'Navn', ''), |
|
39 | - new CensusColumnAge($this, 'Alder', ''), |
|
40 | - new CensusColumnConditionDanish($this, 'Civilstand', ''), |
|
41 | - new CensusColumnOccupation($this, 'Erhverv', ''), |
|
42 | - new CensusColumnRelationToHead($this, 'Stilling i familien', ''), |
|
43 | - new CensusColumnNull($this, '', ''), |
|
44 | - new CensusColumnNull($this, '', ''), |
|
45 | - ); |
|
46 | - } |
|
31 | + /** |
|
32 | + * The columns of the census. |
|
33 | + * |
|
34 | + * @return CensusColumnInterface[] |
|
35 | + */ |
|
36 | + public function columns() { |
|
37 | + return array( |
|
38 | + new CensusColumnFullName($this, 'Navn', ''), |
|
39 | + new CensusColumnAge($this, 'Alder', ''), |
|
40 | + new CensusColumnConditionDanish($this, 'Civilstand', ''), |
|
41 | + new CensusColumnOccupation($this, 'Erhverv', ''), |
|
42 | + new CensusColumnRelationToHead($this, 'Stilling i familien', ''), |
|
43 | + new CensusColumnNull($this, '', ''), |
|
44 | + new CensusColumnNull($this, '', ''), |
|
45 | + ); |
|
46 | + } |
|
47 | 47 | } |
@@ -19,36 +19,36 @@ |
||
19 | 19 | * Definitions for a census |
20 | 20 | */ |
21 | 21 | class CensusOfCzechRepublic1921 extends CensusOfCzechRepublic implements CensusInterface { |
22 | - /** |
|
23 | - * When did this census occur. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function censusDate() { |
|
28 | - return '15 FEB 1921'; |
|
29 | - } |
|
22 | + /** |
|
23 | + * When did this census occur. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function censusDate() { |
|
28 | + return '15 FEB 1921'; |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * The columns of the census. |
|
33 | - * |
|
34 | - * @return CensusColumnInterface[] |
|
35 | - */ |
|
36 | - public function columns() { |
|
37 | - return array( |
|
38 | - new CensusColumnFullName($this, 'Jméno', ''), |
|
39 | - new CensusColumnRelationToHead($this, 'Vztah', ''), |
|
40 | - new CensusColumnSexMZ($this, 'Pohlaví', ''), |
|
41 | - new CensusColumnNull($this, 'Stav', 'Rodinný stav'), |
|
42 | - new CensusColumnBirthDaySlashMonthYear($this, 'Narození', 'Datum narození'), |
|
43 | - new CensusColumnBirthPlace($this, 'Místo', 'Místo narození'), |
|
44 | - new CensusColumnNull($this, 'Přísluší', 'Domovské právo'), |
|
45 | - new CensusColumnNull($this, 'Jazyk', 'Jazyk v obcování'), |
|
46 | - new CensusColumnReligion($this, 'Vyznání', ''), |
|
47 | - new CensusColumnOccupation($this, 'Povolání', ''), |
|
48 | - new CensusColumnNull($this, 'Postavení', 'Postavení v zaměstnání'), |
|
49 | - new CensusColumnNull($this, '', ''), |
|
50 | - new CensusColumnNull($this, '', ''), |
|
51 | - new CensusColumnNull($this, '', ''), |
|
52 | - ); |
|
53 | - } |
|
31 | + /** |
|
32 | + * The columns of the census. |
|
33 | + * |
|
34 | + * @return CensusColumnInterface[] |
|
35 | + */ |
|
36 | + public function columns() { |
|
37 | + return array( |
|
38 | + new CensusColumnFullName($this, 'Jméno', ''), |
|
39 | + new CensusColumnRelationToHead($this, 'Vztah', ''), |
|
40 | + new CensusColumnSexMZ($this, 'Pohlaví', ''), |
|
41 | + new CensusColumnNull($this, 'Stav', 'Rodinný stav'), |
|
42 | + new CensusColumnBirthDaySlashMonthYear($this, 'Narození', 'Datum narození'), |
|
43 | + new CensusColumnBirthPlace($this, 'Místo', 'Místo narození'), |
|
44 | + new CensusColumnNull($this, 'Přísluší', 'Domovské právo'), |
|
45 | + new CensusColumnNull($this, 'Jazyk', 'Jazyk v obcování'), |
|
46 | + new CensusColumnReligion($this, 'Vyznání', ''), |
|
47 | + new CensusColumnOccupation($this, 'Povolání', ''), |
|
48 | + new CensusColumnNull($this, 'Postavení', 'Postavení v zaměstnání'), |
|
49 | + new CensusColumnNull($this, '', ''), |
|
50 | + new CensusColumnNull($this, '', ''), |
|
51 | + new CensusColumnNull($this, '', ''), |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | } |
@@ -21,15 +21,15 @@ |
||
21 | 21 | * The individual's date of birth. |
22 | 22 | */ |
23 | 23 | class CensusColumnBirthYear extends AbstractCensusColumn implements CensusColumnInterface { |
24 | - /** |
|
25 | - * Generate the likely value of this census column, based on available information. |
|
26 | - * |
|
27 | - * @param Individual $individual |
|
28 | - * @param Individual|null $head |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function generate(Individual $individual, Individual $head = null) { |
|
33 | - return $individual->getEstimatedBirthDate()->minimumDate()->format('%Y'); |
|
34 | - } |
|
24 | + /** |
|
25 | + * Generate the likely value of this census column, based on available information. |
|
26 | + * |
|
27 | + * @param Individual $individual |
|
28 | + * @param Individual|null $head |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function generate(Individual $individual, Individual $head = null) { |
|
33 | + return $individual->getEstimatedBirthDate()->minimumDate()->format('%Y'); |
|
34 | + } |
|
35 | 35 | } |