@@ -28,86 +28,86 @@ discard block |
||
28 | 28 | * Class RelativesTabModule |
29 | 29 | */ |
30 | 30 | class RelativesTabModule extends AbstractModule implements ModuleTabInterface { |
31 | - /** |
|
32 | - * How should this module be labelled on tabs, menus, etc.? |
|
33 | - * |
|
34 | - * @return string |
|
35 | - */ |
|
36 | - public function getTitle() { |
|
37 | - return /* I18N: Name of a module */ I18N::translate('Families'); |
|
38 | - } |
|
31 | + /** |
|
32 | + * How should this module be labelled on tabs, menus, etc.? |
|
33 | + * |
|
34 | + * @return string |
|
35 | + */ |
|
36 | + public function getTitle() { |
|
37 | + return /* I18N: Name of a module */ I18N::translate('Families'); |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * A sentence describing what this module does. |
|
42 | - * |
|
43 | - * @return string |
|
44 | - */ |
|
45 | - public function getDescription() { |
|
46 | - return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); |
|
47 | - } |
|
40 | + /** |
|
41 | + * A sentence describing what this module does. |
|
42 | + * |
|
43 | + * @return string |
|
44 | + */ |
|
45 | + public function getDescription() { |
|
46 | + return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * The user can re-arrange the tab order, but until they do, this |
|
51 | - * is the order in which tabs are shown. |
|
52 | - * |
|
53 | - * @return int |
|
54 | - */ |
|
55 | - public function defaultTabOrder() { |
|
56 | - return 20; |
|
57 | - } |
|
49 | + /** |
|
50 | + * The user can re-arrange the tab order, but until they do, this |
|
51 | + * is the order in which tabs are shown. |
|
52 | + * |
|
53 | + * @return int |
|
54 | + */ |
|
55 | + public function defaultTabOrder() { |
|
56 | + return 20; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Display the age difference between marriages and the births of children. |
|
61 | - * |
|
62 | - * @param Date $prev |
|
63 | - * @param Date $next |
|
64 | - * @param int $child_number |
|
65 | - * |
|
66 | - * @return string |
|
67 | - */ |
|
68 | - private static function ageDifference(Date $prev, Date $next, $child_number = 0) { |
|
69 | - if ($prev->isOK() && $next->isOK()) { |
|
70 | - $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); |
|
71 | - if ($days < 0) { |
|
72 | - // Show warning triangle if dates in reverse order |
|
73 | - $diff = '<i class="icon-warning"></i> '; |
|
74 | - } elseif ($child_number > 1 && $days > 1 && $days < 240) { |
|
75 | - // Show warning triangle if children born too close together |
|
76 | - $diff = '<i class="icon-warning"></i> '; |
|
77 | - } else { |
|
78 | - $diff = ''; |
|
79 | - } |
|
59 | + /** |
|
60 | + * Display the age difference between marriages and the births of children. |
|
61 | + * |
|
62 | + * @param Date $prev |
|
63 | + * @param Date $next |
|
64 | + * @param int $child_number |
|
65 | + * |
|
66 | + * @return string |
|
67 | + */ |
|
68 | + private static function ageDifference(Date $prev, Date $next, $child_number = 0) { |
|
69 | + if ($prev->isOK() && $next->isOK()) { |
|
70 | + $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); |
|
71 | + if ($days < 0) { |
|
72 | + // Show warning triangle if dates in reverse order |
|
73 | + $diff = '<i class="icon-warning"></i> '; |
|
74 | + } elseif ($child_number > 1 && $days > 1 && $days < 240) { |
|
75 | + // Show warning triangle if children born too close together |
|
76 | + $diff = '<i class="icon-warning"></i> '; |
|
77 | + } else { |
|
78 | + $diff = ''; |
|
79 | + } |
|
80 | 80 | |
81 | - $months = round($days * 12 / 365.25); // Approximate - we do not know the calendar |
|
82 | - if (abs($months) == 12 || abs($months) >= 24) { |
|
83 | - $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12))); |
|
84 | - } elseif ($months != 0) { |
|
85 | - $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months)); |
|
86 | - } |
|
81 | + $months = round($days * 12 / 365.25); // Approximate - we do not know the calendar |
|
82 | + if (abs($months) == 12 || abs($months) >= 24) { |
|
83 | + $diff .= I18N::plural('%s year', '%s years', round($months / 12), I18N::number(round($months / 12))); |
|
84 | + } elseif ($months != 0) { |
|
85 | + $diff .= I18N::plural('%s month', '%s months', $months, I18N::number($months)); |
|
86 | + } |
|
87 | 87 | |
88 | - return '<div class="elderdate age">' . $diff . '</div>'; |
|
89 | - } else { |
|
90 | - return ''; |
|
91 | - } |
|
92 | - } |
|
88 | + return '<div class="elderdate age">' . $diff . '</div>'; |
|
89 | + } else { |
|
90 | + return ''; |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Print a family group. |
|
96 | - * |
|
97 | - * @param Family $family |
|
98 | - * @param string $type |
|
99 | - * @param string $label |
|
100 | - */ |
|
101 | - private function printFamily(Family $family, $type, $label) { |
|
102 | - global $controller; |
|
94 | + /** |
|
95 | + * Print a family group. |
|
96 | + * |
|
97 | + * @param Family $family |
|
98 | + * @param string $type |
|
99 | + * @param string $label |
|
100 | + */ |
|
101 | + private function printFamily(Family $family, $type, $label) { |
|
102 | + global $controller; |
|
103 | 103 | |
104 | - if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { |
|
105 | - $access_level = Auth::PRIV_HIDE; |
|
106 | - } else { |
|
107 | - $access_level = Auth::accessLevel($family->getTree()); |
|
108 | - } |
|
104 | + if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { |
|
105 | + $access_level = Auth::PRIV_HIDE; |
|
106 | + } else { |
|
107 | + $access_level = Auth::accessLevel($family->getTree()); |
|
108 | + } |
|
109 | 109 | |
110 | - ?> |
|
110 | + ?> |
|
111 | 111 | <table> |
112 | 112 | <tr> |
113 | 113 | <td> |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | <table class="facts_table"> |
123 | 123 | <?php |
124 | 124 | |
125 | - ///// HUSB ///// |
|
126 | - $found = false; |
|
127 | - foreach ($family->getFacts('HUSB', false, $access_level) as $fact) { |
|
128 | - $found |= !$fact->isPendingDeletion(); |
|
129 | - $person = $fact->getTarget(); |
|
130 | - if ($person instanceof Individual) { |
|
131 | - if ($fact->isPendingAddition()) { |
|
132 | - $class = 'facts_label new'; |
|
133 | - } elseif ($fact->isPendingDeletion()) { |
|
134 | - $class = 'facts_label old'; |
|
135 | - } else { |
|
136 | - $class = 'facts_label'; |
|
137 | - } |
|
138 | - ?> |
|
125 | + ///// HUSB ///// |
|
126 | + $found = false; |
|
127 | + foreach ($family->getFacts('HUSB', false, $access_level) as $fact) { |
|
128 | + $found |= !$fact->isPendingDeletion(); |
|
129 | + $person = $fact->getTarget(); |
|
130 | + if ($person instanceof Individual) { |
|
131 | + if ($fact->isPendingAddition()) { |
|
132 | + $class = 'facts_label new'; |
|
133 | + } elseif ($fact->isPendingDeletion()) { |
|
134 | + $class = 'facts_label old'; |
|
135 | + } else { |
|
136 | + $class = 'facts_label'; |
|
137 | + } |
|
138 | + ?> |
|
139 | 139 | <tr> |
140 | 140 | <td class="<?php echo $class; ?>"> |
141 | 141 | <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> |
@@ -145,31 +145,31 @@ discard block |
||
145 | 145 | </td> |
146 | 146 | </tr> |
147 | 147 | <?php |
148 | - } |
|
149 | - } |
|
150 | - if (!$found && $family->canEdit()) { |
|
151 | - ?> |
|
148 | + } |
|
149 | + } |
|
150 | + if (!$found && $family->canEdit()) { |
|
151 | + ?> |
|
152 | 152 | <tr> |
153 | 153 | <td class="facts_label"></td> |
154 | 154 | <td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'HUSB');"><?php echo I18N::translate('Add a husband to this family'); ?></a></td> |
155 | 155 | </tr> |
156 | 156 | <?php |
157 | - } |
|
157 | + } |
|
158 | 158 | |
159 | - ///// WIFE ///// |
|
160 | - $found = false; |
|
161 | - foreach ($family->getFacts('WIFE', false, $access_level) as $fact) { |
|
162 | - $person = $fact->getTarget(); |
|
163 | - if ($person instanceof Individual) { |
|
164 | - $found |= !$fact->isPendingDeletion(); |
|
165 | - if ($fact->isPendingAddition()) { |
|
166 | - $class = 'facts_label new'; |
|
167 | - } elseif ($fact->isPendingDeletion()) { |
|
168 | - $class = 'facts_label old'; |
|
169 | - } else { |
|
170 | - $class = 'facts_label'; |
|
171 | - } |
|
172 | - ?> |
|
159 | + ///// WIFE ///// |
|
160 | + $found = false; |
|
161 | + foreach ($family->getFacts('WIFE', false, $access_level) as $fact) { |
|
162 | + $person = $fact->getTarget(); |
|
163 | + if ($person instanceof Individual) { |
|
164 | + $found |= !$fact->isPendingDeletion(); |
|
165 | + if ($fact->isPendingAddition()) { |
|
166 | + $class = 'facts_label new'; |
|
167 | + } elseif ($fact->isPendingDeletion()) { |
|
168 | + $class = 'facts_label old'; |
|
169 | + } else { |
|
170 | + $class = 'facts_label'; |
|
171 | + } |
|
172 | + ?> |
|
173 | 173 | <tr> |
174 | 174 | <td class="<?php echo $class; ?>"> |
175 | 175 | <?php echo Functions::getCloseRelationshipName($controller->record, $person); ?> |
@@ -179,30 +179,30 @@ discard block |
||
179 | 179 | </td> |
180 | 180 | </tr> |
181 | 181 | <?php |
182 | - } |
|
183 | - } |
|
184 | - if (!$found && $family->canEdit()) { |
|
185 | - ?> |
|
182 | + } |
|
183 | + } |
|
184 | + if (!$found && $family->canEdit()) { |
|
185 | + ?> |
|
186 | 186 | <tr> |
187 | 187 | <td class="facts_label"></td> |
188 | 188 | <td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?>', 'WIFE');"><?php echo I18N::translate('Add a wife to this family'); ?></a></td> |
189 | 189 | </tr> |
190 | 190 | <?php |
191 | - } |
|
191 | + } |
|
192 | 192 | |
193 | - ///// MARR ///// |
|
194 | - $found = false; |
|
195 | - $prev = new Date(''); |
|
196 | - foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { |
|
197 | - $found |= !$fact->isPendingDeletion(); |
|
198 | - if ($fact->isPendingAddition()) { |
|
199 | - $class = ' new'; |
|
200 | - } elseif ($fact->isPendingDeletion()) { |
|
201 | - $class = ' old'; |
|
202 | - } else { |
|
203 | - $class = ''; |
|
204 | - } |
|
205 | - ?> |
|
193 | + ///// MARR ///// |
|
194 | + $found = false; |
|
195 | + $prev = new Date(''); |
|
196 | + foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) { |
|
197 | + $found |= !$fact->isPendingDeletion(); |
|
198 | + if ($fact->isPendingAddition()) { |
|
199 | + $class = ' new'; |
|
200 | + } elseif ($fact->isPendingDeletion()) { |
|
201 | + $class = ' old'; |
|
202 | + } else { |
|
203 | + $class = ''; |
|
204 | + } |
|
205 | + ?> |
|
206 | 206 | <tr> |
207 | 207 | <td class="facts_label"> |
208 | 208 | </td> |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | </td> |
212 | 212 | </tr> |
213 | 213 | <?php |
214 | - if (!$prev->isOK() && $fact->getDate()->isOK()) { |
|
215 | - $prev = $fact->getDate(); |
|
216 | - } |
|
217 | - } |
|
218 | - if (!$found && $family->canShow() && $family->canEdit()) { |
|
219 | - // Add a new marriage |
|
220 | - ?> |
|
214 | + if (!$prev->isOK() && $fact->getDate()->isOK()) { |
|
215 | + $prev = $fact->getDate(); |
|
216 | + } |
|
217 | + } |
|
218 | + if (!$found && $family->canShow() && $family->canEdit()) { |
|
219 | + // Add a new marriage |
|
220 | + ?> |
|
221 | 221 | <tr> |
222 | 222 | <td class="facts_label"> |
223 | 223 | </td> |
@@ -228,30 +228,30 @@ discard block |
||
228 | 228 | </td> |
229 | 229 | </tr> |
230 | 230 | <?php |
231 | - } |
|
231 | + } |
|
232 | 232 | |
233 | - ///// CHIL ///// |
|
234 | - $child_number = 0; |
|
235 | - foreach ($family->getFacts('CHIL', false, $access_level) as $fact) { |
|
236 | - $person = $fact->getTarget(); |
|
237 | - if ($person instanceof Individual) { |
|
238 | - if ($fact->isPendingAddition()) { |
|
239 | - $child_number++; |
|
240 | - $class = 'facts_label new'; |
|
241 | - } elseif ($fact->isPendingDeletion()) { |
|
242 | - $class = 'facts_label old'; |
|
243 | - } else { |
|
244 | - $child_number++; |
|
245 | - $class = 'facts_label'; |
|
246 | - } |
|
247 | - $next = new Date(''); |
|
248 | - foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { |
|
249 | - if ($bfact->getDate()->isOK()) { |
|
250 | - $next = $bfact->getDate(); |
|
251 | - break; |
|
252 | - } |
|
253 | - } |
|
254 | - ?> |
|
233 | + ///// CHIL ///// |
|
234 | + $child_number = 0; |
|
235 | + foreach ($family->getFacts('CHIL', false, $access_level) as $fact) { |
|
236 | + $person = $fact->getTarget(); |
|
237 | + if ($person instanceof Individual) { |
|
238 | + if ($fact->isPendingAddition()) { |
|
239 | + $child_number++; |
|
240 | + $class = 'facts_label new'; |
|
241 | + } elseif ($fact->isPendingDeletion()) { |
|
242 | + $class = 'facts_label old'; |
|
243 | + } else { |
|
244 | + $child_number++; |
|
245 | + $class = 'facts_label'; |
|
246 | + } |
|
247 | + $next = new Date(''); |
|
248 | + foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) { |
|
249 | + if ($bfact->getDate()->isOK()) { |
|
250 | + $next = $bfact->getDate(); |
|
251 | + break; |
|
252 | + } |
|
253 | + } |
|
254 | + ?> |
|
255 | 255 | <tr> |
256 | 256 | <td class="<?php echo $class; ?>"> |
257 | 257 | <?php echo self::ageDifference($prev, $next, $child_number); ?> |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | </td> |
263 | 263 | </tr> |
264 | 264 | <?php |
265 | - $prev = $next; |
|
266 | - } |
|
267 | - } |
|
268 | - // Re-order children / add a new child |
|
269 | - if ($family->canEdit()) { |
|
270 | - if ($type == 'FAMS') { |
|
271 | - $add_child_text = I18N::translate('Add a son or daughter'); |
|
272 | - } else { |
|
273 | - $add_child_text = I18N::translate('Add a brother or sister'); |
|
274 | - } |
|
275 | - ?> |
|
265 | + $prev = $next; |
|
266 | + } |
|
267 | + } |
|
268 | + // Re-order children / add a new child |
|
269 | + if ($family->canEdit()) { |
|
270 | + if ($type == 'FAMS') { |
|
271 | + $add_child_text = I18N::translate('Add a son or daughter'); |
|
272 | + } else { |
|
273 | + $add_child_text = I18N::translate('Add a brother or sister'); |
|
274 | + } |
|
275 | + ?> |
|
276 | 276 | <tr class="noprint"> |
277 | 277 | <td class="facts_label"> |
278 | 278 | <?php if (count($family->getChildren()) > 1) { ?> |
@@ -288,25 +288,25 @@ discard block |
||
288 | 288 | </td> |
289 | 289 | </tr> |
290 | 290 | <?php |
291 | - } |
|
291 | + } |
|
292 | 292 | |
293 | - echo '</table>'; |
|
293 | + echo '</table>'; |
|
294 | 294 | |
295 | - return; |
|
296 | - } |
|
295 | + return; |
|
296 | + } |
|
297 | 297 | |
298 | - /** {@inheritdoc} */ |
|
299 | - public function getTabContent() { |
|
300 | - global $show_full, $controller; |
|
298 | + /** {@inheritdoc} */ |
|
299 | + public function getTabContent() { |
|
300 | + global $show_full, $controller; |
|
301 | 301 | |
302 | - if (isset($show_full)) { |
|
303 | - $saved_show_full = $show_full; |
|
304 | - } |
|
305 | - // We always want to see full details here |
|
306 | - $show_full = 1; |
|
302 | + if (isset($show_full)) { |
|
303 | + $saved_show_full = $show_full; |
|
304 | + } |
|
305 | + // We always want to see full details here |
|
306 | + $show_full = 1; |
|
307 | 307 | |
308 | - ob_start(); |
|
309 | - ?> |
|
308 | + ob_start(); |
|
309 | + ?> |
|
310 | 310 | <table class="facts_table"> |
311 | 311 | <tr class="noprint"> |
312 | 312 | <td class="descriptionbox rela"> |
@@ -318,9 +318,9 @@ discard block |
||
318 | 318 | </tr> |
319 | 319 | </table> |
320 | 320 | <?php |
321 | - $families = $controller->record->getChildFamilies(); |
|
322 | - if (!$families && $controller->record->canEdit()) { |
|
323 | - ?> |
|
321 | + $families = $controller->record->getChildFamilies(); |
|
322 | + if (!$families && $controller->record->canEdit()) { |
|
323 | + ?> |
|
324 | 324 | <table class="facts_table"> |
325 | 325 | <tr> |
326 | 326 | <td class="facts_value"><a href="#" onclick="return add_parent_to_individual('<?php echo $controller->record->getXref(); ?>', 'M');"><?php echo I18N::translate('Add a father'); ?></td> |
@@ -330,34 +330,34 @@ discard block |
||
330 | 330 | </tr> |
331 | 331 | </table> |
332 | 332 | <?php |
333 | - } |
|
333 | + } |
|
334 | 334 | |
335 | - // parents |
|
336 | - foreach ($families as $family) { |
|
337 | - $this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family)); |
|
338 | - } |
|
335 | + // parents |
|
336 | + foreach ($families as $family) { |
|
337 | + $this->printFamily($family, 'FAMC', $controller->record->getChildFamilyLabel($family)); |
|
338 | + } |
|
339 | 339 | |
340 | - // step-parents |
|
341 | - foreach ($controller->record->getChildStepFamilies() as $family) { |
|
342 | - $this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family)); |
|
343 | - } |
|
340 | + // step-parents |
|
341 | + foreach ($controller->record->getChildStepFamilies() as $family) { |
|
342 | + $this->printFamily($family, 'FAMC', $controller->record->getStepFamilyLabel($family)); |
|
343 | + } |
|
344 | 344 | |
345 | - // spouses |
|
346 | - $families = $controller->record->getSpouseFamilies(); |
|
347 | - foreach ($families as $family) { |
|
348 | - $this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record)); |
|
349 | - } |
|
345 | + // spouses |
|
346 | + $families = $controller->record->getSpouseFamilies(); |
|
347 | + foreach ($families as $family) { |
|
348 | + $this->printFamily($family, 'FAMS', $controller->getSpouseFamilyLabel($family, $controller->record)); |
|
349 | + } |
|
350 | 350 | |
351 | - // step-children |
|
352 | - foreach ($controller->record->getSpouseStepFamilies() as $family) { |
|
353 | - $this->printFamily($family, 'FAMS', $family->getFullName()); |
|
354 | - } |
|
351 | + // step-children |
|
352 | + foreach ($controller->record->getSpouseStepFamilies() as $family) { |
|
353 | + $this->printFamily($family, 'FAMS', $family->getFullName()); |
|
354 | + } |
|
355 | 355 | |
356 | - if ($controller->record->canEdit()) { |
|
357 | - ?> |
|
356 | + if ($controller->record->canEdit()) { |
|
357 | + ?> |
|
358 | 358 | <br><table class="facts_table noprint"> |
359 | 359 | <?php |
360 | - if (count($families) > 1) { ?> |
|
360 | + if (count($families) > 1) { ?> |
|
361 | 361 | <tr> |
362 | 362 | <td class="facts_value"> |
363 | 363 | <a href="#" onclick="return reorder_families('<?php echo $controller->record->getXref(); ?>');"><?php echo I18N::translate('Re-order families'); ?></a> |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | </td> |
382 | 382 | </tr> |
383 | 383 | <?php } |
384 | - if ($controller->record->getSex() != "M") { ?> |
|
384 | + if ($controller->record->getSex() != "M") { ?> |
|
385 | 385 | <tr> |
386 | 386 | <td class="facts_value"> |
387 | 387 | <a href="#" onclick="return add_spouse_to_individual('<?php echo $controller->record->getXref(); ?>','HUSB');"><?php echo I18N::translate('Add a husband'); ?></a> |
@@ -406,29 +406,29 @@ discard block |
||
406 | 406 | </script> |
407 | 407 | <?php |
408 | 408 | |
409 | - unset($show_full); |
|
410 | - if (isset($saved_show_full)) { |
|
411 | - $show_full = $saved_show_full; |
|
412 | - } |
|
409 | + unset($show_full); |
|
410 | + if (isset($saved_show_full)) { |
|
411 | + $show_full = $saved_show_full; |
|
412 | + } |
|
413 | 413 | |
414 | - return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; |
|
415 | - } |
|
414 | + return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>'; |
|
415 | + } |
|
416 | 416 | |
417 | - /** {@inheritdoc} */ |
|
418 | - public function hasTabContent() { |
|
419 | - return true; |
|
420 | - } |
|
421 | - /** {@inheritdoc} */ |
|
422 | - public function isGrayedOut() { |
|
423 | - return false; |
|
424 | - } |
|
425 | - /** {@inheritdoc} */ |
|
426 | - public function canLoadAjax() { |
|
427 | - return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
|
428 | - } |
|
417 | + /** {@inheritdoc} */ |
|
418 | + public function hasTabContent() { |
|
419 | + return true; |
|
420 | + } |
|
421 | + /** {@inheritdoc} */ |
|
422 | + public function isGrayedOut() { |
|
423 | + return false; |
|
424 | + } |
|
425 | + /** {@inheritdoc} */ |
|
426 | + public function canLoadAjax() { |
|
427 | + return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
|
428 | + } |
|
429 | 429 | |
430 | - /** {@inheritdoc} */ |
|
431 | - public function getPreLoadContent() { |
|
432 | - return ''; |
|
433 | - } |
|
430 | + /** {@inheritdoc} */ |
|
431 | + public function getPreLoadContent() { |
|
432 | + return ''; |
|
433 | + } |
|
434 | 434 | } |
@@ -27,13 +27,15 @@ discard block |
||
27 | 27 | /** |
28 | 28 | * Class RelativesTabModule |
29 | 29 | */ |
30 | -class RelativesTabModule extends AbstractModule implements ModuleTabInterface { |
|
30 | +class RelativesTabModule extends AbstractModule implements ModuleTabInterface |
|
31 | +{ |
|
31 | 32 | /** |
32 | 33 | * How should this module be labelled on tabs, menus, etc.? |
33 | 34 | * |
34 | 35 | * @return string |
35 | 36 | */ |
36 | - public function getTitle() { |
|
37 | + public function getTitle() |
|
38 | + { |
|
37 | 39 | return /* I18N: Name of a module */ I18N::translate('Families'); |
38 | 40 | } |
39 | 41 | |
@@ -42,7 +44,8 @@ discard block |
||
42 | 44 | * |
43 | 45 | * @return string |
44 | 46 | */ |
45 | - public function getDescription() { |
|
47 | + public function getDescription() |
|
48 | + { |
|
46 | 49 | return /* I18N: Description of the “Families” module */ I18N::translate('A tab showing the close relatives of an individual.'); |
47 | 50 | } |
48 | 51 | |
@@ -52,7 +55,8 @@ discard block |
||
52 | 55 | * |
53 | 56 | * @return int |
54 | 57 | */ |
55 | - public function defaultTabOrder() { |
|
58 | + public function defaultTabOrder() |
|
59 | + { |
|
56 | 60 | return 20; |
57 | 61 | } |
58 | 62 | |
@@ -65,7 +69,8 @@ discard block |
||
65 | 69 | * |
66 | 70 | * @return string |
67 | 71 | */ |
68 | - private static function ageDifference(Date $prev, Date $next, $child_number = 0) { |
|
72 | + private static function ageDifference(Date $prev, Date $next, $child_number = 0) |
|
73 | + { |
|
69 | 74 | if ($prev->isOK() && $next->isOK()) { |
70 | 75 | $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); |
71 | 76 | if ($days < 0) { |
@@ -98,7 +103,8 @@ discard block |
||
98 | 103 | * @param string $type |
99 | 104 | * @param string $label |
100 | 105 | */ |
101 | - private function printFamily(Family $family, $type, $label) { |
|
106 | + private function printFamily(Family $family, $type, $label) |
|
107 | + { |
|
102 | 108 | global $controller; |
103 | 109 | |
104 | 110 | if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) { |
@@ -296,7 +302,8 @@ discard block |
||
296 | 302 | } |
297 | 303 | |
298 | 304 | /** {@inheritdoc} */ |
299 | - public function getTabContent() { |
|
305 | + public function getTabContent() |
|
306 | + { |
|
300 | 307 | global $show_full, $controller; |
301 | 308 | |
302 | 309 | if (isset($show_full)) { |
@@ -415,20 +422,24 @@ discard block |
||
415 | 422 | } |
416 | 423 | |
417 | 424 | /** {@inheritdoc} */ |
418 | - public function hasTabContent() { |
|
425 | + public function hasTabContent() |
|
426 | + { |
|
419 | 427 | return true; |
420 | 428 | } |
421 | 429 | /** {@inheritdoc} */ |
422 | - public function isGrayedOut() { |
|
430 | + public function isGrayedOut() |
|
431 | + { |
|
423 | 432 | return false; |
424 | 433 | } |
425 | 434 | /** {@inheritdoc} */ |
426 | - public function canLoadAjax() { |
|
435 | + public function canLoadAjax() |
|
436 | + { |
|
427 | 437 | return !Auth::isSearchEngine(); // Search engines cannot use AJAX |
428 | 438 | } |
429 | 439 | |
430 | 440 | /** {@inheritdoc} */ |
431 | - public function getPreLoadContent() { |
|
441 | + public function getPreLoadContent() |
|
442 | + { |
|
432 | 443 | return ''; |
433 | 444 | } |
434 | 445 | } |
@@ -27,144 +27,144 @@ |
||
27 | 27 | * Class TopPageViewsModule |
28 | 28 | */ |
29 | 29 | class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface { |
30 | - /** |
|
31 | - * How should this module be labelled on tabs, menus, etc.? |
|
32 | - * |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getTitle() { |
|
36 | - return /* I18N: Name of a module */ I18N::translate('Most viewed pages'); |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * A sentence describing what this module does. |
|
41 | - * |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function getDescription() { |
|
45 | - return /* I18N: Description of the “Most visited pages” module */ I18N::translate('A list of the pages that have been viewed the most number of times.'); |
|
46 | - } |
|
47 | - |
|
48 | - /** |
|
49 | - * Generate the HTML content of this block. |
|
50 | - * |
|
51 | - * @param int $block_id |
|
52 | - * @param bool $template |
|
53 | - * @param string[] $cfg |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
58 | - global $ctype, $WT_TREE; |
|
59 | - |
|
60 | - $num = $this->getBlockSetting($block_id, 'num', '10'); |
|
61 | - $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before'); |
|
62 | - |
|
63 | - foreach (array('count_placement', 'num') as $name) { |
|
64 | - if (array_key_exists($name, $cfg)) { |
|
65 | - $$name = $cfg[$name]; |
|
66 | - } |
|
67 | - } |
|
68 | - |
|
69 | - $id = $this->getName() . $block_id; |
|
70 | - $class = $this->getName() . '_block'; |
|
71 | - if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { |
|
72 | - $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; |
|
73 | - } else { |
|
74 | - $title = ''; |
|
75 | - } |
|
76 | - $title .= $this->getTitle(); |
|
77 | - |
|
78 | - $content = ''; |
|
79 | - // load the lines from the file |
|
80 | - $top10 = Database::prepare( |
|
81 | - "SELECT page_parameter, page_count" . |
|
82 | - " FROM `##hit_counter`" . |
|
83 | - " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . |
|
84 | - " ORDER BY page_count DESC LIMIT :limit" |
|
85 | - )->execute(array( |
|
86 | - 'tree_id' => $WT_TREE->getTreeId(), |
|
87 | - 'limit' => (int) $num, |
|
88 | - ))->fetchAssoc(); |
|
89 | - |
|
90 | - $content .= '<table>'; |
|
91 | - foreach ($top10 as $id => $count) { |
|
92 | - $record = GedcomRecord::getInstance($id, $WT_TREE); |
|
93 | - if ($record && $record->canShow()) { |
|
94 | - $content .= '<tr>'; |
|
95 | - if ($count_placement == 'before') { |
|
96 | - $content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>'; |
|
97 | - } |
|
98 | - $content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>'; |
|
99 | - if ($count_placement == 'after') { |
|
100 | - $content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>'; |
|
101 | - } |
|
102 | - $content .= '</tr>'; |
|
103 | - } |
|
104 | - } |
|
105 | - $content .= "</table>"; |
|
106 | - |
|
107 | - if ($template) { |
|
108 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
109 | - } else { |
|
110 | - return $content; |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Should this block load asynchronously using AJAX? |
|
116 | - * |
|
117 | - * Simple blocks are faster in-line, more comples ones |
|
118 | - * can be loaded later. |
|
119 | - * |
|
120 | - * @return bool |
|
121 | - */ |
|
122 | - public function loadAjax() { |
|
123 | - return true; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * Can this block be shown on the user’s home page? |
|
128 | - * |
|
129 | - * @return bool |
|
130 | - */ |
|
131 | - public function isUserBlock() { |
|
132 | - return false; |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Can this block be shown on the tree’s home page? |
|
137 | - * |
|
138 | - * @return bool |
|
139 | - */ |
|
140 | - public function isGedcomBlock() { |
|
141 | - return true; |
|
142 | - } |
|
143 | - |
|
144 | - /** |
|
145 | - * An HTML form to edit block settings |
|
146 | - * |
|
147 | - * @param int $block_id |
|
148 | - */ |
|
149 | - public function configureBlock($block_id) { |
|
150 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
151 | - $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10)); |
|
152 | - $this->setBlockSetting($block_id, 'count_placement', Filter::post('count_placement', 'before|after', 'before')); |
|
153 | - } |
|
154 | - |
|
155 | - $num = $this->getBlockSetting($block_id, 'num', '10'); |
|
156 | - $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before'); |
|
157 | - |
|
158 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
159 | - echo /* I18N: ... to show in a list */ I18N::translate('Number of pages'); |
|
160 | - echo '</td><td class="optionbox">'; |
|
161 | - echo '<input type="text" name="num" size="2" value="', $num, '">'; |
|
162 | - echo '</td></tr>'; |
|
163 | - |
|
164 | - echo "<tr><td class=\"descriptionbox wrap width33\">"; |
|
165 | - echo /* I18N: Label for a configuration option */ I18N::translate('Show counts before or after name'); |
|
166 | - echo "</td><td class=\"optionbox\">"; |
|
167 | - echo FunctionsEdit::selectEditControl('count_placement', array('before' => I18N::translate('before'), 'after' => I18N::translate('after')), null, $count_placement, ''); |
|
168 | - echo '</td></tr>'; |
|
169 | - } |
|
30 | + /** |
|
31 | + * How should this module be labelled on tabs, menus, etc.? |
|
32 | + * |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getTitle() { |
|
36 | + return /* I18N: Name of a module */ I18N::translate('Most viewed pages'); |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * A sentence describing what this module does. |
|
41 | + * |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function getDescription() { |
|
45 | + return /* I18N: Description of the “Most visited pages” module */ I18N::translate('A list of the pages that have been viewed the most number of times.'); |
|
46 | + } |
|
47 | + |
|
48 | + /** |
|
49 | + * Generate the HTML content of this block. |
|
50 | + * |
|
51 | + * @param int $block_id |
|
52 | + * @param bool $template |
|
53 | + * @param string[] $cfg |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
58 | + global $ctype, $WT_TREE; |
|
59 | + |
|
60 | + $num = $this->getBlockSetting($block_id, 'num', '10'); |
|
61 | + $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before'); |
|
62 | + |
|
63 | + foreach (array('count_placement', 'num') as $name) { |
|
64 | + if (array_key_exists($name, $cfg)) { |
|
65 | + $$name = $cfg[$name]; |
|
66 | + } |
|
67 | + } |
|
68 | + |
|
69 | + $id = $this->getName() . $block_id; |
|
70 | + $class = $this->getName() . '_block'; |
|
71 | + if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) { |
|
72 | + $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; |
|
73 | + } else { |
|
74 | + $title = ''; |
|
75 | + } |
|
76 | + $title .= $this->getTitle(); |
|
77 | + |
|
78 | + $content = ''; |
|
79 | + // load the lines from the file |
|
80 | + $top10 = Database::prepare( |
|
81 | + "SELECT page_parameter, page_count" . |
|
82 | + " FROM `##hit_counter`" . |
|
83 | + " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . |
|
84 | + " ORDER BY page_count DESC LIMIT :limit" |
|
85 | + )->execute(array( |
|
86 | + 'tree_id' => $WT_TREE->getTreeId(), |
|
87 | + 'limit' => (int) $num, |
|
88 | + ))->fetchAssoc(); |
|
89 | + |
|
90 | + $content .= '<table>'; |
|
91 | + foreach ($top10 as $id => $count) { |
|
92 | + $record = GedcomRecord::getInstance($id, $WT_TREE); |
|
93 | + if ($record && $record->canShow()) { |
|
94 | + $content .= '<tr>'; |
|
95 | + if ($count_placement == 'before') { |
|
96 | + $content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>'; |
|
97 | + } |
|
98 | + $content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>'; |
|
99 | + if ($count_placement == 'after') { |
|
100 | + $content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>'; |
|
101 | + } |
|
102 | + $content .= '</tr>'; |
|
103 | + } |
|
104 | + } |
|
105 | + $content .= "</table>"; |
|
106 | + |
|
107 | + if ($template) { |
|
108 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
109 | + } else { |
|
110 | + return $content; |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Should this block load asynchronously using AJAX? |
|
116 | + * |
|
117 | + * Simple blocks are faster in-line, more comples ones |
|
118 | + * can be loaded later. |
|
119 | + * |
|
120 | + * @return bool |
|
121 | + */ |
|
122 | + public function loadAjax() { |
|
123 | + return true; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * Can this block be shown on the user’s home page? |
|
128 | + * |
|
129 | + * @return bool |
|
130 | + */ |
|
131 | + public function isUserBlock() { |
|
132 | + return false; |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Can this block be shown on the tree’s home page? |
|
137 | + * |
|
138 | + * @return bool |
|
139 | + */ |
|
140 | + public function isGedcomBlock() { |
|
141 | + return true; |
|
142 | + } |
|
143 | + |
|
144 | + /** |
|
145 | + * An HTML form to edit block settings |
|
146 | + * |
|
147 | + * @param int $block_id |
|
148 | + */ |
|
149 | + public function configureBlock($block_id) { |
|
150 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
151 | + $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10)); |
|
152 | + $this->setBlockSetting($block_id, 'count_placement', Filter::post('count_placement', 'before|after', 'before')); |
|
153 | + } |
|
154 | + |
|
155 | + $num = $this->getBlockSetting($block_id, 'num', '10'); |
|
156 | + $count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before'); |
|
157 | + |
|
158 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
159 | + echo /* I18N: ... to show in a list */ I18N::translate('Number of pages'); |
|
160 | + echo '</td><td class="optionbox">'; |
|
161 | + echo '<input type="text" name="num" size="2" value="', $num, '">'; |
|
162 | + echo '</td></tr>'; |
|
163 | + |
|
164 | + echo "<tr><td class=\"descriptionbox wrap width33\">"; |
|
165 | + echo /* I18N: Label for a configuration option */ I18N::translate('Show counts before or after name'); |
|
166 | + echo "</td><td class=\"optionbox\">"; |
|
167 | + echo FunctionsEdit::selectEditControl('count_placement', array('before' => I18N::translate('before'), 'after' => I18N::translate('after')), null, $count_placement, ''); |
|
168 | + echo '</td></tr>'; |
|
169 | + } |
|
170 | 170 | } |
@@ -26,13 +26,15 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * Class TopPageViewsModule |
28 | 28 | */ |
29 | -class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface { |
|
29 | +class TopPageViewsModule extends AbstractModule implements ModuleBlockInterface |
|
30 | +{ |
|
30 | 31 | /** |
31 | 32 | * How should this module be labelled on tabs, menus, etc.? |
32 | 33 | * |
33 | 34 | * @return string |
34 | 35 | */ |
35 | - public function getTitle() { |
|
36 | + public function getTitle() |
|
37 | + { |
|
36 | 38 | return /* I18N: Name of a module */ I18N::translate('Most viewed pages'); |
37 | 39 | } |
38 | 40 | |
@@ -41,7 +43,8 @@ discard block |
||
41 | 43 | * |
42 | 44 | * @return string |
43 | 45 | */ |
44 | - public function getDescription() { |
|
46 | + public function getDescription() |
|
47 | + { |
|
45 | 48 | return /* I18N: Description of the “Most visited pages” module */ I18N::translate('A list of the pages that have been viewed the most number of times.'); |
46 | 49 | } |
47 | 50 | |
@@ -54,7 +57,8 @@ discard block |
||
54 | 57 | * |
55 | 58 | * @return string |
56 | 59 | */ |
57 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
60 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
61 | + { |
|
58 | 62 | global $ctype, $WT_TREE; |
59 | 63 | |
60 | 64 | $num = $this->getBlockSetting($block_id, 'num', '10'); |
@@ -119,7 +123,8 @@ discard block |
||
119 | 123 | * |
120 | 124 | * @return bool |
121 | 125 | */ |
122 | - public function loadAjax() { |
|
126 | + public function loadAjax() |
|
127 | + { |
|
123 | 128 | return true; |
124 | 129 | } |
125 | 130 | |
@@ -128,7 +133,8 @@ discard block |
||
128 | 133 | * |
129 | 134 | * @return bool |
130 | 135 | */ |
131 | - public function isUserBlock() { |
|
136 | + public function isUserBlock() |
|
137 | + { |
|
132 | 138 | return false; |
133 | 139 | } |
134 | 140 | |
@@ -137,7 +143,8 @@ discard block |
||
137 | 143 | * |
138 | 144 | * @return bool |
139 | 145 | */ |
140 | - public function isGedcomBlock() { |
|
146 | + public function isGedcomBlock() |
|
147 | + { |
|
141 | 148 | return true; |
142 | 149 | } |
143 | 150 | |
@@ -146,7 +153,8 @@ discard block |
||
146 | 153 | * |
147 | 154 | * @param int $block_id |
148 | 155 | */ |
149 | - public function configureBlock($block_id) { |
|
156 | + public function configureBlock($block_id) |
|
157 | + { |
|
150 | 158 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
151 | 159 | $this->setBlockSetting($block_id, 'num', Filter::postInteger('num', 1, 10000, 10)); |
152 | 160 | $this->setBlockSetting($block_id, 'count_placement', Filter::post('count_placement', 'before|after', 'before')); |
@@ -22,17 +22,17 @@ |
||
22 | 22 | * Interface ModuleChartInterface - Classes and libraries for module system |
23 | 23 | */ |
24 | 24 | interface ModuleChartInterface { |
25 | - /** |
|
26 | - * Return a menu item for this chart. |
|
27 | - * |
|
28 | - * @return Menu|null |
|
29 | - */ |
|
30 | - public function getChartMenu(Individual $individual); |
|
25 | + /** |
|
26 | + * Return a menu item for this chart. |
|
27 | + * |
|
28 | + * @return Menu|null |
|
29 | + */ |
|
30 | + public function getChartMenu(Individual $individual); |
|
31 | 31 | |
32 | - /** |
|
33 | - * Return a menu item for this chart (for menu in individual box). |
|
34 | - * |
|
35 | - * @return Menu|null |
|
36 | - */ |
|
37 | - public function getBoxChartMenu(Individual $individual); |
|
32 | + /** |
|
33 | + * Return a menu item for this chart (for menu in individual box). |
|
34 | + * |
|
35 | + * @return Menu|null |
|
36 | + */ |
|
37 | + public function getBoxChartMenu(Individual $individual); |
|
38 | 38 | } |
@@ -21,7 +21,8 @@ |
||
21 | 21 | /** |
22 | 22 | * Interface ModuleChartInterface - Classes and libraries for module system |
23 | 23 | */ |
24 | -interface ModuleChartInterface { |
|
24 | +interface ModuleChartInterface |
|
25 | +{ |
|
25 | 26 | /** |
26 | 27 | * Return a menu item for this chart. |
27 | 28 | * |
@@ -24,55 +24,55 @@ |
||
24 | 24 | * Class FamilyBookChartModule |
25 | 25 | */ |
26 | 26 | class FamilyBookChartModule extends AbstractModule implements ModuleChartInterface { |
27 | - /** |
|
28 | - * How should this module be labelled on tabs, menus, etc.? |
|
29 | - * |
|
30 | - * @return string |
|
31 | - */ |
|
32 | - public function getTitle() { |
|
33 | - return /* I18N: Name of a module/chart */ I18N::translate('Family book'); |
|
34 | - } |
|
27 | + /** |
|
28 | + * How should this module be labelled on tabs, menus, etc.? |
|
29 | + * |
|
30 | + * @return string |
|
31 | + */ |
|
32 | + public function getTitle() { |
|
33 | + return /* I18N: Name of a module/chart */ I18N::translate('Family book'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * A sentence describing what this module does. |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function getDescription() { |
|
42 | - return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A chart of an individual’s ancestors and descendants, as a family book.'); |
|
43 | - } |
|
36 | + /** |
|
37 | + * A sentence describing what this module does. |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function getDescription() { |
|
42 | + return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A chart of an individual’s ancestors and descendants, as a family book.'); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * What is the default access level for this module? |
|
47 | - * |
|
48 | - * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
49 | - * |
|
50 | - * @return int |
|
51 | - */ |
|
52 | - public function defaultAccessLevel() { |
|
53 | - return Auth::PRIV_PRIVATE; |
|
54 | - } |
|
45 | + /** |
|
46 | + * What is the default access level for this module? |
|
47 | + * |
|
48 | + * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
49 | + * |
|
50 | + * @return int |
|
51 | + */ |
|
52 | + public function defaultAccessLevel() { |
|
53 | + return Auth::PRIV_PRIVATE; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * Return a menu item for this chart. |
|
58 | - * |
|
59 | - * @return Menu|null |
|
60 | - */ |
|
61 | - public function getChartMenu(Individual $individual) { |
|
62 | - return new Menu( |
|
63 | - $this->getTitle(), |
|
64 | - 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
65 | - 'menu-chart-familybook', |
|
66 | - array('rel' => 'nofollow') |
|
67 | - ); |
|
68 | - } |
|
56 | + /** |
|
57 | + * Return a menu item for this chart. |
|
58 | + * |
|
59 | + * @return Menu|null |
|
60 | + */ |
|
61 | + public function getChartMenu(Individual $individual) { |
|
62 | + return new Menu( |
|
63 | + $this->getTitle(), |
|
64 | + 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
|
65 | + 'menu-chart-familybook', |
|
66 | + array('rel' => 'nofollow') |
|
67 | + ); |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Return a menu item for this chart - for use in individual boxes. |
|
72 | - * |
|
73 | - * @return Menu|null |
|
74 | - */ |
|
75 | - public function getBoxChartMenu(Individual $individual) { |
|
76 | - return $this->getChartMenu($individual); |
|
77 | - } |
|
70 | + /** |
|
71 | + * Return a menu item for this chart - for use in individual boxes. |
|
72 | + * |
|
73 | + * @return Menu|null |
|
74 | + */ |
|
75 | + public function getBoxChartMenu(Individual $individual) { |
|
76 | + return $this->getChartMenu($individual); |
|
77 | + } |
|
78 | 78 | } |
@@ -23,13 +23,15 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class FamilyBookChartModule |
25 | 25 | */ |
26 | -class FamilyBookChartModule extends AbstractModule implements ModuleChartInterface { |
|
26 | +class FamilyBookChartModule extends AbstractModule implements ModuleChartInterface |
|
27 | +{ |
|
27 | 28 | /** |
28 | 29 | * How should this module be labelled on tabs, menus, etc.? |
29 | 30 | * |
30 | 31 | * @return string |
31 | 32 | */ |
32 | - public function getTitle() { |
|
33 | + public function getTitle() |
|
34 | + { |
|
33 | 35 | return /* I18N: Name of a module/chart */ I18N::translate('Family book'); |
34 | 36 | } |
35 | 37 | |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | * |
39 | 41 | * @return string |
40 | 42 | */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “FamilyBookChart” module */ I18N::translate('A chart of an individual’s ancestors and descendants, as a family book.'); |
43 | 46 | } |
44 | 47 | |
@@ -49,7 +52,8 @@ discard block |
||
49 | 52 | * |
50 | 53 | * @return int |
51 | 54 | */ |
52 | - public function defaultAccessLevel() { |
|
55 | + public function defaultAccessLevel() |
|
56 | + { |
|
53 | 57 | return Auth::PRIV_PRIVATE; |
54 | 58 | } |
55 | 59 | |
@@ -58,7 +62,8 @@ discard block |
||
58 | 62 | * |
59 | 63 | * @return Menu|null |
60 | 64 | */ |
61 | - public function getChartMenu(Individual $individual) { |
|
65 | + public function getChartMenu(Individual $individual) |
|
66 | + { |
|
62 | 67 | return new Menu( |
63 | 68 | $this->getTitle(), |
64 | 69 | 'familybook.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), |
@@ -72,7 +77,8 @@ discard block |
||
72 | 77 | * |
73 | 78 | * @return Menu|null |
74 | 79 | */ |
75 | - public function getBoxChartMenu(Individual $individual) { |
|
80 | + public function getBoxChartMenu(Individual $individual) |
|
81 | + { |
|
76 | 82 | return $this->getChartMenu($individual); |
77 | 83 | } |
78 | 84 | } |
@@ -32,148 +32,148 @@ discard block |
||
32 | 32 | * Class ReviewChangesModule |
33 | 33 | */ |
34 | 34 | class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface { |
35 | - /** {@inheritdoc} */ |
|
36 | - public function getTitle() { |
|
37 | - return /* I18N: Name of a module */ I18N::translate('Pending changes'); |
|
38 | - } |
|
39 | - |
|
40 | - /** {@inheritdoc} */ |
|
41 | - public function getDescription() { |
|
42 | - return /* I18N: Description of the “Pending changes” module */ I18N::translate('A list of changes that need to be reviewed by a moderator, and email notifications.'); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * Generate the HTML content of this block. |
|
47 | - * |
|
48 | - * @param int $block_id |
|
49 | - * @param bool $template |
|
50 | - * @param string[] $cfg |
|
51 | - * |
|
52 | - * @return string |
|
53 | - */ |
|
54 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
55 | - global $ctype, $WT_TREE; |
|
56 | - |
|
57 | - $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1'); |
|
58 | - $days = $this->getBlockSetting($block_id, 'days', '1'); |
|
59 | - $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
60 | - |
|
61 | - foreach (array('days', 'sendmail', 'block') as $name) { |
|
62 | - if (array_key_exists($name, $cfg)) { |
|
63 | - $$name = $cfg[$name]; |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - $changes = Database::prepare( |
|
68 | - "SELECT 1" . |
|
69 | - " FROM `##change`" . |
|
70 | - " WHERE status='pending'" . |
|
71 | - " LIMIT 1" |
|
72 | - )->fetchOne(); |
|
73 | - |
|
74 | - if ($changes === '1' && $sendmail === '1') { |
|
75 | - // There are pending changes - tell moderators/managers/administrators about them. |
|
76 | - if (WT_TIMESTAMP - Site::getPreference('LAST_CHANGE_EMAIL') > (60 * 60 * 24 * $days)) { |
|
77 | - // Which users have pending changes? |
|
78 | - foreach (User::all() as $user) { |
|
79 | - if ($user->getPreference('contactmethod') !== 'none') { |
|
80 | - foreach (Tree::getAll() as $tree) { |
|
81 | - if ($tree->hasPendingEdit() && Auth::isManager($tree, $user)) { |
|
82 | - I18N::init($user->getPreference('language')); |
|
83 | - Mail::systemMessage( |
|
84 | - $tree, |
|
85 | - $user, |
|
86 | - I18N::translate('Pending changes'), |
|
87 | - I18N::translate('There are pending changes for you to moderate.') . |
|
88 | - Mail::EOL . Mail::EOL . |
|
89 | - '<a href="' . WT_BASE_URL . 'index.php?ged=' . $WT_TREE->getNameUrl() . '">' . WT_BASE_URL . 'index.php?ged=' . $WT_TREE->getNameUrl() . '</a>' |
|
90 | - ); |
|
91 | - I18N::init(WT_LOCALE); |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - } |
|
96 | - Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP); |
|
97 | - } |
|
98 | - } |
|
99 | - if (Auth::isEditor($WT_TREE) && $WT_TREE->hasPendingEdit()) { |
|
100 | - $id = $this->getName() . $block_id; |
|
101 | - $class = $this->getName() . '_block'; |
|
102 | - if ($ctype === 'user' || Auth::isManager($WT_TREE)) { |
|
103 | - $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; |
|
104 | - } else { |
|
105 | - $title = ''; |
|
106 | - } |
|
107 | - $title .= $this->getTitle(); |
|
108 | - |
|
109 | - $content = ''; |
|
110 | - if (Auth::isModerator($WT_TREE)) { |
|
111 | - $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . I18N::translate('There are pending changes for you to moderate.') . "</a><br>"; |
|
112 | - } |
|
113 | - if ($sendmail === '1') { |
|
114 | - $content .= I18N::translate('Last email reminder was sent ') . FunctionsDate::formatTimestamp(Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>"; |
|
115 | - $content .= I18N::translate('Next email reminder will be sent after ') . FunctionsDate::formatTimestamp(Site::getPreference('LAST_CHANGE_EMAIL') + (60 * 60 * 24 * $days)) . "<br><br>"; |
|
116 | - } |
|
117 | - $content .= '<ul>'; |
|
118 | - $changes = Database::prepare( |
|
119 | - "SELECT xref" . |
|
120 | - " FROM `##change`" . |
|
121 | - " WHERE status='pending'" . |
|
122 | - " AND gedcom_id=?" . |
|
123 | - " GROUP BY xref" |
|
124 | - )->execute(array($WT_TREE->getTreeId()))->fetchAll(); |
|
125 | - foreach ($changes as $change) { |
|
126 | - $record = GedcomRecord::getInstance($change->xref, $WT_TREE); |
|
127 | - if ($record->canShow()) { |
|
128 | - $content .= '<li><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></li>'; |
|
129 | - } |
|
130 | - } |
|
131 | - $content .= '</ul>'; |
|
132 | - |
|
133 | - if ($template) { |
|
134 | - if ($block) { |
|
135 | - $class .= ' small_inner_block'; |
|
136 | - } |
|
137 | - |
|
138 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
139 | - } else { |
|
140 | - return $content; |
|
141 | - } |
|
142 | - } |
|
143 | - } |
|
144 | - |
|
145 | - /** {@inheritdoc} */ |
|
146 | - public function loadAjax() { |
|
147 | - return false; |
|
148 | - } |
|
149 | - |
|
150 | - /** {@inheritdoc} */ |
|
151 | - public function isUserBlock() { |
|
152 | - return true; |
|
153 | - } |
|
154 | - |
|
155 | - /** {@inheritdoc} */ |
|
156 | - public function isGedcomBlock() { |
|
157 | - return true; |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * An HTML form to edit block settings |
|
162 | - * |
|
163 | - * @param int $block_id |
|
164 | - */ |
|
165 | - public function configureBlock($block_id) { |
|
166 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
167 | - $this->setBlockSetting($block_id, 'days', Filter::postInteger('num', 1, 180, 1)); |
|
168 | - $this->setBlockSetting($block_id, 'sendmail', Filter::postBool('sendmail')); |
|
169 | - $this->setBlockSetting($block_id, 'block', Filter::postBool('block')); |
|
170 | - } |
|
171 | - |
|
172 | - $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1'); |
|
173 | - $days = $this->getBlockSetting($block_id, 'days', '1'); |
|
174 | - $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
175 | - |
|
176 | - ?> |
|
35 | + /** {@inheritdoc} */ |
|
36 | + public function getTitle() { |
|
37 | + return /* I18N: Name of a module */ I18N::translate('Pending changes'); |
|
38 | + } |
|
39 | + |
|
40 | + /** {@inheritdoc} */ |
|
41 | + public function getDescription() { |
|
42 | + return /* I18N: Description of the “Pending changes” module */ I18N::translate('A list of changes that need to be reviewed by a moderator, and email notifications.'); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * Generate the HTML content of this block. |
|
47 | + * |
|
48 | + * @param int $block_id |
|
49 | + * @param bool $template |
|
50 | + * @param string[] $cfg |
|
51 | + * |
|
52 | + * @return string |
|
53 | + */ |
|
54 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
55 | + global $ctype, $WT_TREE; |
|
56 | + |
|
57 | + $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1'); |
|
58 | + $days = $this->getBlockSetting($block_id, 'days', '1'); |
|
59 | + $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
60 | + |
|
61 | + foreach (array('days', 'sendmail', 'block') as $name) { |
|
62 | + if (array_key_exists($name, $cfg)) { |
|
63 | + $$name = $cfg[$name]; |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + $changes = Database::prepare( |
|
68 | + "SELECT 1" . |
|
69 | + " FROM `##change`" . |
|
70 | + " WHERE status='pending'" . |
|
71 | + " LIMIT 1" |
|
72 | + )->fetchOne(); |
|
73 | + |
|
74 | + if ($changes === '1' && $sendmail === '1') { |
|
75 | + // There are pending changes - tell moderators/managers/administrators about them. |
|
76 | + if (WT_TIMESTAMP - Site::getPreference('LAST_CHANGE_EMAIL') > (60 * 60 * 24 * $days)) { |
|
77 | + // Which users have pending changes? |
|
78 | + foreach (User::all() as $user) { |
|
79 | + if ($user->getPreference('contactmethod') !== 'none') { |
|
80 | + foreach (Tree::getAll() as $tree) { |
|
81 | + if ($tree->hasPendingEdit() && Auth::isManager($tree, $user)) { |
|
82 | + I18N::init($user->getPreference('language')); |
|
83 | + Mail::systemMessage( |
|
84 | + $tree, |
|
85 | + $user, |
|
86 | + I18N::translate('Pending changes'), |
|
87 | + I18N::translate('There are pending changes for you to moderate.') . |
|
88 | + Mail::EOL . Mail::EOL . |
|
89 | + '<a href="' . WT_BASE_URL . 'index.php?ged=' . $WT_TREE->getNameUrl() . '">' . WT_BASE_URL . 'index.php?ged=' . $WT_TREE->getNameUrl() . '</a>' |
|
90 | + ); |
|
91 | + I18N::init(WT_LOCALE); |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + } |
|
96 | + Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP); |
|
97 | + } |
|
98 | + } |
|
99 | + if (Auth::isEditor($WT_TREE) && $WT_TREE->hasPendingEdit()) { |
|
100 | + $id = $this->getName() . $block_id; |
|
101 | + $class = $this->getName() . '_block'; |
|
102 | + if ($ctype === 'user' || Auth::isManager($WT_TREE)) { |
|
103 | + $title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>'; |
|
104 | + } else { |
|
105 | + $title = ''; |
|
106 | + } |
|
107 | + $title .= $this->getTitle(); |
|
108 | + |
|
109 | + $content = ''; |
|
110 | + if (Auth::isModerator($WT_TREE)) { |
|
111 | + $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . I18N::translate('There are pending changes for you to moderate.') . "</a><br>"; |
|
112 | + } |
|
113 | + if ($sendmail === '1') { |
|
114 | + $content .= I18N::translate('Last email reminder was sent ') . FunctionsDate::formatTimestamp(Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>"; |
|
115 | + $content .= I18N::translate('Next email reminder will be sent after ') . FunctionsDate::formatTimestamp(Site::getPreference('LAST_CHANGE_EMAIL') + (60 * 60 * 24 * $days)) . "<br><br>"; |
|
116 | + } |
|
117 | + $content .= '<ul>'; |
|
118 | + $changes = Database::prepare( |
|
119 | + "SELECT xref" . |
|
120 | + " FROM `##change`" . |
|
121 | + " WHERE status='pending'" . |
|
122 | + " AND gedcom_id=?" . |
|
123 | + " GROUP BY xref" |
|
124 | + )->execute(array($WT_TREE->getTreeId()))->fetchAll(); |
|
125 | + foreach ($changes as $change) { |
|
126 | + $record = GedcomRecord::getInstance($change->xref, $WT_TREE); |
|
127 | + if ($record->canShow()) { |
|
128 | + $content .= '<li><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></li>'; |
|
129 | + } |
|
130 | + } |
|
131 | + $content .= '</ul>'; |
|
132 | + |
|
133 | + if ($template) { |
|
134 | + if ($block) { |
|
135 | + $class .= ' small_inner_block'; |
|
136 | + } |
|
137 | + |
|
138 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
139 | + } else { |
|
140 | + return $content; |
|
141 | + } |
|
142 | + } |
|
143 | + } |
|
144 | + |
|
145 | + /** {@inheritdoc} */ |
|
146 | + public function loadAjax() { |
|
147 | + return false; |
|
148 | + } |
|
149 | + |
|
150 | + /** {@inheritdoc} */ |
|
151 | + public function isUserBlock() { |
|
152 | + return true; |
|
153 | + } |
|
154 | + |
|
155 | + /** {@inheritdoc} */ |
|
156 | + public function isGedcomBlock() { |
|
157 | + return true; |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * An HTML form to edit block settings |
|
162 | + * |
|
163 | + * @param int $block_id |
|
164 | + */ |
|
165 | + public function configureBlock($block_id) { |
|
166 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
167 | + $this->setBlockSetting($block_id, 'days', Filter::postInteger('num', 1, 180, 1)); |
|
168 | + $this->setBlockSetting($block_id, 'sendmail', Filter::postBool('sendmail')); |
|
169 | + $this->setBlockSetting($block_id, 'block', Filter::postBool('block')); |
|
170 | + } |
|
171 | + |
|
172 | + $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1'); |
|
173 | + $days = $this->getBlockSetting($block_id, 'days', '1'); |
|
174 | + $block = $this->getBlockSetting($block_id, 'block', '1'); |
|
175 | + |
|
176 | + ?> |
|
177 | 177 | <tr> |
178 | 178 | <td colspan="2"> |
179 | 179 | <?php echo I18N::translate('This block will show editors a list of records with pending changes that need to be reviewed by a moderator. It also generates daily emails to moderators whenever pending changes exist.'); ?> |
@@ -181,18 +181,18 @@ discard block |
||
181 | 181 | </tr> |
182 | 182 | |
183 | 183 | <?php |
184 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
185 | - echo /* I18N: Label for a configuration option */ I18N::translate('Send out reminder emails'); |
|
186 | - echo '</td><td class="optionbox">'; |
|
187 | - echo FunctionsEdit::editFieldYesNo('sendmail', $sendmail); |
|
188 | - echo '<br>'; |
|
189 | - echo I18N::translate('Reminder email frequency (days)') . " <input type='text' name='days' value='" . $days . "' size='2'>"; |
|
190 | - echo '</td></tr>'; |
|
191 | - |
|
192 | - echo '<tr><td class="descriptionbox wrap width33">'; |
|
193 | - echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow'); |
|
194 | - echo '</td><td class="optionbox">'; |
|
195 | - echo FunctionsEdit::editFieldYesNo('block', $block); |
|
196 | - echo '</td></tr>'; |
|
197 | - } |
|
184 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
185 | + echo /* I18N: Label for a configuration option */ I18N::translate('Send out reminder emails'); |
|
186 | + echo '</td><td class="optionbox">'; |
|
187 | + echo FunctionsEdit::editFieldYesNo('sendmail', $sendmail); |
|
188 | + echo '<br>'; |
|
189 | + echo I18N::translate('Reminder email frequency (days)') . " <input type='text' name='days' value='" . $days . "' size='2'>"; |
|
190 | + echo '</td></tr>'; |
|
191 | + |
|
192 | + echo '<tr><td class="descriptionbox wrap width33">'; |
|
193 | + echo /* I18N: label for a yes/no option */ I18N::translate('Add a scrollbar when block contents grow'); |
|
194 | + echo '</td><td class="optionbox">'; |
|
195 | + echo FunctionsEdit::editFieldYesNo('block', $block); |
|
196 | + echo '</td></tr>'; |
|
197 | + } |
|
198 | 198 | } |
@@ -31,14 +31,17 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * Class ReviewChangesModule |
33 | 33 | */ |
34 | -class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface { |
|
34 | +class ReviewChangesModule extends AbstractModule implements ModuleBlockInterface |
|
35 | +{ |
|
35 | 36 | /** {@inheritdoc} */ |
36 | - public function getTitle() { |
|
37 | + public function getTitle() |
|
38 | + { |
|
37 | 39 | return /* I18N: Name of a module */ I18N::translate('Pending changes'); |
38 | 40 | } |
39 | 41 | |
40 | 42 | /** {@inheritdoc} */ |
41 | - public function getDescription() { |
|
43 | + public function getDescription() |
|
44 | + { |
|
42 | 45 | return /* I18N: Description of the “Pending changes” module */ I18N::translate('A list of changes that need to be reviewed by a moderator, and email notifications.'); |
43 | 46 | } |
44 | 47 | |
@@ -51,7 +54,8 @@ discard block |
||
51 | 54 | * |
52 | 55 | * @return string |
53 | 56 | */ |
54 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
57 | + public function getBlock($block_id, $template = true, $cfg = array()) |
|
58 | + { |
|
55 | 59 | global $ctype, $WT_TREE; |
56 | 60 | |
57 | 61 | $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1'); |
@@ -143,17 +147,20 @@ discard block |
||
143 | 147 | } |
144 | 148 | |
145 | 149 | /** {@inheritdoc} */ |
146 | - public function loadAjax() { |
|
150 | + public function loadAjax() |
|
151 | + { |
|
147 | 152 | return false; |
148 | 153 | } |
149 | 154 | |
150 | 155 | /** {@inheritdoc} */ |
151 | - public function isUserBlock() { |
|
156 | + public function isUserBlock() |
|
157 | + { |
|
152 | 158 | return true; |
153 | 159 | } |
154 | 160 | |
155 | 161 | /** {@inheritdoc} */ |
156 | - public function isGedcomBlock() { |
|
162 | + public function isGedcomBlock() |
|
163 | + { |
|
157 | 164 | return true; |
158 | 165 | } |
159 | 166 | |
@@ -162,7 +169,8 @@ discard block |
||
162 | 169 | * |
163 | 170 | * @param int $block_id |
164 | 171 | */ |
165 | - public function configureBlock($block_id) { |
|
172 | + public function configureBlock($block_id) |
|
173 | + { |
|
166 | 174 | if (Filter::postBool('save') && Filter::checkCsrf()) { |
167 | 175 | $this->setBlockSetting($block_id, 'days', Filter::postInteger('num', 1, 180, 1)); |
168 | 176 | $this->setBlockSetting($block_id, 'sendmail', Filter::postBool('sendmail')); |
@@ -23,42 +23,42 @@ |
||
23 | 23 | * Class MissingFactsReportModule |
24 | 24 | */ |
25 | 25 | class MissingFactsReportModule extends AbstractModule implements ModuleReportInterface { |
26 | - /** {@inheritdoc} */ |
|
27 | - public function getTitle() { |
|
28 | - // This text also appears in the .XML file - update both together |
|
29 | - return /* I18N: Name of a module/report */ I18N::translate('Missing data'); |
|
30 | - } |
|
26 | + /** {@inheritdoc} */ |
|
27 | + public function getTitle() { |
|
28 | + // This text also appears in the .XML file - update both together |
|
29 | + return /* I18N: Name of a module/report */ I18N::translate('Missing data'); |
|
30 | + } |
|
31 | 31 | |
32 | - /** {@inheritdoc} */ |
|
33 | - public function getDescription() { |
|
34 | - // This text also appears in the .XML file - update both together |
|
35 | - return /* I18N: Description of the “Missing data” */ I18N::translate('A report of the information that is missing for an individual and their relatives.'); |
|
36 | - } |
|
32 | + /** {@inheritdoc} */ |
|
33 | + public function getDescription() { |
|
34 | + // This text also appears in the .XML file - update both together |
|
35 | + return /* I18N: Description of the “Missing data” */ I18N::translate('A report of the information that is missing for an individual and their relatives.'); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * What is the default access level for this module? |
|
40 | - * |
|
41 | - * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
42 | - * |
|
43 | - * @return int |
|
44 | - */ |
|
45 | - public function defaultAccessLevel() { |
|
46 | - return Auth::PRIV_USER; |
|
47 | - } |
|
38 | + /** |
|
39 | + * What is the default access level for this module? |
|
40 | + * |
|
41 | + * Some modules are aimed at admins or managers, and are not generally shown to users. |
|
42 | + * |
|
43 | + * @return int |
|
44 | + */ |
|
45 | + public function defaultAccessLevel() { |
|
46 | + return Auth::PRIV_USER; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Return a menu item for this report. |
|
51 | - * |
|
52 | - * @return Menu |
|
53 | - */ |
|
54 | - public function getReportMenu() { |
|
55 | - global $WT_TREE; |
|
49 | + /** |
|
50 | + * Return a menu item for this report. |
|
51 | + * |
|
52 | + * @return Menu |
|
53 | + */ |
|
54 | + public function getReportMenu() { |
|
55 | + global $WT_TREE; |
|
56 | 56 | |
57 | - return new Menu( |
|
58 | - $this->getTitle(), |
|
59 | - 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', |
|
60 | - 'menu-report-' . $this->getName(), |
|
61 | - array('rel' => 'nofollow') |
|
62 | - ); |
|
63 | - } |
|
57 | + return new Menu( |
|
58 | + $this->getTitle(), |
|
59 | + 'reportengine.php?ged=' . $WT_TREE->getNameUrl() . '&action=setup&report=' . WT_MODULES_DIR . $this->getName() . '/report.xml', |
|
60 | + 'menu-report-' . $this->getName(), |
|
61 | + array('rel' => 'nofollow') |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | } |
@@ -22,15 +22,18 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class MissingFactsReportModule |
24 | 24 | */ |
25 | -class MissingFactsReportModule extends AbstractModule implements ModuleReportInterface { |
|
25 | +class MissingFactsReportModule extends AbstractModule implements ModuleReportInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | // This text also appears in the .XML file - update both together |
29 | 31 | return /* I18N: Name of a module/report */ I18N::translate('Missing data'); |
30 | 32 | } |
31 | 33 | |
32 | 34 | /** {@inheritdoc} */ |
33 | - public function getDescription() { |
|
35 | + public function getDescription() |
|
36 | + { |
|
34 | 37 | // This text also appears in the .XML file - update both together |
35 | 38 | return /* I18N: Description of the “Missing data” */ I18N::translate('A report of the information that is missing for an individual and their relatives.'); |
36 | 39 | } |
@@ -42,7 +45,8 @@ discard block |
||
42 | 45 | * |
43 | 46 | * @return int |
44 | 47 | */ |
45 | - public function defaultAccessLevel() { |
|
48 | + public function defaultAccessLevel() |
|
49 | + { |
|
46 | 50 | return Auth::PRIV_USER; |
47 | 51 | } |
48 | 52 | |
@@ -51,7 +55,8 @@ discard block |
||
51 | 55 | * |
52 | 56 | * @return Menu |
53 | 57 | */ |
54 | - public function getReportMenu() { |
|
58 | + public function getReportMenu() |
|
59 | + { |
|
55 | 60 | global $WT_TREE; |
56 | 61 | |
57 | 62 | return new Menu( |
@@ -24,33 +24,33 @@ discard block |
||
24 | 24 | * Class TreeView |
25 | 25 | */ |
26 | 26 | class TreeView { |
27 | - /** @var string HTML element name */ |
|
28 | - private $name; |
|
27 | + /** @var string HTML element name */ |
|
28 | + private $name; |
|
29 | 29 | |
30 | - /** @var string Show all partners */ |
|
31 | - private $all_partners; |
|
30 | + /** @var string Show all partners */ |
|
31 | + private $all_partners; |
|
32 | 32 | |
33 | - /** |
|
34 | - * Treeview Constructor |
|
35 | - * |
|
36 | - * @param string $name the name of the TreeView object’s instance |
|
37 | - */ |
|
38 | - public function __construct($name = 'tree') { |
|
39 | - $this->name = $name; |
|
40 | - $this->all_partners = Filter::cookie('allPartners', 'true|false', 'true'); |
|
41 | - } |
|
33 | + /** |
|
34 | + * Treeview Constructor |
|
35 | + * |
|
36 | + * @param string $name the name of the TreeView object’s instance |
|
37 | + */ |
|
38 | + public function __construct($name = 'tree') { |
|
39 | + $this->name = $name; |
|
40 | + $this->all_partners = Filter::cookie('allPartners', 'true|false', 'true'); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * Draw the viewport which creates the draggable/zoomable framework |
|
45 | - * Size is set by the container, as the viewport can scale itself automatically |
|
46 | - * |
|
47 | - * @param Individual $root_person the id of the root person |
|
48 | - * @param int $generations number of generations to draw |
|
49 | - * |
|
50 | - * @return string[] HTML and Javascript |
|
51 | - */ |
|
52 | - public function drawViewport(Individual $root_person, $generations) { |
|
53 | - $html = ' |
|
43 | + /** |
|
44 | + * Draw the viewport which creates the draggable/zoomable framework |
|
45 | + * Size is set by the container, as the viewport can scale itself automatically |
|
46 | + * |
|
47 | + * @param Individual $root_person the id of the root person |
|
48 | + * @param int $generations number of generations to draw |
|
49 | + * |
|
50 | + * @return string[] HTML and Javascript |
|
51 | + */ |
|
52 | + public function drawViewport(Individual $root_person, $generations) { |
|
53 | + $html = ' |
|
54 | 54 | <a name="tv_content"></a> |
55 | 55 | <div id="' . $this->name . '_out" class="tv_out"> |
56 | 56 | <div id="tv_tools" class="noprint"> |
@@ -73,327 +73,327 @@ discard block |
||
73 | 73 | </div> |
74 | 74 | '; |
75 | 75 | |
76 | - return array($html, 'var ' . $this->name . 'Handler = new TreeViewHandler("' . $this->name . '");'); |
|
77 | - } |
|
76 | + return array($html, 'var ' . $this->name . 'Handler = new TreeViewHandler("' . $this->name . '");'); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Return a JSON structure to a JSON request |
|
81 | - * |
|
82 | - * @param string $list list of JSON requests |
|
83 | - * |
|
84 | - * @return string |
|
85 | - */ |
|
86 | - public function getPersons($list) { |
|
87 | - global $WT_TREE; |
|
79 | + /** |
|
80 | + * Return a JSON structure to a JSON request |
|
81 | + * |
|
82 | + * @param string $list list of JSON requests |
|
83 | + * |
|
84 | + * @return string |
|
85 | + */ |
|
86 | + public function getPersons($list) { |
|
87 | + global $WT_TREE; |
|
88 | 88 | |
89 | - $list = explode(';', $list); |
|
90 | - $r = array(); |
|
91 | - foreach ($list as $jsonRequest) { |
|
92 | - $firstLetter = substr($jsonRequest, 0, 1); |
|
93 | - $jsonRequest = substr($jsonRequest, 1); |
|
94 | - switch ($firstLetter) { |
|
95 | - case 'c': |
|
96 | - $fidlist = explode(',', $jsonRequest); |
|
97 | - $flist = array(); |
|
98 | - foreach ($fidlist as $fid) { |
|
99 | - $flist[] = Family::getInstance($fid, $WT_TREE); |
|
100 | - } |
|
101 | - $r[] = $this->drawChildren($flist, 1, true); |
|
102 | - break; |
|
103 | - case 'p': |
|
104 | - $params = explode('@', $jsonRequest); |
|
105 | - $fid = $params[0]; |
|
106 | - $order = $params[1]; |
|
107 | - $f = Family::getInstance($fid, $WT_TREE); |
|
108 | - if ($f->getHusband()) { |
|
109 | - $r[] = $this->drawPerson($f->getHusband(), 0, 1, $f, $order); |
|
110 | - } elseif ($f->getWife()) { |
|
111 | - $r[] = $this->drawPerson($f->getWife(), 0, 1, $f, $order); |
|
112 | - } |
|
113 | - break; |
|
114 | - } |
|
115 | - } |
|
89 | + $list = explode(';', $list); |
|
90 | + $r = array(); |
|
91 | + foreach ($list as $jsonRequest) { |
|
92 | + $firstLetter = substr($jsonRequest, 0, 1); |
|
93 | + $jsonRequest = substr($jsonRequest, 1); |
|
94 | + switch ($firstLetter) { |
|
95 | + case 'c': |
|
96 | + $fidlist = explode(',', $jsonRequest); |
|
97 | + $flist = array(); |
|
98 | + foreach ($fidlist as $fid) { |
|
99 | + $flist[] = Family::getInstance($fid, $WT_TREE); |
|
100 | + } |
|
101 | + $r[] = $this->drawChildren($flist, 1, true); |
|
102 | + break; |
|
103 | + case 'p': |
|
104 | + $params = explode('@', $jsonRequest); |
|
105 | + $fid = $params[0]; |
|
106 | + $order = $params[1]; |
|
107 | + $f = Family::getInstance($fid, $WT_TREE); |
|
108 | + if ($f->getHusband()) { |
|
109 | + $r[] = $this->drawPerson($f->getHusband(), 0, 1, $f, $order); |
|
110 | + } elseif ($f->getWife()) { |
|
111 | + $r[] = $this->drawPerson($f->getWife(), 0, 1, $f, $order); |
|
112 | + } |
|
113 | + break; |
|
114 | + } |
|
115 | + } |
|
116 | 116 | |
117 | - return json_encode($r); |
|
118 | - } |
|
117 | + return json_encode($r); |
|
118 | + } |
|
119 | 119 | |
120 | - /** |
|
121 | - * Get the details for a person and their life partner(s) |
|
122 | - * |
|
123 | - * @param Individual $individual the individual to return the details for |
|
124 | - * |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - public function getDetails(Individual $individual) { |
|
128 | - $html = $this->getPersonDetails($individual, null); |
|
129 | - foreach ($individual->getSpouseFamilies() as $family) { |
|
130 | - $spouse = $family->getSpouse($individual); |
|
131 | - if ($spouse) { |
|
132 | - $html .= $this->getPersonDetails($spouse, $family); |
|
133 | - } |
|
134 | - } |
|
120 | + /** |
|
121 | + * Get the details for a person and their life partner(s) |
|
122 | + * |
|
123 | + * @param Individual $individual the individual to return the details for |
|
124 | + * |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + public function getDetails(Individual $individual) { |
|
128 | + $html = $this->getPersonDetails($individual, null); |
|
129 | + foreach ($individual->getSpouseFamilies() as $family) { |
|
130 | + $spouse = $family->getSpouse($individual); |
|
131 | + if ($spouse) { |
|
132 | + $html .= $this->getPersonDetails($spouse, $family); |
|
133 | + } |
|
134 | + } |
|
135 | 135 | |
136 | - return $html; |
|
137 | - } |
|
136 | + return $html; |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Return the details for a person |
|
141 | - * |
|
142 | - * @param Individual $individual |
|
143 | - * @param Family $family |
|
144 | - * |
|
145 | - * @return string |
|
146 | - */ |
|
147 | - private function getPersonDetails(Individual $individual, Family $family = null) { |
|
148 | - $hmtl = $this->getThumbnail($individual); |
|
149 | - $hmtl .= '<a class="tv_link" href="' . $individual->getHtmlUrl() . '">' . $individual->getFullName() . '</a> <a href="module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '" title="' . I18N::translate('Interactive tree of %s', strip_tags($individual->getFullName())) . '" class="icon-button_indi tv_link tv_treelink"></a>'; |
|
150 | - foreach ($individual->getFacts(WT_EVENTS_BIRT, true) as $fact) { |
|
151 | - $hmtl .= $fact->summary(); |
|
152 | - } |
|
153 | - if ($family) { |
|
154 | - foreach ($family->getFacts(WT_EVENTS_MARR, true) as $fact) { |
|
155 | - $hmtl .= $fact->summary(); |
|
156 | - } |
|
157 | - } |
|
158 | - foreach ($individual->getFacts(WT_EVENTS_DEAT, true) as $fact) { |
|
159 | - $hmtl .= $fact->summary(); |
|
160 | - } |
|
139 | + /** |
|
140 | + * Return the details for a person |
|
141 | + * |
|
142 | + * @param Individual $individual |
|
143 | + * @param Family $family |
|
144 | + * |
|
145 | + * @return string |
|
146 | + */ |
|
147 | + private function getPersonDetails(Individual $individual, Family $family = null) { |
|
148 | + $hmtl = $this->getThumbnail($individual); |
|
149 | + $hmtl .= '<a class="tv_link" href="' . $individual->getHtmlUrl() . '">' . $individual->getFullName() . '</a> <a href="module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '" title="' . I18N::translate('Interactive tree of %s', strip_tags($individual->getFullName())) . '" class="icon-button_indi tv_link tv_treelink"></a>'; |
|
150 | + foreach ($individual->getFacts(WT_EVENTS_BIRT, true) as $fact) { |
|
151 | + $hmtl .= $fact->summary(); |
|
152 | + } |
|
153 | + if ($family) { |
|
154 | + foreach ($family->getFacts(WT_EVENTS_MARR, true) as $fact) { |
|
155 | + $hmtl .= $fact->summary(); |
|
156 | + } |
|
157 | + } |
|
158 | + foreach ($individual->getFacts(WT_EVENTS_DEAT, true) as $fact) { |
|
159 | + $hmtl .= $fact->summary(); |
|
160 | + } |
|
161 | 161 | |
162 | - return '<div class="tv' . $individual->getSex() . ' tv_person_expanded">' . $hmtl . '</div>'; |
|
163 | - } |
|
162 | + return '<div class="tv' . $individual->getSex() . ' tv_person_expanded">' . $hmtl . '</div>'; |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * Draw the children for some families |
|
167 | - * |
|
168 | - * @param Family[] $familyList array of families to draw the children for |
|
169 | - * @param int $gen number of generations to draw |
|
170 | - * @param bool $ajax setted to true for an ajax call |
|
171 | - * |
|
172 | - * @return string |
|
173 | - */ |
|
174 | - private function drawChildren(array $familyList, $gen = 1, $ajax = false) { |
|
175 | - $html = ''; |
|
176 | - $children2draw = array(); |
|
177 | - $f2load = array(); |
|
165 | + /** |
|
166 | + * Draw the children for some families |
|
167 | + * |
|
168 | + * @param Family[] $familyList array of families to draw the children for |
|
169 | + * @param int $gen number of generations to draw |
|
170 | + * @param bool $ajax setted to true for an ajax call |
|
171 | + * |
|
172 | + * @return string |
|
173 | + */ |
|
174 | + private function drawChildren(array $familyList, $gen = 1, $ajax = false) { |
|
175 | + $html = ''; |
|
176 | + $children2draw = array(); |
|
177 | + $f2load = array(); |
|
178 | 178 | |
179 | - foreach ($familyList as $f) { |
|
180 | - if (empty($f)) { |
|
181 | - continue; |
|
182 | - } |
|
183 | - $children = $f->getChildren(); |
|
184 | - if ($children) { |
|
185 | - $f2load[] = $f->getXref(); |
|
186 | - foreach ($children as $child) { |
|
187 | - // Eliminate duplicates - e.g. when adopted by a step-parent |
|
188 | - $children2draw[$child->getXref()] = $child; |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
192 | - $tc = count($children2draw); |
|
193 | - if ($tc) { |
|
194 | - $f2load = implode(',', $f2load); |
|
195 | - $nbc = 0; |
|
196 | - foreach ($children2draw as $child) { |
|
197 | - $nbc++; |
|
198 | - if ($tc == 1) { |
|
199 | - $co = 'c'; // unique |
|
200 | - } elseif ($nbc == 1) { |
|
201 | - $co = 't'; // first |
|
202 | - } elseif ($nbc == $tc) { |
|
203 | - $co = 'b'; //last |
|
204 | - } else { |
|
205 | - $co = 'h'; |
|
206 | - } |
|
207 | - $html .= $this->drawPerson($child, $gen - 1, -1, null, $co); |
|
208 | - } |
|
209 | - if (!$ajax) { |
|
210 | - $html = '<td align="right"' . ($gen == 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine(); |
|
211 | - } |
|
212 | - } |
|
179 | + foreach ($familyList as $f) { |
|
180 | + if (empty($f)) { |
|
181 | + continue; |
|
182 | + } |
|
183 | + $children = $f->getChildren(); |
|
184 | + if ($children) { |
|
185 | + $f2load[] = $f->getXref(); |
|
186 | + foreach ($children as $child) { |
|
187 | + // Eliminate duplicates - e.g. when adopted by a step-parent |
|
188 | + $children2draw[$child->getXref()] = $child; |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | + $tc = count($children2draw); |
|
193 | + if ($tc) { |
|
194 | + $f2load = implode(',', $f2load); |
|
195 | + $nbc = 0; |
|
196 | + foreach ($children2draw as $child) { |
|
197 | + $nbc++; |
|
198 | + if ($tc == 1) { |
|
199 | + $co = 'c'; // unique |
|
200 | + } elseif ($nbc == 1) { |
|
201 | + $co = 't'; // first |
|
202 | + } elseif ($nbc == $tc) { |
|
203 | + $co = 'b'; //last |
|
204 | + } else { |
|
205 | + $co = 'h'; |
|
206 | + } |
|
207 | + $html .= $this->drawPerson($child, $gen - 1, -1, null, $co); |
|
208 | + } |
|
209 | + if (!$ajax) { |
|
210 | + $html = '<td align="right"' . ($gen == 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine(); |
|
211 | + } |
|
212 | + } |
|
213 | 213 | |
214 | - return $html; |
|
215 | - } |
|
214 | + return $html; |
|
215 | + } |
|
216 | 216 | |
217 | - /** |
|
218 | - * Draw a person in the tree |
|
219 | - * |
|
220 | - * @param Individual $person The Person object to draw the box for |
|
221 | - * @param int $gen The number of generations up or down to print |
|
222 | - * @param int $state Whether we are going up or down the tree, -1 for descendents +1 for ancestors |
|
223 | - * @param Family $pfamily |
|
224 | - * @param string $order first (1), last(2), unique(0), or empty. Required for drawing lines between boxes |
|
225 | - * @param bool $isRoot |
|
226 | - * |
|
227 | - * @return string |
|
228 | - * |
|
229 | - * Notes : "spouse" means explicitely married partners. Thus, the word "partner" |
|
230 | - * (for "life partner") here fits much better than "spouse" or "mate" |
|
231 | - * to translate properly the modern french meaning of "conjoint" |
|
232 | - */ |
|
233 | - private function drawPerson(Individual $person, $gen, $state, Family $pfamily = null, $order = null, $isRoot = false) { |
|
234 | - if ($gen < 0) { |
|
235 | - return ''; |
|
236 | - } |
|
237 | - if (!empty($pfamily)) { |
|
238 | - $partner = $pfamily->getSpouse($person); |
|
239 | - } else { |
|
240 | - $partner = $person->getCurrentSpouse(); |
|
241 | - } |
|
242 | - if ($isRoot) { |
|
243 | - $html = '<table id="tvTreeBorder" class="tv_tree"><tbody><tr><td id="tv_tree_topleft"></td><td id="tv_tree_top"></td><td id="tv_tree_topright"></td></tr><tr><td id="tv_tree_left"></td><td>'; |
|
244 | - } else { |
|
245 | - $html = ''; |
|
246 | - } |
|
247 | - /* height 1% : this hack enable the div auto-dimensioning in td for FF & Chrome */ |
|
248 | - $html .= '<table class="tv_tree"' . ($isRoot ? ' id="tv_tree"' : '') . ' style="height: 1%"><tbody><tr>'; |
|
217 | + /** |
|
218 | + * Draw a person in the tree |
|
219 | + * |
|
220 | + * @param Individual $person The Person object to draw the box for |
|
221 | + * @param int $gen The number of generations up or down to print |
|
222 | + * @param int $state Whether we are going up or down the tree, -1 for descendents +1 for ancestors |
|
223 | + * @param Family $pfamily |
|
224 | + * @param string $order first (1), last(2), unique(0), or empty. Required for drawing lines between boxes |
|
225 | + * @param bool $isRoot |
|
226 | + * |
|
227 | + * @return string |
|
228 | + * |
|
229 | + * Notes : "spouse" means explicitely married partners. Thus, the word "partner" |
|
230 | + * (for "life partner") here fits much better than "spouse" or "mate" |
|
231 | + * to translate properly the modern french meaning of "conjoint" |
|
232 | + */ |
|
233 | + private function drawPerson(Individual $person, $gen, $state, Family $pfamily = null, $order = null, $isRoot = false) { |
|
234 | + if ($gen < 0) { |
|
235 | + return ''; |
|
236 | + } |
|
237 | + if (!empty($pfamily)) { |
|
238 | + $partner = $pfamily->getSpouse($person); |
|
239 | + } else { |
|
240 | + $partner = $person->getCurrentSpouse(); |
|
241 | + } |
|
242 | + if ($isRoot) { |
|
243 | + $html = '<table id="tvTreeBorder" class="tv_tree"><tbody><tr><td id="tv_tree_topleft"></td><td id="tv_tree_top"></td><td id="tv_tree_topright"></td></tr><tr><td id="tv_tree_left"></td><td>'; |
|
244 | + } else { |
|
245 | + $html = ''; |
|
246 | + } |
|
247 | + /* height 1% : this hack enable the div auto-dimensioning in td for FF & Chrome */ |
|
248 | + $html .= '<table class="tv_tree"' . ($isRoot ? ' id="tv_tree"' : '') . ' style="height: 1%"><tbody><tr>'; |
|
249 | 249 | |
250 | - if ($state <= 0) { |
|
251 | - // draw children |
|
252 | - $html .= $this->drawChildren($person->getSpouseFamilies(), $gen); |
|
253 | - } else { |
|
254 | - // draw the parent’s lines |
|
255 | - $html .= $this->drawVerticalLine($order) . $this->drawHorizontalLine(); |
|
256 | - } |
|
250 | + if ($state <= 0) { |
|
251 | + // draw children |
|
252 | + $html .= $this->drawChildren($person->getSpouseFamilies(), $gen); |
|
253 | + } else { |
|
254 | + // draw the parent’s lines |
|
255 | + $html .= $this->drawVerticalLine($order) . $this->drawHorizontalLine(); |
|
256 | + } |
|
257 | 257 | |
258 | - /* draw the person. Do NOT add person or family id as an id, since a same person could appear more than once in the tree !!! */ |
|
259 | - // Fixing the width for td to the box initial width when the person is the root person fix a rare bug that happen when a person without child and without known parents is the root person : an unwanted white rectangle appear at the right of the person’s boxes, otherwise. |
|
260 | - $html .= '<td' . ($isRoot ? ' style="width:1px"' : '') . '><div class="tv_box' . ($isRoot ? ' rootPerson' : '') . '" dir="' . I18N::direction() . '" style="text-align: ' . (I18N::direction() === 'rtl' ? 'right' : 'left') . '; direction: ' . I18N::direction() . '" abbr="' . $person->getXref() . '" onclick="' . $this->name . 'Handler.expandBox(this, event);">'; |
|
261 | - $html .= $this->drawPersonName($person); |
|
262 | - $fop = array(); // $fop is fathers of partners |
|
263 | - if (!is_null($partner)) { |
|
264 | - $dashed = ''; |
|
265 | - foreach ($person->getSpouseFamilies() as $family) { |
|
266 | - $spouse = $family->getSpouse($person); |
|
267 | - if ($spouse) { |
|
268 | - if ($spouse === $partner || $this->all_partners === 'true') { |
|
269 | - $spouse_parents = $spouse->getPrimaryChildFamily(); |
|
270 | - if ($spouse_parents && $spouse_parents->getHusband()) { |
|
271 | - $fop[] = array($spouse_parents->getHusband(), $spouse_parents); |
|
272 | - } elseif ($spouse_parents && $spouse_parents->getWife()) { |
|
273 | - $fop[] = array($spouse_parents->getWife(), $spouse_parents); |
|
274 | - } |
|
275 | - $html .= $this->drawPersonName($spouse, $dashed); |
|
276 | - if ($this->all_partners !== 'true') { |
|
277 | - break; // we can stop here the foreach loop |
|
278 | - } |
|
279 | - $dashed = 'dashed'; |
|
280 | - } |
|
281 | - } |
|
282 | - } |
|
283 | - } |
|
284 | - $html .= '</div></td>'; |
|
258 | + /* draw the person. Do NOT add person or family id as an id, since a same person could appear more than once in the tree !!! */ |
|
259 | + // Fixing the width for td to the box initial width when the person is the root person fix a rare bug that happen when a person without child and without known parents is the root person : an unwanted white rectangle appear at the right of the person’s boxes, otherwise. |
|
260 | + $html .= '<td' . ($isRoot ? ' style="width:1px"' : '') . '><div class="tv_box' . ($isRoot ? ' rootPerson' : '') . '" dir="' . I18N::direction() . '" style="text-align: ' . (I18N::direction() === 'rtl' ? 'right' : 'left') . '; direction: ' . I18N::direction() . '" abbr="' . $person->getXref() . '" onclick="' . $this->name . 'Handler.expandBox(this, event);">'; |
|
261 | + $html .= $this->drawPersonName($person); |
|
262 | + $fop = array(); // $fop is fathers of partners |
|
263 | + if (!is_null($partner)) { |
|
264 | + $dashed = ''; |
|
265 | + foreach ($person->getSpouseFamilies() as $family) { |
|
266 | + $spouse = $family->getSpouse($person); |
|
267 | + if ($spouse) { |
|
268 | + if ($spouse === $partner || $this->all_partners === 'true') { |
|
269 | + $spouse_parents = $spouse->getPrimaryChildFamily(); |
|
270 | + if ($spouse_parents && $spouse_parents->getHusband()) { |
|
271 | + $fop[] = array($spouse_parents->getHusband(), $spouse_parents); |
|
272 | + } elseif ($spouse_parents && $spouse_parents->getWife()) { |
|
273 | + $fop[] = array($spouse_parents->getWife(), $spouse_parents); |
|
274 | + } |
|
275 | + $html .= $this->drawPersonName($spouse, $dashed); |
|
276 | + if ($this->all_partners !== 'true') { |
|
277 | + break; // we can stop here the foreach loop |
|
278 | + } |
|
279 | + $dashed = 'dashed'; |
|
280 | + } |
|
281 | + } |
|
282 | + } |
|
283 | + } |
|
284 | + $html .= '</div></td>'; |
|
285 | 285 | |
286 | - $primaryChildFamily = $person->getPrimaryChildFamily(); |
|
287 | - if (!empty($primaryChildFamily)) { |
|
288 | - $parent = $primaryChildFamily->getHusband(); |
|
289 | - if (empty($parent)) { |
|
290 | - $parent = $primaryChildFamily->getWife(); |
|
291 | - } |
|
292 | - } |
|
293 | - if (!empty($parent) || count($fop) || ($state < 0)) { |
|
294 | - $html .= $this->drawHorizontalLine(); |
|
295 | - } |
|
296 | - /* draw the parents */ |
|
297 | - if ($state >= 0 && (!empty($parent) || count($fop))) { |
|
298 | - $unique = (empty($parent) || count($fop) == 0); |
|
299 | - $html .= '<td align="left"><table class="tv_tree"><tbody>'; |
|
300 | - if (!empty($parent)) { |
|
301 | - $u = $unique ? 'c' : 't'; |
|
302 | - $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $primaryChildFamily->getXref() . '@' . $u . '"' : '') . '>'; |
|
303 | - $html .= $this->drawPerson($parent, $gen - 1, 1, $primaryChildFamily, $u); |
|
304 | - $html .= '</td></tr>'; |
|
305 | - } |
|
306 | - if (count($fop)) { |
|
307 | - $n = 0; |
|
308 | - $nb = count($fop); |
|
309 | - foreach ($fop as $p) { |
|
310 | - $n++; |
|
311 | - $u = $unique ? 'c' : ($n == $nb || empty($p[1]) ? 'b' : 'h'); |
|
312 | - $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $p[1]->getXref() . '@' . $u . '"' : '') . '>' . $this->drawPerson($p[0], $gen - 1, 1, $p[1], $u) . '</td></tr>'; |
|
313 | - } |
|
314 | - } |
|
315 | - $html .= '</tbody></table></td>'; |
|
316 | - } |
|
317 | - if ($state < 0) { |
|
318 | - $html .= $this->drawVerticalLine($order); |
|
319 | - } |
|
320 | - $html .= '</tr></tbody></table>'; |
|
321 | - if ($isRoot) { |
|
322 | - $html .= '</td><td id="tv_tree_right"></td></tr><tr><td id="tv_tree_bottomleft"></td><td id="tv_tree_bottom"></td><td id="tv_tree_bottomright"></td></tr></tbody></table>'; |
|
323 | - } |
|
286 | + $primaryChildFamily = $person->getPrimaryChildFamily(); |
|
287 | + if (!empty($primaryChildFamily)) { |
|
288 | + $parent = $primaryChildFamily->getHusband(); |
|
289 | + if (empty($parent)) { |
|
290 | + $parent = $primaryChildFamily->getWife(); |
|
291 | + } |
|
292 | + } |
|
293 | + if (!empty($parent) || count($fop) || ($state < 0)) { |
|
294 | + $html .= $this->drawHorizontalLine(); |
|
295 | + } |
|
296 | + /* draw the parents */ |
|
297 | + if ($state >= 0 && (!empty($parent) || count($fop))) { |
|
298 | + $unique = (empty($parent) || count($fop) == 0); |
|
299 | + $html .= '<td align="left"><table class="tv_tree"><tbody>'; |
|
300 | + if (!empty($parent)) { |
|
301 | + $u = $unique ? 'c' : 't'; |
|
302 | + $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $primaryChildFamily->getXref() . '@' . $u . '"' : '') . '>'; |
|
303 | + $html .= $this->drawPerson($parent, $gen - 1, 1, $primaryChildFamily, $u); |
|
304 | + $html .= '</td></tr>'; |
|
305 | + } |
|
306 | + if (count($fop)) { |
|
307 | + $n = 0; |
|
308 | + $nb = count($fop); |
|
309 | + foreach ($fop as $p) { |
|
310 | + $n++; |
|
311 | + $u = $unique ? 'c' : ($n == $nb || empty($p[1]) ? 'b' : 'h'); |
|
312 | + $html .= '<tr><td ' . ($gen == 0 ? ' abbr="p' . $p[1]->getXref() . '@' . $u . '"' : '') . '>' . $this->drawPerson($p[0], $gen - 1, 1, $p[1], $u) . '</td></tr>'; |
|
313 | + } |
|
314 | + } |
|
315 | + $html .= '</tbody></table></td>'; |
|
316 | + } |
|
317 | + if ($state < 0) { |
|
318 | + $html .= $this->drawVerticalLine($order); |
|
319 | + } |
|
320 | + $html .= '</tr></tbody></table>'; |
|
321 | + if ($isRoot) { |
|
322 | + $html .= '</td><td id="tv_tree_right"></td></tr><tr><td id="tv_tree_bottomleft"></td><td id="tv_tree_bottom"></td><td id="tv_tree_bottomright"></td></tr></tbody></table>'; |
|
323 | + } |
|
324 | 324 | |
325 | - return $html; |
|
326 | - } |
|
325 | + return $html; |
|
326 | + } |
|
327 | 327 | |
328 | - /** |
|
329 | - * Draw a person name preceded by sex icon, with parents as tooltip |
|
330 | - * |
|
331 | - * @param Individual $individual an individual |
|
332 | - * @param string $dashed if = 'dashed' print dashed top border to separate multiple spuses |
|
333 | - * |
|
334 | - * @return string |
|
335 | - */ |
|
336 | - private function drawPersonName(Individual $individual, $dashed = '') { |
|
337 | - if ($this->all_partners === 'true') { |
|
338 | - $family = $individual->getPrimaryChildFamily(); |
|
339 | - if ($family) { |
|
340 | - $family_name = strip_tags($family->getFullName()); |
|
341 | - } else { |
|
342 | - $family_name = I18N::translateContext('unknown family', 'unknown'); |
|
343 | - } |
|
344 | - switch ($individual->getSex()) { |
|
345 | - case 'M': |
|
346 | - $title = ' title="' . /* I18N: e.g. “Son of [father name & mother name]” */ I18N::translate('Son of %s', $family_name) . '"'; |
|
347 | - break; |
|
348 | - case 'F': |
|
349 | - $title = ' title="' . /* I18N: e.g. “Daughter of [father name & mother name]” */ I18N::translate('Daughter of %s', $family_name) . '"'; |
|
350 | - break; |
|
351 | - default: |
|
352 | - $title = ' title="' . /* I18N: e.g. “Child of [father name & mother name]” */ I18N::translate('Child of %s', $family_name) . '"'; |
|
353 | - break; |
|
354 | - } |
|
355 | - } else { |
|
356 | - $title = ''; |
|
357 | - } |
|
358 | - $sex = $individual->getSex(); |
|
328 | + /** |
|
329 | + * Draw a person name preceded by sex icon, with parents as tooltip |
|
330 | + * |
|
331 | + * @param Individual $individual an individual |
|
332 | + * @param string $dashed if = 'dashed' print dashed top border to separate multiple spuses |
|
333 | + * |
|
334 | + * @return string |
|
335 | + */ |
|
336 | + private function drawPersonName(Individual $individual, $dashed = '') { |
|
337 | + if ($this->all_partners === 'true') { |
|
338 | + $family = $individual->getPrimaryChildFamily(); |
|
339 | + if ($family) { |
|
340 | + $family_name = strip_tags($family->getFullName()); |
|
341 | + } else { |
|
342 | + $family_name = I18N::translateContext('unknown family', 'unknown'); |
|
343 | + } |
|
344 | + switch ($individual->getSex()) { |
|
345 | + case 'M': |
|
346 | + $title = ' title="' . /* I18N: e.g. “Son of [father name & mother name]” */ I18N::translate('Son of %s', $family_name) . '"'; |
|
347 | + break; |
|
348 | + case 'F': |
|
349 | + $title = ' title="' . /* I18N: e.g. “Daughter of [father name & mother name]” */ I18N::translate('Daughter of %s', $family_name) . '"'; |
|
350 | + break; |
|
351 | + default: |
|
352 | + $title = ' title="' . /* I18N: e.g. “Child of [father name & mother name]” */ I18N::translate('Child of %s', $family_name) . '"'; |
|
353 | + break; |
|
354 | + } |
|
355 | + } else { |
|
356 | + $title = ''; |
|
357 | + } |
|
358 | + $sex = $individual->getSex(); |
|
359 | 359 | |
360 | - return '<div class="tv' . $sex . ' ' . $dashed . '"' . $title . '><a href="' . $individual->getHtmlUrl() . '"></a>' . $individual->getFullName() . ' <span class="dates">' . $individual->getLifeSpan() . '</span></div>'; |
|
361 | - } |
|
360 | + return '<div class="tv' . $sex . ' ' . $dashed . '"' . $title . '><a href="' . $individual->getHtmlUrl() . '"></a>' . $individual->getFullName() . ' <span class="dates">' . $individual->getLifeSpan() . '</span></div>'; |
|
361 | + } |
|
362 | 362 | |
363 | - /** |
|
364 | - * Get the thumbnail image for the given person |
|
365 | - * |
|
366 | - * @param Individual $individual |
|
367 | - * |
|
368 | - * @return string |
|
369 | - */ |
|
370 | - private function getThumbnail(Individual $individual) { |
|
371 | - if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { |
|
372 | - return $individual->displayImage(); |
|
373 | - } else { |
|
374 | - return ''; |
|
375 | - } |
|
376 | - } |
|
363 | + /** |
|
364 | + * Get the thumbnail image for the given person |
|
365 | + * |
|
366 | + * @param Individual $individual |
|
367 | + * |
|
368 | + * @return string |
|
369 | + */ |
|
370 | + private function getThumbnail(Individual $individual) { |
|
371 | + if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { |
|
372 | + return $individual->displayImage(); |
|
373 | + } else { |
|
374 | + return ''; |
|
375 | + } |
|
376 | + } |
|
377 | 377 | |
378 | - /** |
|
379 | - * Draw a vertical line |
|
380 | - * |
|
381 | - * @param string $order A parameter that set how to draw this line with auto-redimensionning capabilities |
|
382 | - * |
|
383 | - * @return string |
|
384 | - * WARNING : some tricky hacks are required in CSS to ensure cross-browser compliance |
|
385 | - * some browsers shows an image, which imply a size limit in height, |
|
386 | - * and some other browsers (ex: firefox) shows a <div> tag, which have no size limit in height |
|
387 | - * Therefore, Firefox is a good choice to print very big trees. |
|
388 | - */ |
|
389 | - private function drawVerticalLine($order) { |
|
390 | - return '<td class="tv_vline tv_vline_' . $order . '"><div class="tv_vline tv_vline_' . $order . '"></div></td>'; |
|
391 | - } |
|
378 | + /** |
|
379 | + * Draw a vertical line |
|
380 | + * |
|
381 | + * @param string $order A parameter that set how to draw this line with auto-redimensionning capabilities |
|
382 | + * |
|
383 | + * @return string |
|
384 | + * WARNING : some tricky hacks are required in CSS to ensure cross-browser compliance |
|
385 | + * some browsers shows an image, which imply a size limit in height, |
|
386 | + * and some other browsers (ex: firefox) shows a <div> tag, which have no size limit in height |
|
387 | + * Therefore, Firefox is a good choice to print very big trees. |
|
388 | + */ |
|
389 | + private function drawVerticalLine($order) { |
|
390 | + return '<td class="tv_vline tv_vline_' . $order . '"><div class="tv_vline tv_vline_' . $order . '"></div></td>'; |
|
391 | + } |
|
392 | 392 | |
393 | - /** |
|
394 | - * Draw an horizontal line |
|
395 | - */ |
|
396 | - private function drawHorizontalLine() { |
|
397 | - return '<td class="tv_hline"><div class="tv_hline"></div></td>'; |
|
398 | - } |
|
393 | + /** |
|
394 | + * Draw an horizontal line |
|
395 | + */ |
|
396 | + private function drawHorizontalLine() { |
|
397 | + return '<td class="tv_hline"><div class="tv_hline"></div></td>'; |
|
398 | + } |
|
399 | 399 | } |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | $firstLetter = substr($jsonRequest, 0, 1); |
93 | 93 | $jsonRequest = substr($jsonRequest, 1); |
94 | 94 | switch ($firstLetter) { |
95 | - case 'c': |
|
96 | - $fidlist = explode(',', $jsonRequest); |
|
97 | - $flist = array(); |
|
98 | - foreach ($fidlist as $fid) { |
|
99 | - $flist[] = Family::getInstance($fid, $WT_TREE); |
|
100 | - } |
|
101 | - $r[] = $this->drawChildren($flist, 1, true); |
|
102 | - break; |
|
103 | - case 'p': |
|
104 | - $params = explode('@', $jsonRequest); |
|
105 | - $fid = $params[0]; |
|
106 | - $order = $params[1]; |
|
107 | - $f = Family::getInstance($fid, $WT_TREE); |
|
108 | - if ($f->getHusband()) { |
|
109 | - $r[] = $this->drawPerson($f->getHusband(), 0, 1, $f, $order); |
|
110 | - } elseif ($f->getWife()) { |
|
111 | - $r[] = $this->drawPerson($f->getWife(), 0, 1, $f, $order); |
|
112 | - } |
|
113 | - break; |
|
95 | + case 'c': |
|
96 | + $fidlist = explode(',', $jsonRequest); |
|
97 | + $flist = array(); |
|
98 | + foreach ($fidlist as $fid) { |
|
99 | + $flist[] = Family::getInstance($fid, $WT_TREE); |
|
100 | + } |
|
101 | + $r[] = $this->drawChildren($flist, 1, true); |
|
102 | + break; |
|
103 | + case 'p': |
|
104 | + $params = explode('@', $jsonRequest); |
|
105 | + $fid = $params[0]; |
|
106 | + $order = $params[1]; |
|
107 | + $f = Family::getInstance($fid, $WT_TREE); |
|
108 | + if ($f->getHusband()) { |
|
109 | + $r[] = $this->drawPerson($f->getHusband(), 0, 1, $f, $order); |
|
110 | + } elseif ($f->getWife()) { |
|
111 | + $r[] = $this->drawPerson($f->getWife(), 0, 1, $f, $order); |
|
112 | + } |
|
113 | + break; |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
@@ -342,15 +342,15 @@ discard block |
||
342 | 342 | $family_name = I18N::translateContext('unknown family', 'unknown'); |
343 | 343 | } |
344 | 344 | switch ($individual->getSex()) { |
345 | - case 'M': |
|
346 | - $title = ' title="' . /* I18N: e.g. “Son of [father name & mother name]” */ I18N::translate('Son of %s', $family_name) . '"'; |
|
347 | - break; |
|
348 | - case 'F': |
|
349 | - $title = ' title="' . /* I18N: e.g. “Daughter of [father name & mother name]” */ I18N::translate('Daughter of %s', $family_name) . '"'; |
|
350 | - break; |
|
351 | - default: |
|
352 | - $title = ' title="' . /* I18N: e.g. “Child of [father name & mother name]” */ I18N::translate('Child of %s', $family_name) . '"'; |
|
353 | - break; |
|
345 | + case 'M': |
|
346 | + $title = ' title="' . /* I18N: e.g. “Son of [father name & mother name]” */ I18N::translate('Son of %s', $family_name) . '"'; |
|
347 | + break; |
|
348 | + case 'F': |
|
349 | + $title = ' title="' . /* I18N: e.g. “Daughter of [father name & mother name]” */ I18N::translate('Daughter of %s', $family_name) . '"'; |
|
350 | + break; |
|
351 | + default: |
|
352 | + $title = ' title="' . /* I18N: e.g. “Child of [father name & mother name]” */ I18N::translate('Child of %s', $family_name) . '"'; |
|
353 | + break; |
|
354 | 354 | } |
355 | 355 | } else { |
356 | 356 | $title = ''; |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Class TreeView |
25 | 25 | */ |
26 | -class TreeView { |
|
26 | +class TreeView |
|
27 | +{ |
|
27 | 28 | /** @var string HTML element name */ |
28 | 29 | private $name; |
29 | 30 | |
@@ -35,7 +36,8 @@ discard block |
||
35 | 36 | * |
36 | 37 | * @param string $name the name of the TreeView object’s instance |
37 | 38 | */ |
38 | - public function __construct($name = 'tree') { |
|
39 | + public function __construct($name = 'tree') |
|
40 | + { |
|
39 | 41 | $this->name = $name; |
40 | 42 | $this->all_partners = Filter::cookie('allPartners', 'true|false', 'true'); |
41 | 43 | } |
@@ -49,7 +51,8 @@ discard block |
||
49 | 51 | * |
50 | 52 | * @return string[] HTML and Javascript |
51 | 53 | */ |
52 | - public function drawViewport(Individual $root_person, $generations) { |
|
54 | + public function drawViewport(Individual $root_person, $generations) |
|
55 | + { |
|
53 | 56 | $html = ' |
54 | 57 | <a name="tv_content"></a> |
55 | 58 | <div id="' . $this->name . '_out" class="tv_out"> |
@@ -83,7 +86,8 @@ discard block |
||
83 | 86 | * |
84 | 87 | * @return string |
85 | 88 | */ |
86 | - public function getPersons($list) { |
|
89 | + public function getPersons($list) |
|
90 | + { |
|
87 | 91 | global $WT_TREE; |
88 | 92 | |
89 | 93 | $list = explode(';', $list); |
@@ -124,7 +128,8 @@ discard block |
||
124 | 128 | * |
125 | 129 | * @return string |
126 | 130 | */ |
127 | - public function getDetails(Individual $individual) { |
|
131 | + public function getDetails(Individual $individual) |
|
132 | + { |
|
128 | 133 | $html = $this->getPersonDetails($individual, null); |
129 | 134 | foreach ($individual->getSpouseFamilies() as $family) { |
130 | 135 | $spouse = $family->getSpouse($individual); |
@@ -144,7 +149,8 @@ discard block |
||
144 | 149 | * |
145 | 150 | * @return string |
146 | 151 | */ |
147 | - private function getPersonDetails(Individual $individual, Family $family = null) { |
|
152 | + private function getPersonDetails(Individual $individual, Family $family = null) |
|
153 | + { |
|
148 | 154 | $hmtl = $this->getThumbnail($individual); |
149 | 155 | $hmtl .= '<a class="tv_link" href="' . $individual->getHtmlUrl() . '">' . $individual->getFullName() . '</a> <a href="module.php?mod=tree&mod_action=treeview&rootid=' . $individual->getXref() . '" title="' . I18N::translate('Interactive tree of %s', strip_tags($individual->getFullName())) . '" class="icon-button_indi tv_link tv_treelink"></a>'; |
150 | 156 | foreach ($individual->getFacts(WT_EVENTS_BIRT, true) as $fact) { |
@@ -171,7 +177,8 @@ discard block |
||
171 | 177 | * |
172 | 178 | * @return string |
173 | 179 | */ |
174 | - private function drawChildren(array $familyList, $gen = 1, $ajax = false) { |
|
180 | + private function drawChildren(array $familyList, $gen = 1, $ajax = false) |
|
181 | + { |
|
175 | 182 | $html = ''; |
176 | 183 | $children2draw = array(); |
177 | 184 | $f2load = array(); |
@@ -230,7 +237,8 @@ discard block |
||
230 | 237 | * (for "life partner") here fits much better than "spouse" or "mate" |
231 | 238 | * to translate properly the modern french meaning of "conjoint" |
232 | 239 | */ |
233 | - private function drawPerson(Individual $person, $gen, $state, Family $pfamily = null, $order = null, $isRoot = false) { |
|
240 | + private function drawPerson(Individual $person, $gen, $state, Family $pfamily = null, $order = null, $isRoot = false) |
|
241 | + { |
|
234 | 242 | if ($gen < 0) { |
235 | 243 | return ''; |
236 | 244 | } |
@@ -333,7 +341,8 @@ discard block |
||
333 | 341 | * |
334 | 342 | * @return string |
335 | 343 | */ |
336 | - private function drawPersonName(Individual $individual, $dashed = '') { |
|
344 | + private function drawPersonName(Individual $individual, $dashed = '') |
|
345 | + { |
|
337 | 346 | if ($this->all_partners === 'true') { |
338 | 347 | $family = $individual->getPrimaryChildFamily(); |
339 | 348 | if ($family) { |
@@ -367,7 +376,8 @@ discard block |
||
367 | 376 | * |
368 | 377 | * @return string |
369 | 378 | */ |
370 | - private function getThumbnail(Individual $individual) { |
|
379 | + private function getThumbnail(Individual $individual) |
|
380 | + { |
|
371 | 381 | if ($individual->getTree()->getPreference('SHOW_HIGHLIGHT_IMAGES')) { |
372 | 382 | return $individual->displayImage(); |
373 | 383 | } else { |
@@ -386,14 +396,16 @@ discard block |
||
386 | 396 | * and some other browsers (ex: firefox) shows a <div> tag, which have no size limit in height |
387 | 397 | * Therefore, Firefox is a good choice to print very big trees. |
388 | 398 | */ |
389 | - private function drawVerticalLine($order) { |
|
399 | + private function drawVerticalLine($order) |
|
400 | + { |
|
390 | 401 | return '<td class="tv_vline tv_vline_' . $order . '"><div class="tv_vline tv_vline_' . $order . '"></div></td>'; |
391 | 402 | } |
392 | 403 | |
393 | 404 | /** |
394 | 405 | * Draw an horizontal line |
395 | 406 | */ |
396 | - private function drawHorizontalLine() { |
|
407 | + private function drawHorizontalLine() |
|
408 | + { |
|
397 | 409 | return '<td class="tv_hline"><div class="tv_hline"></div></td>'; |
398 | 410 | } |
399 | 411 | } |
@@ -26,70 +26,70 @@ discard block |
||
26 | 26 | * Class DescendancyModule |
27 | 27 | */ |
28 | 28 | class DescendancyModule extends AbstractModule implements ModuleSidebarInterface { |
29 | - /** {@inheritdoc} */ |
|
30 | - public function getTitle() { |
|
31 | - return /* I18N: Name of a module/sidebar */ |
|
32 | - I18N::translate('Descendants'); |
|
33 | - } |
|
29 | + /** {@inheritdoc} */ |
|
30 | + public function getTitle() { |
|
31 | + return /* I18N: Name of a module/sidebar */ |
|
32 | + I18N::translate('Descendants'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** {@inheritdoc} */ |
|
36 | - public function getDescription() { |
|
37 | - return /* I18N: Description of the “Descendants” module */ |
|
38 | - I18N::translate('A sidebar showing the descendants of an individual.'); |
|
39 | - } |
|
35 | + /** {@inheritdoc} */ |
|
36 | + public function getDescription() { |
|
37 | + return /* I18N: Description of the “Descendants” module */ |
|
38 | + I18N::translate('A sidebar showing the descendants of an individual.'); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * This is a general purpose hook, allowing modules to respond to routes |
|
43 | - * of the form module.php?mod=FOO&mod_action=BAR |
|
44 | - * |
|
45 | - * @param string $mod_action |
|
46 | - */ |
|
47 | - public function modAction($mod_action) { |
|
48 | - global $WT_TREE; |
|
41 | + /** |
|
42 | + * This is a general purpose hook, allowing modules to respond to routes |
|
43 | + * of the form module.php?mod=FOO&mod_action=BAR |
|
44 | + * |
|
45 | + * @param string $mod_action |
|
46 | + */ |
|
47 | + public function modAction($mod_action) { |
|
48 | + global $WT_TREE; |
|
49 | 49 | |
50 | - header('Content-Type: text/html; charset=UTF-8'); |
|
50 | + header('Content-Type: text/html; charset=UTF-8'); |
|
51 | 51 | |
52 | - switch ($mod_action) { |
|
53 | - case 'search': |
|
54 | - $search = Filter::get('search'); |
|
55 | - echo $this->search($search, $WT_TREE); |
|
56 | - break; |
|
57 | - case 'descendants': |
|
58 | - $individual = Individual::getInstance(Filter::get('xref', WT_REGEX_XREF), $WT_TREE); |
|
59 | - if ($individual) { |
|
60 | - echo $this->loadSpouses($individual, 1); |
|
61 | - } |
|
62 | - break; |
|
63 | - default: |
|
64 | - http_response_code(404); |
|
65 | - break; |
|
66 | - } |
|
67 | - } |
|
52 | + switch ($mod_action) { |
|
53 | + case 'search': |
|
54 | + $search = Filter::get('search'); |
|
55 | + echo $this->search($search, $WT_TREE); |
|
56 | + break; |
|
57 | + case 'descendants': |
|
58 | + $individual = Individual::getInstance(Filter::get('xref', WT_REGEX_XREF), $WT_TREE); |
|
59 | + if ($individual) { |
|
60 | + echo $this->loadSpouses($individual, 1); |
|
61 | + } |
|
62 | + break; |
|
63 | + default: |
|
64 | + http_response_code(404); |
|
65 | + break; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | |
69 | - /** {@inheritdoc} */ |
|
70 | - public function defaultSidebarOrder() { |
|
71 | - return 30; |
|
72 | - } |
|
69 | + /** {@inheritdoc} */ |
|
70 | + public function defaultSidebarOrder() { |
|
71 | + return 30; |
|
72 | + } |
|
73 | 73 | |
74 | - /** {@inheritdoc} */ |
|
75 | - public function hasSidebarContent() { |
|
76 | - return true; |
|
77 | - } |
|
74 | + /** {@inheritdoc} */ |
|
75 | + public function hasSidebarContent() { |
|
76 | + return true; |
|
77 | + } |
|
78 | 78 | |
79 | - /** {@inheritdoc} */ |
|
80 | - public function getSidebarAjaxContent() { |
|
81 | - return ''; |
|
82 | - } |
|
79 | + /** {@inheritdoc} */ |
|
80 | + public function getSidebarAjaxContent() { |
|
81 | + return ''; |
|
82 | + } |
|
83 | 83 | |
84 | - /** |
|
85 | - * Load this sidebar synchronously. |
|
86 | - * |
|
87 | - * @return string |
|
88 | - */ |
|
89 | - public function getSidebarContent() { |
|
90 | - global $controller; |
|
84 | + /** |
|
85 | + * Load this sidebar synchronously. |
|
86 | + * |
|
87 | + * @return string |
|
88 | + */ |
|
89 | + public function getSidebarContent() { |
|
90 | + global $controller; |
|
91 | 91 | |
92 | - $controller->addInlineJavascript(' |
|
92 | + $controller->addInlineJavascript(' |
|
93 | 93 | function dsearchQ() { |
94 | 94 | var query = jQuery("#sb_desc_name").val(); |
95 | 95 | if (query.length>1) { |
@@ -129,154 +129,154 @@ discard block |
||
129 | 129 | }); |
130 | 130 | '); |
131 | 131 | |
132 | - return |
|
133 | - '<form method="post" action="module.php?mod=' . $this->getName() . '&mod_action=search" onsubmit="return false;">' . |
|
134 | - '<input type="search" name="sb_desc_name" id="sb_desc_name" placeholder="' . I18N::translate('Search') . '">' . |
|
135 | - '</form>' . |
|
136 | - '<div id="sb_desc_content">' . |
|
137 | - '<ul>' . $this->getPersonLi($controller->record, 1) . '</ul>' . |
|
138 | - '</div>'; |
|
139 | - } |
|
132 | + return |
|
133 | + '<form method="post" action="module.php?mod=' . $this->getName() . '&mod_action=search" onsubmit="return false;">' . |
|
134 | + '<input type="search" name="sb_desc_name" id="sb_desc_name" placeholder="' . I18N::translate('Search') . '">' . |
|
135 | + '</form>' . |
|
136 | + '<div id="sb_desc_content">' . |
|
137 | + '<ul>' . $this->getPersonLi($controller->record, 1) . '</ul>' . |
|
138 | + '</div>'; |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * Format an individual in a list. |
|
143 | - * |
|
144 | - * @param Individual $person |
|
145 | - * @param int $generations |
|
146 | - * |
|
147 | - * @return string |
|
148 | - */ |
|
149 | - public function getPersonLi(Individual $person, $generations = 0) { |
|
150 | - $icon = $generations > 0 ? 'icon-minus' : 'icon-plus'; |
|
151 | - $lifespan = $person->canShow() ? '(' . $person->getLifeSpan() . ')' : ''; |
|
152 | - $spouses = $generations > 0 ? $this->loadSpouses($person, 0) : ''; |
|
141 | + /** |
|
142 | + * Format an individual in a list. |
|
143 | + * |
|
144 | + * @param Individual $person |
|
145 | + * @param int $generations |
|
146 | + * |
|
147 | + * @return string |
|
148 | + */ |
|
149 | + public function getPersonLi(Individual $person, $generations = 0) { |
|
150 | + $icon = $generations > 0 ? 'icon-minus' : 'icon-plus'; |
|
151 | + $lifespan = $person->canShow() ? '(' . $person->getLifeSpan() . ')' : ''; |
|
152 | + $spouses = $generations > 0 ? $this->loadSpouses($person, 0) : ''; |
|
153 | 153 | |
154 | - return |
|
155 | - '<li class="sb_desc_indi_li">' . |
|
156 | - '<a class="sb_desc_indi" href="module.php?mod=' . $this->getName() . '&mod_action=descendants&xref=' . $person->getXref() . '">' . |
|
157 | - '<i class="plusminus ' . $icon . '"></i>' . |
|
158 | - $person->getSexImage() . $person->getFullName() . $lifespan . |
|
159 | - '</a>' . |
|
160 | - '<a class="icon-button_indi" href="' . $person->getHtmlUrl() . '"></a>' . |
|
161 | - '<div>' . $spouses . '</div>' . |
|
162 | - '</li>'; |
|
163 | - } |
|
154 | + return |
|
155 | + '<li class="sb_desc_indi_li">' . |
|
156 | + '<a class="sb_desc_indi" href="module.php?mod=' . $this->getName() . '&mod_action=descendants&xref=' . $person->getXref() . '">' . |
|
157 | + '<i class="plusminus ' . $icon . '"></i>' . |
|
158 | + $person->getSexImage() . $person->getFullName() . $lifespan . |
|
159 | + '</a>' . |
|
160 | + '<a class="icon-button_indi" href="' . $person->getHtmlUrl() . '"></a>' . |
|
161 | + '<div>' . $spouses . '</div>' . |
|
162 | + '</li>'; |
|
163 | + } |
|
164 | 164 | |
165 | - /** |
|
166 | - * Format a family in a list. |
|
167 | - * |
|
168 | - * @param Family $family |
|
169 | - * @param Individual $person |
|
170 | - * @param int $generations |
|
171 | - * |
|
172 | - * @return string |
|
173 | - */ |
|
174 | - public function getFamilyLi(Family $family, Individual $person, $generations = 0) { |
|
175 | - $spouse = $family->getSpouse($person); |
|
176 | - if ($spouse) { |
|
177 | - $spouse_name = $spouse->getSexImage() . $spouse->getFullName(); |
|
178 | - $spouse_link = '<a class="icon-button_indi" href="' . $spouse->getHtmlUrl() . '"></a>'; |
|
179 | - } else { |
|
180 | - $spouse_name = ''; |
|
181 | - $spouse_link = ''; |
|
182 | - } |
|
165 | + /** |
|
166 | + * Format a family in a list. |
|
167 | + * |
|
168 | + * @param Family $family |
|
169 | + * @param Individual $person |
|
170 | + * @param int $generations |
|
171 | + * |
|
172 | + * @return string |
|
173 | + */ |
|
174 | + public function getFamilyLi(Family $family, Individual $person, $generations = 0) { |
|
175 | + $spouse = $family->getSpouse($person); |
|
176 | + if ($spouse) { |
|
177 | + $spouse_name = $spouse->getSexImage() . $spouse->getFullName(); |
|
178 | + $spouse_link = '<a class="icon-button_indi" href="' . $spouse->getHtmlUrl() . '"></a>'; |
|
179 | + } else { |
|
180 | + $spouse_name = ''; |
|
181 | + $spouse_link = ''; |
|
182 | + } |
|
183 | 183 | |
184 | - $marryear = $family->getMarriageYear(); |
|
185 | - $marr = $marryear ? '<i class="icon-rings"></i>' . $marryear : ''; |
|
184 | + $marryear = $family->getMarriageYear(); |
|
185 | + $marr = $marryear ? '<i class="icon-rings"></i>' . $marryear : ''; |
|
186 | 186 | |
187 | - return |
|
188 | - '<li class="sb_desc_indi_li">' . |
|
189 | - '<a class="sb_desc_indi" href="#"><i class="plusminus icon-minus"></i>' . $spouse_name . $marr . '</a>' . |
|
190 | - $spouse_link . |
|
191 | - '<a href="' . $family->getHtmlUrl() . '" class="icon-button_family"></a>' . |
|
192 | - '<div>' . $this->loadChildren($family, $generations) . '</div>' . |
|
193 | - '</li>'; |
|
194 | - } |
|
187 | + return |
|
188 | + '<li class="sb_desc_indi_li">' . |
|
189 | + '<a class="sb_desc_indi" href="#"><i class="plusminus icon-minus"></i>' . $spouse_name . $marr . '</a>' . |
|
190 | + $spouse_link . |
|
191 | + '<a href="' . $family->getHtmlUrl() . '" class="icon-button_family"></a>' . |
|
192 | + '<div>' . $this->loadChildren($family, $generations) . '</div>' . |
|
193 | + '</li>'; |
|
194 | + } |
|
195 | 195 | |
196 | - /** |
|
197 | - * Respond to an autocomplete search request. |
|
198 | - * |
|
199 | - * @param string $query Search for this term |
|
200 | - * @param Tree $tree Search in this tree |
|
201 | - * |
|
202 | - * @return string |
|
203 | - */ |
|
204 | - public function search($query, Tree $tree) { |
|
205 | - if (strlen($query) < 2) { |
|
206 | - return ''; |
|
207 | - } |
|
196 | + /** |
|
197 | + * Respond to an autocomplete search request. |
|
198 | + * |
|
199 | + * @param string $query Search for this term |
|
200 | + * @param Tree $tree Search in this tree |
|
201 | + * |
|
202 | + * @return string |
|
203 | + */ |
|
204 | + public function search($query, Tree $tree) { |
|
205 | + if (strlen($query) < 2) { |
|
206 | + return ''; |
|
207 | + } |
|
208 | 208 | |
209 | - $rows = Database::prepare( |
|
210 | - "SELECT i_id AS xref" . |
|
211 | - " FROM `##individuals`" . |
|
212 | - " JOIN `##name` ON i_id = n_id AND i_file = n_file" . |
|
213 | - " WHERE n_sort LIKE CONCAT('%', :query, '%') AND i_file = :tree_id" . |
|
214 | - " ORDER BY n_sort" |
|
215 | - )->execute(array( |
|
216 | - 'query' => $query, |
|
217 | - 'tree_id' => $tree->getTreeId(), |
|
218 | - ))->fetchAll(); |
|
209 | + $rows = Database::prepare( |
|
210 | + "SELECT i_id AS xref" . |
|
211 | + " FROM `##individuals`" . |
|
212 | + " JOIN `##name` ON i_id = n_id AND i_file = n_file" . |
|
213 | + " WHERE n_sort LIKE CONCAT('%', :query, '%') AND i_file = :tree_id" . |
|
214 | + " ORDER BY n_sort" |
|
215 | + )->execute(array( |
|
216 | + 'query' => $query, |
|
217 | + 'tree_id' => $tree->getTreeId(), |
|
218 | + ))->fetchAll(); |
|
219 | 219 | |
220 | - $out = ''; |
|
221 | - foreach ($rows as $row) { |
|
222 | - $person = Individual::getInstance($row->xref, $tree); |
|
223 | - if ($person && $person->canShowName()) { |
|
224 | - $out .= $this->getPersonLi($person); |
|
225 | - } |
|
226 | - } |
|
227 | - if ($out) { |
|
228 | - return '<ul>' . $out . '</ul>'; |
|
229 | - } else { |
|
230 | - return ''; |
|
231 | - } |
|
232 | - } |
|
220 | + $out = ''; |
|
221 | + foreach ($rows as $row) { |
|
222 | + $person = Individual::getInstance($row->xref, $tree); |
|
223 | + if ($person && $person->canShowName()) { |
|
224 | + $out .= $this->getPersonLi($person); |
|
225 | + } |
|
226 | + } |
|
227 | + if ($out) { |
|
228 | + return '<ul>' . $out . '</ul>'; |
|
229 | + } else { |
|
230 | + return ''; |
|
231 | + } |
|
232 | + } |
|
233 | 233 | |
234 | - /** |
|
235 | - * Display spouses. |
|
236 | - * |
|
237 | - * @param Individual $person |
|
238 | - * @param int $generations |
|
239 | - * |
|
240 | - * @return string |
|
241 | - */ |
|
242 | - public function loadSpouses(Individual $person, $generations) { |
|
243 | - $out = ''; |
|
244 | - if ($person && $person->canShow()) { |
|
245 | - foreach ($person->getSpouseFamilies() as $family) { |
|
246 | - $out .= $this->getFamilyLi($family, $person, $generations - 1); |
|
247 | - } |
|
248 | - } |
|
249 | - if ($out) { |
|
250 | - return '<ul>' . $out . '</ul>'; |
|
251 | - } else { |
|
252 | - return ''; |
|
253 | - } |
|
254 | - } |
|
234 | + /** |
|
235 | + * Display spouses. |
|
236 | + * |
|
237 | + * @param Individual $person |
|
238 | + * @param int $generations |
|
239 | + * |
|
240 | + * @return string |
|
241 | + */ |
|
242 | + public function loadSpouses(Individual $person, $generations) { |
|
243 | + $out = ''; |
|
244 | + if ($person && $person->canShow()) { |
|
245 | + foreach ($person->getSpouseFamilies() as $family) { |
|
246 | + $out .= $this->getFamilyLi($family, $person, $generations - 1); |
|
247 | + } |
|
248 | + } |
|
249 | + if ($out) { |
|
250 | + return '<ul>' . $out . '</ul>'; |
|
251 | + } else { |
|
252 | + return ''; |
|
253 | + } |
|
254 | + } |
|
255 | 255 | |
256 | - /** |
|
257 | - * Display descendants. |
|
258 | - * |
|
259 | - * @param Family $family |
|
260 | - * @param int $generations |
|
261 | - * |
|
262 | - * @return string |
|
263 | - */ |
|
264 | - public function loadChildren(Family $family, $generations) { |
|
265 | - $out = ''; |
|
266 | - if ($family->canShow()) { |
|
267 | - $children = $family->getChildren(); |
|
268 | - if ($children) { |
|
269 | - foreach ($children as $child) { |
|
270 | - $out .= $this->getPersonLi($child, $generations - 1); |
|
271 | - } |
|
272 | - } else { |
|
273 | - $out .= '<li class="sb_desc_none">' . I18N::translate('No children') . '</li>'; |
|
274 | - } |
|
275 | - } |
|
276 | - if ($out) { |
|
277 | - return '<ul>' . $out . '</ul>'; |
|
278 | - } else { |
|
279 | - return ''; |
|
280 | - } |
|
281 | - } |
|
256 | + /** |
|
257 | + * Display descendants. |
|
258 | + * |
|
259 | + * @param Family $family |
|
260 | + * @param int $generations |
|
261 | + * |
|
262 | + * @return string |
|
263 | + */ |
|
264 | + public function loadChildren(Family $family, $generations) { |
|
265 | + $out = ''; |
|
266 | + if ($family->canShow()) { |
|
267 | + $children = $family->getChildren(); |
|
268 | + if ($children) { |
|
269 | + foreach ($children as $child) { |
|
270 | + $out .= $this->getPersonLi($child, $generations - 1); |
|
271 | + } |
|
272 | + } else { |
|
273 | + $out .= '<li class="sb_desc_none">' . I18N::translate('No children') . '</li>'; |
|
274 | + } |
|
275 | + } |
|
276 | + if ($out) { |
|
277 | + return '<ul>' . $out . '</ul>'; |
|
278 | + } else { |
|
279 | + return ''; |
|
280 | + } |
|
281 | + } |
|
282 | 282 | } |
@@ -50,19 +50,19 @@ |
||
50 | 50 | header('Content-Type: text/html; charset=UTF-8'); |
51 | 51 | |
52 | 52 | switch ($mod_action) { |
53 | - case 'search': |
|
54 | - $search = Filter::get('search'); |
|
55 | - echo $this->search($search, $WT_TREE); |
|
56 | - break; |
|
57 | - case 'descendants': |
|
58 | - $individual = Individual::getInstance(Filter::get('xref', WT_REGEX_XREF), $WT_TREE); |
|
59 | - if ($individual) { |
|
60 | - echo $this->loadSpouses($individual, 1); |
|
61 | - } |
|
62 | - break; |
|
63 | - default: |
|
64 | - http_response_code(404); |
|
65 | - break; |
|
53 | + case 'search': |
|
54 | + $search = Filter::get('search'); |
|
55 | + echo $this->search($search, $WT_TREE); |
|
56 | + break; |
|
57 | + case 'descendants': |
|
58 | + $individual = Individual::getInstance(Filter::get('xref', WT_REGEX_XREF), $WT_TREE); |
|
59 | + if ($individual) { |
|
60 | + echo $this->loadSpouses($individual, 1); |
|
61 | + } |
|
62 | + break; |
|
63 | + default: |
|
64 | + http_response_code(404); |
|
65 | + break; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -25,15 +25,18 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Class DescendancyModule |
27 | 27 | */ |
28 | -class DescendancyModule extends AbstractModule implements ModuleSidebarInterface { |
|
28 | +class DescendancyModule extends AbstractModule implements ModuleSidebarInterface |
|
29 | +{ |
|
29 | 30 | /** {@inheritdoc} */ |
30 | - public function getTitle() { |
|
31 | + public function getTitle() |
|
32 | + { |
|
31 | 33 | return /* I18N: Name of a module/sidebar */ |
32 | 34 | I18N::translate('Descendants'); |
33 | 35 | } |
34 | 36 | |
35 | 37 | /** {@inheritdoc} */ |
36 | - public function getDescription() { |
|
38 | + public function getDescription() |
|
39 | + { |
|
37 | 40 | return /* I18N: Description of the “Descendants” module */ |
38 | 41 | I18N::translate('A sidebar showing the descendants of an individual.'); |
39 | 42 | } |
@@ -44,7 +47,8 @@ discard block |
||
44 | 47 | * |
45 | 48 | * @param string $mod_action |
46 | 49 | */ |
47 | - public function modAction($mod_action) { |
|
50 | + public function modAction($mod_action) |
|
51 | + { |
|
48 | 52 | global $WT_TREE; |
49 | 53 | |
50 | 54 | header('Content-Type: text/html; charset=UTF-8'); |
@@ -67,17 +71,20 @@ discard block |
||
67 | 71 | } |
68 | 72 | |
69 | 73 | /** {@inheritdoc} */ |
70 | - public function defaultSidebarOrder() { |
|
74 | + public function defaultSidebarOrder() |
|
75 | + { |
|
71 | 76 | return 30; |
72 | 77 | } |
73 | 78 | |
74 | 79 | /** {@inheritdoc} */ |
75 | - public function hasSidebarContent() { |
|
80 | + public function hasSidebarContent() |
|
81 | + { |
|
76 | 82 | return true; |
77 | 83 | } |
78 | 84 | |
79 | 85 | /** {@inheritdoc} */ |
80 | - public function getSidebarAjaxContent() { |
|
86 | + public function getSidebarAjaxContent() |
|
87 | + { |
|
81 | 88 | return ''; |
82 | 89 | } |
83 | 90 | |
@@ -86,7 +93,8 @@ discard block |
||
86 | 93 | * |
87 | 94 | * @return string |
88 | 95 | */ |
89 | - public function getSidebarContent() { |
|
96 | + public function getSidebarContent() |
|
97 | + { |
|
90 | 98 | global $controller; |
91 | 99 | |
92 | 100 | $controller->addInlineJavascript(' |
@@ -146,7 +154,8 @@ discard block |
||
146 | 154 | * |
147 | 155 | * @return string |
148 | 156 | */ |
149 | - public function getPersonLi(Individual $person, $generations = 0) { |
|
157 | + public function getPersonLi(Individual $person, $generations = 0) |
|
158 | + { |
|
150 | 159 | $icon = $generations > 0 ? 'icon-minus' : 'icon-plus'; |
151 | 160 | $lifespan = $person->canShow() ? '(' . $person->getLifeSpan() . ')' : ''; |
152 | 161 | $spouses = $generations > 0 ? $this->loadSpouses($person, 0) : ''; |
@@ -171,7 +180,8 @@ discard block |
||
171 | 180 | * |
172 | 181 | * @return string |
173 | 182 | */ |
174 | - public function getFamilyLi(Family $family, Individual $person, $generations = 0) { |
|
183 | + public function getFamilyLi(Family $family, Individual $person, $generations = 0) |
|
184 | + { |
|
175 | 185 | $spouse = $family->getSpouse($person); |
176 | 186 | if ($spouse) { |
177 | 187 | $spouse_name = $spouse->getSexImage() . $spouse->getFullName(); |
@@ -201,7 +211,8 @@ discard block |
||
201 | 211 | * |
202 | 212 | * @return string |
203 | 213 | */ |
204 | - public function search($query, Tree $tree) { |
|
214 | + public function search($query, Tree $tree) |
|
215 | + { |
|
205 | 216 | if (strlen($query) < 2) { |
206 | 217 | return ''; |
207 | 218 | } |
@@ -239,7 +250,8 @@ discard block |
||
239 | 250 | * |
240 | 251 | * @return string |
241 | 252 | */ |
242 | - public function loadSpouses(Individual $person, $generations) { |
|
253 | + public function loadSpouses(Individual $person, $generations) |
|
254 | + { |
|
243 | 255 | $out = ''; |
244 | 256 | if ($person && $person->canShow()) { |
245 | 257 | foreach ($person->getSpouseFamilies() as $family) { |
@@ -261,7 +273,8 @@ discard block |
||
261 | 273 | * |
262 | 274 | * @return string |
263 | 275 | */ |
264 | - public function loadChildren(Family $family, $generations) { |
|
276 | + public function loadChildren(Family $family, $generations) |
|
277 | + { |
|
265 | 278 | $out = ''; |
266 | 279 | if ($family->canShow()) { |
267 | 280 | $children = $family->getChildren(); |
@@ -23,42 +23,42 @@ |
||
23 | 23 | * Class PageMenuModule |
24 | 24 | */ |
25 | 25 | class PageMenuModule extends AbstractModule implements ModuleMenuInterface { |
26 | - /** {@inheritdoc} */ |
|
27 | - public function getTitle() { |
|
28 | - return /* I18N: Name of a module/menu */ I18N::translate('Edit'); |
|
29 | - } |
|
26 | + /** {@inheritdoc} */ |
|
27 | + public function getTitle() { |
|
28 | + return /* I18N: Name of a module/menu */ I18N::translate('Edit'); |
|
29 | + } |
|
30 | 30 | |
31 | - /** {@inheritdoc} */ |
|
32 | - public function getDescription() { |
|
33 | - return /* I18N: Description of the “Edit” module */ I18N::translate('An edit menu for individuals, families, sources, etc.'); |
|
34 | - } |
|
31 | + /** {@inheritdoc} */ |
|
32 | + public function getDescription() { |
|
33 | + return /* I18N: Description of the “Edit” module */ I18N::translate('An edit menu for individuals, families, sources, etc.'); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * The user can re-order menus. Until they do, they are shown in this order. |
|
38 | - * |
|
39 | - * @return int |
|
40 | - */ |
|
41 | - public function defaultMenuOrder() { |
|
42 | - return 10; |
|
43 | - } |
|
36 | + /** |
|
37 | + * The user can re-order menus. Until they do, they are shown in this order. |
|
38 | + * |
|
39 | + * @return int |
|
40 | + */ |
|
41 | + public function defaultMenuOrder() { |
|
42 | + return 10; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * A menu, to be added to the main application menu. |
|
47 | - * |
|
48 | - * @return Menu|null |
|
49 | - */ |
|
50 | - public function getMenu() { |
|
51 | - global $controller, $WT_TREE; |
|
45 | + /** |
|
46 | + * A menu, to be added to the main application menu. |
|
47 | + * |
|
48 | + * @return Menu|null |
|
49 | + */ |
|
50 | + public function getMenu() { |
|
51 | + global $controller, $WT_TREE; |
|
52 | 52 | |
53 | - $menu = null; |
|
54 | - if (empty($controller)) { |
|
55 | - return null; |
|
56 | - } |
|
53 | + $menu = null; |
|
54 | + if (empty($controller)) { |
|
55 | + return null; |
|
56 | + } |
|
57 | 57 | |
58 | - if (Auth::isEditor($WT_TREE) && method_exists($controller, 'getEditMenu')) { |
|
59 | - $menu = $controller->getEditMenu(); |
|
60 | - } |
|
58 | + if (Auth::isEditor($WT_TREE) && method_exists($controller, 'getEditMenu')) { |
|
59 | + $menu = $controller->getEditMenu(); |
|
60 | + } |
|
61 | 61 | |
62 | - return $menu; |
|
63 | - } |
|
62 | + return $menu; |
|
63 | + } |
|
64 | 64 | } |
@@ -22,14 +22,17 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Class PageMenuModule |
24 | 24 | */ |
25 | -class PageMenuModule extends AbstractModule implements ModuleMenuInterface { |
|
25 | +class PageMenuModule extends AbstractModule implements ModuleMenuInterface |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - public function getTitle() { |
|
28 | + public function getTitle() |
|
29 | + { |
|
28 | 30 | return /* I18N: Name of a module/menu */ I18N::translate('Edit'); |
29 | 31 | } |
30 | 32 | |
31 | 33 | /** {@inheritdoc} */ |
32 | - public function getDescription() { |
|
34 | + public function getDescription() |
|
35 | + { |
|
33 | 36 | return /* I18N: Description of the “Edit” module */ I18N::translate('An edit menu for individuals, families, sources, etc.'); |
34 | 37 | } |
35 | 38 | |
@@ -38,7 +41,8 @@ discard block |
||
38 | 41 | * |
39 | 42 | * @return int |
40 | 43 | */ |
41 | - public function defaultMenuOrder() { |
|
44 | + public function defaultMenuOrder() |
|
45 | + { |
|
42 | 46 | return 10; |
43 | 47 | } |
44 | 48 | |
@@ -47,7 +51,8 @@ discard block |
||
47 | 51 | * |
48 | 52 | * @return Menu|null |
49 | 53 | */ |
50 | - public function getMenu() { |
|
54 | + public function getMenu() |
|
55 | + { |
|
51 | 56 | global $controller, $WT_TREE; |
52 | 57 | |
53 | 58 | $menu = null; |