@@ -200,7 +200,8 @@ discard block |
||
200 | 200 | <div class="tab-pane fade show active" role="tabpanel" id="individuals"> |
201 | 201 | <?php if (empty($myindilist)): ?> |
202 | 202 | <p><?= I18N::translate('No results found.') ?></p> |
203 | - <?php else: ?> |
|
203 | + <?php else { |
|
204 | + : ?> |
|
204 | 205 | <?= FunctionsPrintLists::individualTable($myindilist) ?> |
205 | 206 | <?php endif ?> |
206 | 207 | </div> |
@@ -216,6 +217,7 @@ discard block |
||
216 | 217 | <?php |
217 | 218 | } |
218 | 219 | echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>'; |
220 | +} |
|
219 | 221 | |
220 | 222 | if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
221 | 223 | $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names); |
@@ -1505,7 +1505,7 @@ |
||
1505 | 1505 | '0' => I18N::translateContext('Show the [first/last] [N] parts of a place name.', 'first'), |
1506 | 1506 | '1' => I18N::translateContext('Show the [first/last] [N] parts of a place name.', 'last'), |
1507 | 1507 | ], $WT_TREE->getPreference('SHOW_PEDIGREE_PLACES_SUFFIX', ['name' => 'SHOW_PEDIGREE_PLACES_SUFFIX'])), |
1508 | - Bootstrap4::select(FunctionsEdit::numericOptions(range(1,9)), $WT_TREE->getPreference('SHOW_PEDIGREE_PLACES'), ['name' => 'SHOW_PEDIGREE_PLACES']) |
|
1508 | + Bootstrap4::select(FunctionsEdit::numericOptions(range(1, 9)), $WT_TREE->getPreference('SHOW_PEDIGREE_PLACES'), ['name' => 'SHOW_PEDIGREE_PLACES']) |
|
1509 | 1509 | ) ?> |
1510 | 1510 | <p class="small text-muted"> |
1511 | 1511 | <?= /* I18N: Help text for the “Abbreviate place names” configuration setting */ I18N::translate('Place names are frequently too long to fit on charts, lists, etc. They can be abbreviated by showing just the first few parts of the name, such as <i>village, county</i>, or the last few part of it, such as <i>region, country</i>.') ?> |
@@ -135,7 +135,7 @@ |
||
135 | 135 | } |
136 | 136 | } catch (\Exception $ex) { |
137 | 137 | // The module has been deleted or is broken? Disable it. |
138 | - Log::addConfigurationLog("Module {$module_name} is missing or broken - disabling it. " . $ex->getMessage()); |
|
138 | + Log::addConfigurationLog("module {$module_name} is missing or broken - disabling it. " . $ex->getMessage()); |
|
139 | 139 | Database::prepare( |
140 | 140 | "UPDATE `##module` SET status = 'disabled' WHERE module_name = :module_name" |
141 | 141 | )->execute([ |
@@ -118,7 +118,6 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * Format a name record |
120 | 120 | * |
121 | - * @param int $primary |
|
122 | 121 | * @param Fact $fact |
123 | 122 | * |
124 | 123 | * @return string |
@@ -216,7 +215,6 @@ discard block |
||
216 | 215 | /** |
217 | 216 | * print information for a sex record |
218 | 217 | * |
219 | - * @param Fact $event the Event object |
|
220 | 218 | * |
221 | 219 | * @return string |
222 | 220 | */ |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function getTabs() { |
97 | 97 | $active_tabs = Module::getActiveTabs($this->record->getTree()); |
98 | 98 | |
99 | - return array_filter($active_tabs, function(ModuleTabInterface $tab) { return $tab->hasTabContent(); }); |
|
99 | + return array_filter($active_tabs, function (ModuleTabInterface $tab) { return $tab->hasTabContent(); }); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | if ($n === 0) { |
143 | 143 | $content_class = 'collapse show'; |
144 | - $aria = 'true'; |
|
144 | + $aria = 'true'; |
|
145 | 145 | } |
146 | 146 | if ($fact->isPendingDeletion()) { |
147 | 147 | $container_class .= ' old'; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | if ($individual->canEdit() && !$fact->isPendingDeletion()) { |
246 | - $edit_links = FontAwesome::linkIcon('edit', I18N::translate('Edit the gender'), ['class' => 'btn btn-link', 'href' => 'edit_interface.php?action=edit&xref=' . $individual->getXref() . '&fact_id=' . $fact->getFactId() . '&ged=' . $individual->getTree()->getNameHtml() ]); |
|
246 | + $edit_links = FontAwesome::linkIcon('edit', I18N::translate('Edit the gender'), ['class' => 'btn btn-link', 'href' => 'edit_interface.php?action=edit&xref=' . $individual->getXref() . '&fact_id=' . $fact->getFactId() . '&ged=' . $individual->getTree()->getNameHtml()]); |
|
247 | 247 | |
248 | 248 | } else { |
249 | 249 | $edit_links = ''; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | <div class="' . $container_class . '"> |
254 | 254 | <div class="card-header" role="tab" id="name-header-add"> |
255 | 255 | <div class="card-title mb-0"> |
256 | - <b>' . I18N::translate('Gender') . '</b> ' . $sex . $edit_links . ' |
|
256 | + <b>' . I18N::translate('Gender') . '</b> ' . $sex . $edit_links . ' |
|
257 | 257 | </div> |
258 | 258 | </div> |
259 | 259 | </div>'; |
@@ -82,7 +82,8 @@ discard block |
||
82 | 82 | <?php if ($ancestors_only === '1'): ?> |
83 | 83 | <input type="hidden" name="ancestors" value="1"> |
84 | 84 | <?= I18N::translate('Find relationships via ancestors') ?> |
85 | - <?php else: ?> |
|
85 | + <?php else { |
|
86 | + : ?> |
|
86 | 87 | <?= Bootstrap4::radioButtons('ancestors', ['0' => I18N::translate('Find any relationship'), '1' => I18N::translate('Find relationships via ancestors')], $ancestors, false) ?> |
87 | 88 | <?php endif ?> |
88 | 89 | </div> |
@@ -115,6 +116,7 @@ discard block |
||
115 | 116 | if ($person1 && $person2) { |
116 | 117 | if (I18N::direction() === 'ltr') { |
117 | 118 | $diagonal1 = Theme::theme()->parameter('image-dline'); |
119 | +} |
|
118 | 120 | $diagonal2 = Theme::theme()->parameter('image-dline2'); |
119 | 121 | } else { |
120 | 122 | $diagonal1 = Theme::theme()->parameter('image-dline2'); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | $flag_files = []; |
178 | 178 | foreach ($it as $file) { |
179 | - $file_path = substr($file->getPathname() , strlen($directory)); |
|
179 | + $file_path = substr($file->getPathname(), strlen($directory)); |
|
180 | 180 | if ($file->getExtension() === 'png' && stripos($file_path, $query) !== false) { |
181 | 181 | if ($offset > 0) { |
182 | 182 | // Skip results |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | if ($place_name === $query) { |
454 | 454 | $found = true; |
455 | 455 | } |
456 | - $results[] = [ |
|
456 | + $results[] = [ |
|
457 | 457 | 'id' => $place_name, |
458 | 458 | 'text' => $place_name, |
459 | 459 | ]; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | if ($place_name === $query) { |
489 | 489 | $found = true; |
490 | 490 | } |
491 | - $results[] = [ |
|
491 | + $results[] = [ |
|
492 | 492 | 'id' => $place_name, |
493 | 493 | 'text' => $place_name, |
494 | 494 | ]; |
@@ -334,7 +334,7 @@ |
||
334 | 334 | * @param string|null $regexp |
335 | 335 | * @param string $default |
336 | 336 | * |
337 | - * @return string[]|string[][] |
|
337 | + * @return string[] |
|
338 | 338 | */ |
339 | 339 | public static function postArray($variable, $regexp = null, $default = '') { |
340 | 340 | return self::inputArray(INPUT_POST, $variable, $regexp, $default); |
@@ -84,7 +84,6 @@ discard block |
||
84 | 84 | |
85 | 85 | /** |
86 | 86 | * @param Individual $individual |
87 | - * @param CensusInterface $census |
|
88 | 87 | */ |
89 | 88 | public function createCensusAssistant(Individual $individual) { |
90 | 89 | ?> |
@@ -287,7 +286,7 @@ discard block |
||
287 | 286 | * @param string $ca_title |
288 | 287 | * @param string $ca_place |
289 | 288 | * @param string $ca_citation |
290 | - * @param string[][] $ca_individuals |
|
289 | + * @param string[] $ca_individuals |
|
291 | 290 | * @param string $ca_notes |
292 | 291 | * |
293 | 292 | * @return string |
@@ -21,13 +21,11 @@ |
||
21 | 21 | use Fisharebest\Webtrees\Family; |
22 | 22 | use Fisharebest\Webtrees\Filter; |
23 | 23 | use Fisharebest\Webtrees\FontAwesome; |
24 | -use Fisharebest\Webtrees\Functions\Functions; |
|
25 | 24 | use Fisharebest\Webtrees\Functions\FunctionsDb; |
26 | 25 | use Fisharebest\Webtrees\Functions\FunctionsEdit; |
27 | 26 | use Fisharebest\Webtrees\GedcomRecord; |
28 | 27 | use Fisharebest\Webtrees\I18N; |
29 | 28 | use Fisharebest\Webtrees\Individual; |
30 | -use Fisharebest\Webtrees\Menu; |
|
31 | 29 | use Fisharebest\Webtrees\Note; |
32 | 30 | use Fisharebest\Webtrees\Soundex; |
33 | 31 |
@@ -35,59 +35,59 @@ discard block |
||
35 | 35 | * Class CensusAssistantModule |
36 | 36 | */ |
37 | 37 | class CensusAssistantModule extends AbstractModule { |
38 | - /** {@inheritdoc} */ |
|
39 | - public function getTitle() { |
|
40 | - return /* I18N: Name of a module */ |
|
41 | - I18N::translate('Census assistant'); |
|
42 | - } |
|
43 | - |
|
44 | - /** {@inheritdoc} */ |
|
45 | - public function getDescription() { |
|
46 | - return /* I18N: Description of the “Census assistant” module */ |
|
47 | - I18N::translate('An alternative way to enter census transcripts and link them to individuals.'); |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * This is a general purpose hook, allowing modules to respond to routes |
|
52 | - * of the form module.php?mod=FOO&mod_action=BAR |
|
53 | - * |
|
54 | - * @param string $mod_action |
|
55 | - */ |
|
56 | - public function modAction($mod_action) { |
|
57 | - global $WT_TREE; |
|
58 | - |
|
59 | - switch ($mod_action) { |
|
60 | - case 'census-header': |
|
61 | - header('Content-Type: text/html; charset=utf8'); |
|
62 | - $census = Filter::get('census'); |
|
63 | - echo $this->censusTableHeader(new $census); |
|
64 | - break; |
|
65 | - |
|
66 | - case 'census-individual': |
|
67 | - header('Content-Type: text/html; charset=utf8'); |
|
68 | - $census = Filter::get('census'); |
|
69 | - $individual = Individual::getInstance(Filter::get('xref'), $WT_TREE); |
|
70 | - $head = Individual::getInstance(Filter::get('head'), $WT_TREE); |
|
71 | - echo $this->censusTableRow(new $census, $individual, $head); |
|
72 | - break; |
|
73 | - |
|
74 | - case 'media_find': |
|
75 | - self::mediaFind(); |
|
76 | - break; |
|
77 | - case 'media_query_3a': |
|
78 | - self::mediaQuery(); |
|
79 | - break; |
|
80 | - default: |
|
81 | - http_response_code(404); |
|
82 | - } |
|
83 | - } |
|
84 | - |
|
85 | - /** |
|
86 | - * @param Individual $individual |
|
87 | - * @param CensusInterface $census |
|
88 | - */ |
|
89 | - public function createCensusAssistant(Individual $individual) { |
|
90 | - ?> |
|
38 | + /** {@inheritdoc} */ |
|
39 | + public function getTitle() { |
|
40 | + return /* I18N: Name of a module */ |
|
41 | + I18N::translate('Census assistant'); |
|
42 | + } |
|
43 | + |
|
44 | + /** {@inheritdoc} */ |
|
45 | + public function getDescription() { |
|
46 | + return /* I18N: Description of the “Census assistant” module */ |
|
47 | + I18N::translate('An alternative way to enter census transcripts and link them to individuals.'); |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * This is a general purpose hook, allowing modules to respond to routes |
|
52 | + * of the form module.php?mod=FOO&mod_action=BAR |
|
53 | + * |
|
54 | + * @param string $mod_action |
|
55 | + */ |
|
56 | + public function modAction($mod_action) { |
|
57 | + global $WT_TREE; |
|
58 | + |
|
59 | + switch ($mod_action) { |
|
60 | + case 'census-header': |
|
61 | + header('Content-Type: text/html; charset=utf8'); |
|
62 | + $census = Filter::get('census'); |
|
63 | + echo $this->censusTableHeader(new $census); |
|
64 | + break; |
|
65 | + |
|
66 | + case 'census-individual': |
|
67 | + header('Content-Type: text/html; charset=utf8'); |
|
68 | + $census = Filter::get('census'); |
|
69 | + $individual = Individual::getInstance(Filter::get('xref'), $WT_TREE); |
|
70 | + $head = Individual::getInstance(Filter::get('head'), $WT_TREE); |
|
71 | + echo $this->censusTableRow(new $census, $individual, $head); |
|
72 | + break; |
|
73 | + |
|
74 | + case 'media_find': |
|
75 | + self::mediaFind(); |
|
76 | + break; |
|
77 | + case 'media_query_3a': |
|
78 | + self::mediaQuery(); |
|
79 | + break; |
|
80 | + default: |
|
81 | + http_response_code(404); |
|
82 | + } |
|
83 | + } |
|
84 | + |
|
85 | + /** |
|
86 | + * @param Individual $individual |
|
87 | + * @param CensusInterface $census |
|
88 | + */ |
|
89 | + public function createCensusAssistant(Individual $individual) { |
|
90 | + ?> |
|
91 | 91 | |
92 | 92 | <div id="census-assistant-link" hidden> |
93 | 93 | <a href="#"> |
@@ -245,85 +245,85 @@ discard block |
||
245 | 245 | document.querySelector('#census-assistant-head').addEventListener('click', censusAssistantHead); |
246 | 246 | </script> |
247 | 247 | <?php |
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * @param Individual $individual |
|
252 | - * @param string $newged |
|
253 | - * |
|
254 | - * @return string |
|
255 | - */ |
|
256 | - public function updateCensusAssistant(Individual $individual, $fact_id, $newged, $keep_chan) { |
|
257 | - $ca_title = Filter::post('ca_title'); |
|
258 | - $ca_place = Filter::post('ca_place'); |
|
259 | - $ca_citation = Filter::post('ca_citation'); |
|
260 | - $ca_individuals = Filter::postArray('ca_individuals'); |
|
261 | - $ca_notes = Filter::post('ca_notes'); |
|
262 | - $ca_census = Filter::post('ca_census', 'Fisharebest\\\\Webtrees\\\\Census\\\\CensusOf[A-Za-z0-9]+'); |
|
263 | - |
|
264 | - if ($ca_census !== '' && !empty($ca_individuals)) { |
|
265 | - $census = new $ca_census; |
|
266 | - |
|
267 | - $note_text = $this->createNoteText($census, $ca_title, $ca_place, $ca_citation, $ca_individuals, $ca_notes); |
|
268 | - $note_gedcom = '0 @new@ NOTE ' . str_replace("\n", "\n1 CONT ", $note_text); |
|
269 | - $note = $individual->getTree()->createRecord($note_gedcom); |
|
270 | - |
|
271 | - $newged .= "\n2 NOTE @" . $note->getXref() . '@'; |
|
272 | - |
|
273 | - // Add the census fact to the rest of the household |
|
274 | - foreach (array_keys($ca_individuals) as $xref) { |
|
275 | - if ($xref !== $individual->getXref()) { |
|
276 | - Individual::getInstance($xref, $individual->getTree()) |
|
277 | - ->updateFact($fact_id, $newged, !$keep_chan); |
|
278 | - } |
|
279 | - } |
|
280 | - } |
|
281 | - |
|
282 | - return $newged; |
|
283 | - } |
|
284 | - |
|
285 | - /** |
|
286 | - * @param CensusInterface $census |
|
287 | - * @param string $ca_title |
|
288 | - * @param string $ca_place |
|
289 | - * @param string $ca_citation |
|
290 | - * @param string[][] $ca_individuals |
|
291 | - * @param string $ca_notes |
|
292 | - * |
|
293 | - * @return string |
|
294 | - */ |
|
295 | - private function createNoteText(CensusInterface $census, $ca_title, $ca_place, $ca_citation, $ca_individuals, $ca_notes) { |
|
296 | - $text = $ca_title . "\n" . $ca_citation . "\n" . $ca_place . "\n\n.start_formatted_area.\n\n"; |
|
297 | - |
|
298 | - foreach ($census->columns() as $n => $column) { |
|
299 | - if ($n > 0) { |
|
300 | - $text .= '|'; |
|
301 | - } |
|
302 | - $text .= '.b.' . $column->abbreviation(); |
|
303 | - } |
|
304 | - |
|
305 | - foreach ($ca_individuals as $xref => $columns) { |
|
306 | - $text .= "\n" . implode('|', $columns); |
|
307 | - } |
|
308 | - |
|
309 | - return $text . "\n.end_formatted_area.\n\n" . $ca_notes; |
|
310 | - } |
|
311 | - |
|
312 | - /** |
|
313 | - * Find a media object. |
|
314 | - */ |
|
315 | - private static function mediaFind() { |
|
316 | - global $WT_TREE; |
|
317 | - |
|
318 | - $controller = new SimpleController; |
|
319 | - $filter = Filter::get('filter'); |
|
320 | - $multiple = Filter::getBool('multiple'); |
|
321 | - |
|
322 | - $controller |
|
323 | - ->setPageTitle(I18N::translate('Find an individual')) |
|
324 | - ->pageHeader(); |
|
325 | - |
|
326 | - ?> |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * @param Individual $individual |
|
252 | + * @param string $newged |
|
253 | + * |
|
254 | + * @return string |
|
255 | + */ |
|
256 | + public function updateCensusAssistant(Individual $individual, $fact_id, $newged, $keep_chan) { |
|
257 | + $ca_title = Filter::post('ca_title'); |
|
258 | + $ca_place = Filter::post('ca_place'); |
|
259 | + $ca_citation = Filter::post('ca_citation'); |
|
260 | + $ca_individuals = Filter::postArray('ca_individuals'); |
|
261 | + $ca_notes = Filter::post('ca_notes'); |
|
262 | + $ca_census = Filter::post('ca_census', 'Fisharebest\\\\Webtrees\\\\Census\\\\CensusOf[A-Za-z0-9]+'); |
|
263 | + |
|
264 | + if ($ca_census !== '' && !empty($ca_individuals)) { |
|
265 | + $census = new $ca_census; |
|
266 | + |
|
267 | + $note_text = $this->createNoteText($census, $ca_title, $ca_place, $ca_citation, $ca_individuals, $ca_notes); |
|
268 | + $note_gedcom = '0 @new@ NOTE ' . str_replace("\n", "\n1 CONT ", $note_text); |
|
269 | + $note = $individual->getTree()->createRecord($note_gedcom); |
|
270 | + |
|
271 | + $newged .= "\n2 NOTE @" . $note->getXref() . '@'; |
|
272 | + |
|
273 | + // Add the census fact to the rest of the household |
|
274 | + foreach (array_keys($ca_individuals) as $xref) { |
|
275 | + if ($xref !== $individual->getXref()) { |
|
276 | + Individual::getInstance($xref, $individual->getTree()) |
|
277 | + ->updateFact($fact_id, $newged, !$keep_chan); |
|
278 | + } |
|
279 | + } |
|
280 | + } |
|
281 | + |
|
282 | + return $newged; |
|
283 | + } |
|
284 | + |
|
285 | + /** |
|
286 | + * @param CensusInterface $census |
|
287 | + * @param string $ca_title |
|
288 | + * @param string $ca_place |
|
289 | + * @param string $ca_citation |
|
290 | + * @param string[][] $ca_individuals |
|
291 | + * @param string $ca_notes |
|
292 | + * |
|
293 | + * @return string |
|
294 | + */ |
|
295 | + private function createNoteText(CensusInterface $census, $ca_title, $ca_place, $ca_citation, $ca_individuals, $ca_notes) { |
|
296 | + $text = $ca_title . "\n" . $ca_citation . "\n" . $ca_place . "\n\n.start_formatted_area.\n\n"; |
|
297 | + |
|
298 | + foreach ($census->columns() as $n => $column) { |
|
299 | + if ($n > 0) { |
|
300 | + $text .= '|'; |
|
301 | + } |
|
302 | + $text .= '.b.' . $column->abbreviation(); |
|
303 | + } |
|
304 | + |
|
305 | + foreach ($ca_individuals as $xref => $columns) { |
|
306 | + $text .= "\n" . implode('|', $columns); |
|
307 | + } |
|
308 | + |
|
309 | + return $text . "\n.end_formatted_area.\n\n" . $ca_notes; |
|
310 | + } |
|
311 | + |
|
312 | + /** |
|
313 | + * Find a media object. |
|
314 | + */ |
|
315 | + private static function mediaFind() { |
|
316 | + global $WT_TREE; |
|
317 | + |
|
318 | + $controller = new SimpleController; |
|
319 | + $filter = Filter::get('filter'); |
|
320 | + $multiple = Filter::getBool('multiple'); |
|
321 | + |
|
322 | + $controller |
|
323 | + ->setPageTitle(I18N::translate('Find an individual')) |
|
324 | + ->pageHeader(); |
|
325 | + |
|
326 | + ?> |
|
327 | 327 | <script> |
328 | 328 | function pasterow (id, name, gend, yob, age, bpl) { |
329 | 329 | window.opener.opener.insertRowToTable(id, name, '', gend, '', yob, age, 'Y', '', bpl); |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | if (thumb) { |
334 | 334 | window.opener.paste_id(id, name, thumb); |
335 | 335 | <?php if (!$multiple) { |
336 | - echo 'window.close();'; |
|
337 | - } ?> |
|
336 | + echo 'window.close();'; |
|
337 | + } ?> |
|
338 | 338 | } else { |
339 | 339 | // GEDFact_assistant ======================== |
340 | 340 | if (window.opener.document.getElementById('addlinkQueue')) { |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | window.opener.pastename(name); |
346 | 346 | } |
347 | 347 | <?php if (!$multiple) { |
348 | - echo 'window.close();'; |
|
349 | - } ?> |
|
348 | + echo 'window.close();'; |
|
349 | + } ?> |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
@@ -369,27 +369,27 @@ discard block |
||
369 | 369 | </script> |
370 | 370 | |
371 | 371 | <?php |
372 | - echo '<div>'; |
|
373 | - echo '<table class="list_table width90" border="0">'; |
|
374 | - echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; // start column for find text header |
|
375 | - echo $controller->getPageTitle(); |
|
376 | - echo '</td>'; |
|
377 | - echo '</tr>'; |
|
378 | - echo '</table>'; |
|
379 | - echo '<br>'; |
|
380 | - echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
|
381 | - echo '<br>'; |
|
382 | - |
|
383 | - $filter = trim($filter); |
|
384 | - $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
385 | - echo '<table class="tabs_table width90"><tr>'; |
|
386 | - $myindilist = FunctionsDb::searchIndividualNames($filter_array, [$WT_TREE]); |
|
387 | - if ($myindilist) { |
|
388 | - echo '<td class="list_value_wrap"><ul>'; |
|
389 | - usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
390 | - foreach ($myindilist as $indi) { |
|
391 | - $nam = Filter::escapeHtml($indi->getFullName()); |
|
392 | - echo "<li><a href=\"#\" onclick=\"pasterow( |
|
372 | + echo '<div>'; |
|
373 | + echo '<table class="list_table width90" border="0">'; |
|
374 | + echo '<tr><td style="padding: 10px;" class="facts_label03 width90">'; // start column for find text header |
|
375 | + echo $controller->getPageTitle(); |
|
376 | + echo '</td>'; |
|
377 | + echo '</tr>'; |
|
378 | + echo '</table>'; |
|
379 | + echo '<br>'; |
|
380 | + echo '<button onclick="window.close();">', I18N::translate('close'), '</button>'; |
|
381 | + echo '<br>'; |
|
382 | + |
|
383 | + $filter = trim($filter); |
|
384 | + $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter)); |
|
385 | + echo '<table class="tabs_table width90"><tr>'; |
|
386 | + $myindilist = FunctionsDb::searchIndividualNames($filter_array, [$WT_TREE]); |
|
387 | + if ($myindilist) { |
|
388 | + echo '<td class="list_value_wrap"><ul>'; |
|
389 | + usort($myindilist, '\Fisharebest\Webtrees\GedcomRecord::compare'); |
|
390 | + foreach ($myindilist as $indi) { |
|
391 | + $nam = Filter::escapeHtml($indi->getFullName()); |
|
392 | + echo "<li><a href=\"#\" onclick=\"pasterow( |
|
393 | 393 | '" . $indi->getXref() . "' , |
394 | 394 | '" . $nam . "' , |
395 | 395 | '" . $indi->getSex() . "' , |
@@ -398,44 +398,44 @@ discard block |
||
398 | 398 | '" . $indi->getBirthPlace() . "'); return false;\"> |
399 | 399 | <b>" . $indi->getFullName() . '</b> '; |
400 | 400 | |
401 | - $born = I18N::translate('Birth'); |
|
402 | - echo '</span><br><span class="list_item">', $born, ' ', $indi->getBirthYear(), ' ', $indi->getBirthPlace(), '</span></a></li>'; |
|
403 | - echo '<hr>'; |
|
404 | - } |
|
405 | - echo '</ul></td></tr><tr><td class="list_label">', I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>'; |
|
406 | - } else { |
|
407 | - echo '<td class="list_value_wrap">'; |
|
408 | - echo I18N::translate('No results found.'); |
|
409 | - echo '</td></tr>'; |
|
410 | - } |
|
411 | - echo '</table>'; |
|
412 | - echo '</div>'; |
|
413 | - } |
|
414 | - |
|
415 | - /** |
|
416 | - * Search for a media object. |
|
417 | - */ |
|
418 | - private static function mediaQuery() { |
|
419 | - global $WT_TREE; |
|
420 | - |
|
421 | - $iid2 = Filter::get('iid', WT_REGEX_XREF); |
|
422 | - |
|
423 | - $controller = new SimpleController; |
|
424 | - $controller |
|
425 | - ->setPageTitle(I18N::translate('Link to an existing media object')) |
|
426 | - ->pageHeader(); |
|
427 | - |
|
428 | - $record = GedcomRecord::getInstance($iid2, $WT_TREE); |
|
429 | - if ($record) { |
|
430 | - $headjs = ''; |
|
431 | - if ($record instanceof Family) { |
|
432 | - if ($record->getHusband()) { |
|
433 | - $headjs = $record->getHusband()->getXref(); |
|
434 | - } elseif ($record->getWife()) { |
|
435 | - $headjs = $record->getWife()->getXref(); |
|
436 | - } |
|
437 | - } |
|
438 | - ?> |
|
401 | + $born = I18N::translate('Birth'); |
|
402 | + echo '</span><br><span class="list_item">', $born, ' ', $indi->getBirthYear(), ' ', $indi->getBirthPlace(), '</span></a></li>'; |
|
403 | + echo '<hr>'; |
|
404 | + } |
|
405 | + echo '</ul></td></tr><tr><td class="list_label">', I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>'; |
|
406 | + } else { |
|
407 | + echo '<td class="list_value_wrap">'; |
|
408 | + echo I18N::translate('No results found.'); |
|
409 | + echo '</td></tr>'; |
|
410 | + } |
|
411 | + echo '</table>'; |
|
412 | + echo '</div>'; |
|
413 | + } |
|
414 | + |
|
415 | + /** |
|
416 | + * Search for a media object. |
|
417 | + */ |
|
418 | + private static function mediaQuery() { |
|
419 | + global $WT_TREE; |
|
420 | + |
|
421 | + $iid2 = Filter::get('iid', WT_REGEX_XREF); |
|
422 | + |
|
423 | + $controller = new SimpleController; |
|
424 | + $controller |
|
425 | + ->setPageTitle(I18N::translate('Link to an existing media object')) |
|
426 | + ->pageHeader(); |
|
427 | + |
|
428 | + $record = GedcomRecord::getInstance($iid2, $WT_TREE); |
|
429 | + if ($record) { |
|
430 | + $headjs = ''; |
|
431 | + if ($record instanceof Family) { |
|
432 | + if ($record->getHusband()) { |
|
433 | + $headjs = $record->getHusband()->getXref(); |
|
434 | + } elseif ($record->getWife()) { |
|
435 | + $headjs = $record->getWife()->getXref(); |
|
436 | + } |
|
437 | + } |
|
438 | + ?> |
|
439 | 439 | <script> |
440 | 440 | function insertId () { |
441 | 441 | if (window.opener.document.getElementById('addlinkQueue')) { |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | } |
447 | 447 | </script> |
448 | 448 | <?php |
449 | - } else { |
|
450 | - ?> |
|
449 | + } else { |
|
450 | + ?> |
|
451 | 451 | <script> |
452 | 452 | function insertId () { |
453 | 453 | window.opener.alert('<?= $iid2 ?> - <?= I18N::translate('Not a valid individual, family, or source ID') ?>'); |
@@ -455,142 +455,142 @@ discard block |
||
455 | 455 | } |
456 | 456 | </script> |
457 | 457 | <?php |
458 | - } |
|
459 | - ?> |
|
458 | + } |
|
459 | + ?> |
|
460 | 460 | <script>window.onLoad = insertId();</script> |
461 | 461 | <?php |
462 | - } |
|
463 | - |
|
464 | - /** |
|
465 | - * Convert custom markup into HTML |
|
466 | - * |
|
467 | - * @param Note $note |
|
468 | - * |
|
469 | - * @return string |
|
470 | - */ |
|
471 | - public static function formatCensusNote(Note $note) { |
|
472 | - if (preg_match('/(.*)((?:\n.*)*)\n\.start_formatted_area\.\n(.+)\n(.+(?:\n.+)*)\n.end_formatted_area\.((?:\n.*)*)/', $note->getNote(), $match)) { |
|
473 | - // This looks like a census-assistant shared note |
|
474 | - $title = Filter::escapeHtml($match[1]); |
|
475 | - $preamble = Filter::escapeHtml($match[2]); |
|
476 | - $header = Filter::escapeHtml($match[3]); |
|
477 | - $data = Filter::escapeHtml($match[4]); |
|
478 | - $postamble = Filter::escapeHtml($match[5]); |
|
479 | - |
|
480 | - // Get the column headers for the census to which this note refers |
|
481 | - // requires the fact place & date to match the specific census |
|
482 | - // censusPlace() (Soundex match) and censusDate() functions |
|
483 | - $fmt_headers = []; |
|
484 | - /** @var GedcomRecord[] $linkedRecords */ |
|
485 | - $linkedRecords = array_merge($note->linkedIndividuals('NOTE'), $note->linkedFamilies('NOTE')); |
|
486 | - $firstRecord = array_shift($linkedRecords); |
|
487 | - if ($firstRecord) { |
|
488 | - $countryCode = ''; |
|
489 | - $date = ''; |
|
490 | - foreach ($firstRecord->getFacts('CENS') as $fact) { |
|
491 | - if (trim($fact->getAttribute('NOTE'), '@') === $note->getXref()) { |
|
492 | - $date = $fact->getAttribute('DATE'); |
|
493 | - $place = explode(',', strip_tags($fact->getPlace()->getFullName())); |
|
494 | - $countryCode = Soundex::daitchMokotoff(array_pop($place)); |
|
495 | - break; |
|
496 | - } |
|
497 | - } |
|
498 | - |
|
499 | - foreach (Census::allCensusPlaces() as $censusPlace) { |
|
500 | - if (Soundex::compare($countryCode, Soundex::daitchMokotoff($censusPlace->censusPlace()))) { |
|
501 | - foreach ($censusPlace->allCensusDates() as $census) { |
|
502 | - if ($census->censusDate() == $date) { |
|
503 | - foreach ($census->columns() as $column) { |
|
504 | - $abbrev = $column->abbreviation(); |
|
505 | - if ($abbrev) { |
|
506 | - $description = $column->title() ? $column->title() : I18N::translate('Description unavailable'); |
|
507 | - $fmt_headers[$abbrev] = '<span title="' . $description . '">' . $abbrev . '</span>'; |
|
508 | - } |
|
509 | - } |
|
510 | - break 2; |
|
511 | - } |
|
512 | - } |
|
513 | - } |
|
514 | - } |
|
515 | - } |
|
516 | - // Substitute header labels and format as HTML |
|
517 | - $thead = '<tr><th>' . strtr(str_replace('|', '</th><th>', $header), $fmt_headers) . '</th></tr>'; |
|
518 | - $thead = str_replace('.b.', '', $thead); |
|
519 | - |
|
520 | - // Format data as HTML |
|
521 | - $tbody = ''; |
|
522 | - foreach (explode("\n", $data) as $row) { |
|
523 | - $tbody .= '<tr>'; |
|
524 | - foreach (explode('|', $row) as $column) { |
|
525 | - $tbody .= '<td>' . $column . '</td>'; |
|
526 | - } |
|
527 | - $tbody .= '</tr>'; |
|
528 | - } |
|
529 | - |
|
530 | - return |
|
531 | - $title . "\n" . // The newline allows the framework to expand the details and turn the first line into a link |
|
532 | - '<div class="markdown">' . |
|
533 | - '<p>' . $preamble . '</p>' . |
|
534 | - '<table>' . |
|
535 | - '<thead>' . $thead . '</thead>' . |
|
536 | - '<tbody>' . $tbody . '</tbody>' . |
|
537 | - '</table>' . |
|
538 | - '<p>' . $postamble . '</p>' . |
|
539 | - '</div>'; |
|
540 | - } else { |
|
541 | - // Not a census-assistant shared note - apply default formatting |
|
542 | - return Filter::formatText($note->getNote(), $note->getTree()); |
|
543 | - } |
|
544 | - } |
|
545 | - |
|
546 | - /** |
|
547 | - * Generate an HTML row of data for the census header |
|
548 | - * Add prefix cell (store XREF and drag/drop) |
|
549 | - * Add suffix cell (delete button) |
|
550 | - * |
|
551 | - * @param CensusInterface $census |
|
552 | - * |
|
553 | - * @return string |
|
554 | - */ |
|
555 | - public static function censusTableHeader(CensusInterface $census) { |
|
556 | - $html = ''; |
|
557 | - foreach ($census->columns() as $column) { |
|
558 | - $html .= '<th class="wt-census-assistant-field" title="' . $column->title() . '">' . $column->abbreviation() . '</th>'; |
|
559 | - } |
|
560 | - |
|
561 | - return '<tr class="wt-census-assistant-row"><th hidden></th>' . $html . '<th></th></tr>'; |
|
562 | - } |
|
563 | - |
|
564 | - /** |
|
565 | - * Generate an HTML row of data for the census |
|
566 | - * Add prefix cell (store XREF and drag/drop) |
|
567 | - * Add suffix cell (delete button) |
|
568 | - * |
|
569 | - * @param CensusInterface $census |
|
570 | - * |
|
571 | - * @return string |
|
572 | - */ |
|
573 | - public static function censusTableEmptyRow(CensusInterface $census) { |
|
574 | - return '<tr class="wt-census-assistant-row"><td hidden></td>' . str_repeat('<td class="wt-census-assistant-field"><input type="text" class="form-control wt-census-assistant-form-control"></td>', count($census->columns())) . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
575 | - } |
|
576 | - |
|
577 | - /** |
|
578 | - * Generate an HTML row of data for the census |
|
579 | - * Add prefix cell (store XREF and drag/drop) |
|
580 | - * Add suffix cell (delete button) |
|
581 | - * |
|
582 | - * @param CensusInterface $census |
|
583 | - * @param Individual $individual |
|
584 | - * @param Individual $head |
|
585 | - * |
|
586 | - * @return string |
|
587 | - */ |
|
588 | - public static function censusTableRow(CensusInterface $census, Individual $individual, Individual $head) { |
|
589 | - $html = ''; |
|
590 | - foreach ($census->columns() as $column) { |
|
591 | - $html .= '<td class="wt-census-assistant-field"><input class="form-control wt-census-assistant-form-control" type="text" value="' . $column->generate($individual, $head) . '" name="ca_individuals[' . $individual->getXref() . '][]"></td>'; |
|
592 | - } |
|
593 | - |
|
594 | - return '<tr class="wt-census-assistant-row"><td class="wt-census-assistant-field" hidden>' . $individual->getXref() . '</td>' . $html . '<td class="wt-census-assistant-field"><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
595 | - } |
|
462 | + } |
|
463 | + |
|
464 | + /** |
|
465 | + * Convert custom markup into HTML |
|
466 | + * |
|
467 | + * @param Note $note |
|
468 | + * |
|
469 | + * @return string |
|
470 | + */ |
|
471 | + public static function formatCensusNote(Note $note) { |
|
472 | + if (preg_match('/(.*)((?:\n.*)*)\n\.start_formatted_area\.\n(.+)\n(.+(?:\n.+)*)\n.end_formatted_area\.((?:\n.*)*)/', $note->getNote(), $match)) { |
|
473 | + // This looks like a census-assistant shared note |
|
474 | + $title = Filter::escapeHtml($match[1]); |
|
475 | + $preamble = Filter::escapeHtml($match[2]); |
|
476 | + $header = Filter::escapeHtml($match[3]); |
|
477 | + $data = Filter::escapeHtml($match[4]); |
|
478 | + $postamble = Filter::escapeHtml($match[5]); |
|
479 | + |
|
480 | + // Get the column headers for the census to which this note refers |
|
481 | + // requires the fact place & date to match the specific census |
|
482 | + // censusPlace() (Soundex match) and censusDate() functions |
|
483 | + $fmt_headers = []; |
|
484 | + /** @var GedcomRecord[] $linkedRecords */ |
|
485 | + $linkedRecords = array_merge($note->linkedIndividuals('NOTE'), $note->linkedFamilies('NOTE')); |
|
486 | + $firstRecord = array_shift($linkedRecords); |
|
487 | + if ($firstRecord) { |
|
488 | + $countryCode = ''; |
|
489 | + $date = ''; |
|
490 | + foreach ($firstRecord->getFacts('CENS') as $fact) { |
|
491 | + if (trim($fact->getAttribute('NOTE'), '@') === $note->getXref()) { |
|
492 | + $date = $fact->getAttribute('DATE'); |
|
493 | + $place = explode(',', strip_tags($fact->getPlace()->getFullName())); |
|
494 | + $countryCode = Soundex::daitchMokotoff(array_pop($place)); |
|
495 | + break; |
|
496 | + } |
|
497 | + } |
|
498 | + |
|
499 | + foreach (Census::allCensusPlaces() as $censusPlace) { |
|
500 | + if (Soundex::compare($countryCode, Soundex::daitchMokotoff($censusPlace->censusPlace()))) { |
|
501 | + foreach ($censusPlace->allCensusDates() as $census) { |
|
502 | + if ($census->censusDate() == $date) { |
|
503 | + foreach ($census->columns() as $column) { |
|
504 | + $abbrev = $column->abbreviation(); |
|
505 | + if ($abbrev) { |
|
506 | + $description = $column->title() ? $column->title() : I18N::translate('Description unavailable'); |
|
507 | + $fmt_headers[$abbrev] = '<span title="' . $description . '">' . $abbrev . '</span>'; |
|
508 | + } |
|
509 | + } |
|
510 | + break 2; |
|
511 | + } |
|
512 | + } |
|
513 | + } |
|
514 | + } |
|
515 | + } |
|
516 | + // Substitute header labels and format as HTML |
|
517 | + $thead = '<tr><th>' . strtr(str_replace('|', '</th><th>', $header), $fmt_headers) . '</th></tr>'; |
|
518 | + $thead = str_replace('.b.', '', $thead); |
|
519 | + |
|
520 | + // Format data as HTML |
|
521 | + $tbody = ''; |
|
522 | + foreach (explode("\n", $data) as $row) { |
|
523 | + $tbody .= '<tr>'; |
|
524 | + foreach (explode('|', $row) as $column) { |
|
525 | + $tbody .= '<td>' . $column . '</td>'; |
|
526 | + } |
|
527 | + $tbody .= '</tr>'; |
|
528 | + } |
|
529 | + |
|
530 | + return |
|
531 | + $title . "\n" . // The newline allows the framework to expand the details and turn the first line into a link |
|
532 | + '<div class="markdown">' . |
|
533 | + '<p>' . $preamble . '</p>' . |
|
534 | + '<table>' . |
|
535 | + '<thead>' . $thead . '</thead>' . |
|
536 | + '<tbody>' . $tbody . '</tbody>' . |
|
537 | + '</table>' . |
|
538 | + '<p>' . $postamble . '</p>' . |
|
539 | + '</div>'; |
|
540 | + } else { |
|
541 | + // Not a census-assistant shared note - apply default formatting |
|
542 | + return Filter::formatText($note->getNote(), $note->getTree()); |
|
543 | + } |
|
544 | + } |
|
545 | + |
|
546 | + /** |
|
547 | + * Generate an HTML row of data for the census header |
|
548 | + * Add prefix cell (store XREF and drag/drop) |
|
549 | + * Add suffix cell (delete button) |
|
550 | + * |
|
551 | + * @param CensusInterface $census |
|
552 | + * |
|
553 | + * @return string |
|
554 | + */ |
|
555 | + public static function censusTableHeader(CensusInterface $census) { |
|
556 | + $html = ''; |
|
557 | + foreach ($census->columns() as $column) { |
|
558 | + $html .= '<th class="wt-census-assistant-field" title="' . $column->title() . '">' . $column->abbreviation() . '</th>'; |
|
559 | + } |
|
560 | + |
|
561 | + return '<tr class="wt-census-assistant-row"><th hidden></th>' . $html . '<th></th></tr>'; |
|
562 | + } |
|
563 | + |
|
564 | + /** |
|
565 | + * Generate an HTML row of data for the census |
|
566 | + * Add prefix cell (store XREF and drag/drop) |
|
567 | + * Add suffix cell (delete button) |
|
568 | + * |
|
569 | + * @param CensusInterface $census |
|
570 | + * |
|
571 | + * @return string |
|
572 | + */ |
|
573 | + public static function censusTableEmptyRow(CensusInterface $census) { |
|
574 | + return '<tr class="wt-census-assistant-row"><td hidden></td>' . str_repeat('<td class="wt-census-assistant-field"><input type="text" class="form-control wt-census-assistant-form-control"></td>', count($census->columns())) . '<td><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
575 | + } |
|
576 | + |
|
577 | + /** |
|
578 | + * Generate an HTML row of data for the census |
|
579 | + * Add prefix cell (store XREF and drag/drop) |
|
580 | + * Add suffix cell (delete button) |
|
581 | + * |
|
582 | + * @param CensusInterface $census |
|
583 | + * @param Individual $individual |
|
584 | + * @param Individual $head |
|
585 | + * |
|
586 | + * @return string |
|
587 | + */ |
|
588 | + public static function censusTableRow(CensusInterface $census, Individual $individual, Individual $head) { |
|
589 | + $html = ''; |
|
590 | + foreach ($census->columns() as $column) { |
|
591 | + $html .= '<td class="wt-census-assistant-field"><input class="form-control wt-census-assistant-form-control" type="text" value="' . $column->generate($individual, $head) . '" name="ca_individuals[' . $individual->getXref() . '][]"></td>'; |
|
592 | + } |
|
593 | + |
|
594 | + return '<tr class="wt-census-assistant-row"><td class="wt-census-assistant-field" hidden>' . $individual->getXref() . '</td>' . $html . '<td class="wt-census-assistant-field"><a class="icon-remove" href="#" title="' . I18N::translate('Remove') . '"></a></td></tr>'; |
|
595 | + } |
|
596 | 596 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $years -= $years % 5; |
41 | 41 | } |
42 | 42 | |
43 | - return (string)$years; |
|
43 | + return (string) $years; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |