@@ -67,14 +67,14 @@ |
||
| 67 | 67 | if (strlen($match[1]) > strlen($match[2])) { |
| 68 | 68 | $match[2] = substr($match[1], 0, strlen($match[1]) - strlen($match[2])) . $match[2]; |
| 69 | 69 | } |
| 70 | - $ged_date = new Date("FROM {$cal} {$match[1]} TO {$cal} {$match[2]}"); |
|
| 70 | + $ged_date = new Date("from {$cal} {$match[1]} TO {$cal} {$match[2]}"); |
|
| 71 | 71 | $view = 'year'; |
| 72 | 72 | } else { |
| 73 | 73 | // advanced-year "decade/century wildcard" |
| 74 | 74 | if (preg_match('/^(\d+)(\?+)$/', $year, $match)) { |
| 75 | 75 | $y1 = $match[1] . str_replace('?', '0', $match[2]); |
| 76 | 76 | $y2 = $match[1] . str_replace('?', '9', $match[2]); |
| 77 | - $ged_date = new Date("FROM {$cal} {$y1} TO {$cal} {$y2}"); |
|
| 77 | + $ged_date = new Date("from {$cal} {$y1} TO {$cal} {$y2}"); |
|
| 78 | 78 | $view = 'year'; |
| 79 | 79 | } else { |
| 80 | 80 | if ($year < 0) { |
@@ -113,15 +113,15 @@ discard block |
||
| 113 | 113 | $controller->setPageTitle(I18N::translate('Anniversary calendar')); |
| 114 | 114 | |
| 115 | 115 | switch ($view) { |
| 116 | -case 'day': |
|
| 117 | - $controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false)); |
|
| 118 | - break; |
|
| 119 | -case 'month': |
|
| 120 | - $controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y')); |
|
| 121 | - break; |
|
| 122 | -case 'year': |
|
| 123 | - $controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y')); |
|
| 124 | - break; |
|
| 116 | + case 'day': |
|
| 117 | + $controller->setPageTitle(I18N::translate('On this day…') . ' ' . $ged_date->display(false)); |
|
| 118 | + break; |
|
| 119 | + case 'month': |
|
| 120 | + $controller->setPageTitle(I18N::translate('In this month…') . ' ' . $ged_date->display(false, '%F %Y')); |
|
| 121 | + break; |
|
| 122 | + case 'year': |
|
| 123 | + $controller->setPageTitle(I18N::translate('In this year…') . ' ' . $ged_date->display(false, '%Y')); |
|
| 124 | + break; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Only generate the content for interactive users (not search robots). |
@@ -323,38 +323,38 @@ discard block |
||
| 323 | 323 | $found_facts = []; |
| 324 | 324 | |
| 325 | 325 | switch ($view) { |
| 326 | - case 'day': |
|
| 327 | - $found_facts = apply_filter(FunctionsDb::getAnniversaryEvents($cal_date->minJD, $filterev, $WT_TREE), $filterof, $filtersx); |
|
| 328 | - break; |
|
| 329 | - case 'month': |
|
| 330 | - $cal_date->d = 0; |
|
| 331 | - $cal_date->setJdFromYmd(); |
|
| 332 | - // Make a separate list for each day. Unspecified/invalid days go in day 0. |
|
| 333 | - for ($d = 0; $d <= $days_in_month; ++$d) { |
|
| 334 | - $found_facts[$d] = []; |
|
| 335 | - } |
|
| 336 | - // Fetch events for each day |
|
| 337 | - for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) { |
|
| 338 | - foreach (apply_filter(FunctionsDb::getAnniversaryEvents($jd, $filterev, $WT_TREE), $filterof, $filtersx) as $fact) { |
|
| 339 | - $tmp = $fact->getDate()->minimumDate(); |
|
| 340 | - if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) { |
|
| 341 | - // If the day is valid (for its own calendar), display it in the |
|
| 342 | - // anniversary day (for the display calendar). |
|
| 343 | - $found_facts[$jd - $cal_date->minJD + 1][] = $fact; |
|
| 344 | - } else { |
|
| 345 | - // Otherwise, display it in the "Day not set" box. |
|
| 346 | - $found_facts[0][] = $fact; |
|
| 326 | + case 'day': |
|
| 327 | + $found_facts = apply_filter(FunctionsDb::getAnniversaryEvents($cal_date->minJD, $filterev, $WT_TREE), $filterof, $filtersx); |
|
| 328 | + break; |
|
| 329 | + case 'month': |
|
| 330 | + $cal_date->d = 0; |
|
| 331 | + $cal_date->setJdFromYmd(); |
|
| 332 | + // Make a separate list for each day. Unspecified/invalid days go in day 0. |
|
| 333 | + for ($d = 0; $d <= $days_in_month; ++$d) { |
|
| 334 | + $found_facts[$d] = []; |
|
| 335 | + } |
|
| 336 | + // Fetch events for each day |
|
| 337 | + for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) { |
|
| 338 | + foreach (apply_filter(FunctionsDb::getAnniversaryEvents($jd, $filterev, $WT_TREE), $filterof, $filtersx) as $fact) { |
|
| 339 | + $tmp = $fact->getDate()->minimumDate(); |
|
| 340 | + if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) { |
|
| 341 | + // If the day is valid (for its own calendar), display it in the |
|
| 342 | + // anniversary day (for the display calendar). |
|
| 343 | + $found_facts[$jd - $cal_date->minJD + 1][] = $fact; |
|
| 344 | + } else { |
|
| 345 | + // Otherwise, display it in the "Day not set" box. |
|
| 346 | + $found_facts[0][] = $fact; |
|
| 347 | + } |
|
| 347 | 348 | } |
| 348 | 349 | } |
| 349 | - } |
|
| 350 | - break; |
|
| 351 | - case 'year': |
|
| 352 | - $cal_date->m = 0; |
|
| 353 | - $cal_date->setJdFromYmd(); |
|
| 354 | - $found_facts = apply_filter(FunctionsDb::getCalendarEvents($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $filterev, $WT_TREE), $filterof, $filtersx); |
|
| 355 | - // Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900) |
|
| 356 | - $found_facts = array_unique($found_facts); |
|
| 357 | - break; |
|
| 350 | + break; |
|
| 351 | + case 'year': |
|
| 352 | + $cal_date->m = 0; |
|
| 353 | + $cal_date->setJdFromYmd(); |
|
| 354 | + $found_facts = apply_filter(FunctionsDb::getCalendarEvents($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $filterev, $WT_TREE), $filterof, $filtersx); |
|
| 355 | + // Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900) |
|
| 356 | + $found_facts = array_unique($found_facts); |
|
| 357 | + break; |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | // Group the facts by family/individual |
@@ -363,156 +363,156 @@ discard block |
||
| 363 | 363 | $cal_facts = []; |
| 364 | 364 | |
| 365 | 365 | switch ($view) { |
| 366 | - case 'year': |
|
| 367 | - case 'day': |
|
| 368 | - foreach ($found_facts as $fact) { |
|
| 369 | - $record = $fact->getParent(); |
|
| 370 | - $xref = $record->getXref(); |
|
| 371 | - if ($record instanceof Individual) { |
|
| 372 | - if (empty($indis[$xref])) { |
|
| 373 | - $indis[$xref] = calendar_fact_text($fact, true); |
|
| 374 | - } else { |
|
| 375 | - $indis[$xref] .= '<br>' . calendar_fact_text($fact, true); |
|
| 376 | - } |
|
| 377 | - } elseif ($record instanceof Family) { |
|
| 378 | - if (empty($indis[$xref])) { |
|
| 379 | - $fams[$xref] = calendar_fact_text($fact, true); |
|
| 380 | - } else { |
|
| 381 | - $fams[$xref] .= '<br>' . calendar_fact_text($fact, true); |
|
| 366 | + case 'year': |
|
| 367 | + case 'day': |
|
| 368 | + foreach ($found_facts as $fact) { |
|
| 369 | + $record = $fact->getParent(); |
|
| 370 | + $xref = $record->getXref(); |
|
| 371 | + if ($record instanceof Individual) { |
|
| 372 | + if (empty($indis[$xref])) { |
|
| 373 | + $indis[$xref] = calendar_fact_text($fact, true); |
|
| 374 | + } else { |
|
| 375 | + $indis[$xref] .= '<br>' . calendar_fact_text($fact, true); |
|
| 376 | + } |
|
| 377 | + } elseif ($record instanceof Family) { |
|
| 378 | + if (empty($indis[$xref])) { |
|
| 379 | + $fams[$xref] = calendar_fact_text($fact, true); |
|
| 380 | + } else { |
|
| 381 | + $fams[$xref] .= '<br>' . calendar_fact_text($fact, true); |
|
| 382 | + } |
|
| 382 | 383 | } |
| 383 | 384 | } |
| 384 | - } |
|
| 385 | - break; |
|
| 386 | - case 'month': |
|
| 387 | - foreach ($found_facts as $d => $facts) { |
|
| 388 | - $cal_facts[$d] = []; |
|
| 389 | - foreach ($facts as $fact) { |
|
| 390 | - $xref = $fact->getParent()->getXref(); |
|
| 391 | - if (empty($cal_facts[$d][$xref])) { |
|
| 392 | - $cal_facts[$d][$xref] = calendar_fact_text($fact, false); |
|
| 393 | - } else { |
|
| 394 | - $cal_facts[$d][$xref] .= '<br>' . calendar_fact_text($fact, false); |
|
| 385 | + break; |
|
| 386 | + case 'month': |
|
| 387 | + foreach ($found_facts as $d => $facts) { |
|
| 388 | + $cal_facts[$d] = []; |
|
| 389 | + foreach ($facts as $fact) { |
|
| 390 | + $xref = $fact->getParent()->getXref(); |
|
| 391 | + if (empty($cal_facts[$d][$xref])) { |
|
| 392 | + $cal_facts[$d][$xref] = calendar_fact_text($fact, false); |
|
| 393 | + } else { |
|
| 394 | + $cal_facts[$d][$xref] .= '<br>' . calendar_fact_text($fact, false); |
|
| 395 | + } |
|
| 395 | 396 | } |
| 396 | 397 | } |
| 397 | - } |
|
| 398 | - break; |
|
| 398 | + break; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | switch ($view) { |
| 402 | - case 'year': |
|
| 403 | - case 'day': |
|
| 404 | - $males = 0; |
|
| 405 | - $females = 0; |
|
| 406 | - echo '<table class="width100"><tr>'; |
|
| 407 | - echo '<td class="descriptionbox center width50"><i class="icon-indis"></i>', I18N::translate('Individuals'), '</td>'; |
|
| 408 | - echo '<td class="descriptionbox center width50"><i class="icon-cfamily"></i>', I18N::translate('Families'), '</td>'; |
|
| 409 | - echo '</tr><tr>'; |
|
| 410 | - echo '<td class="optionbox wrap">'; |
|
| 411 | - |
|
| 412 | - $content = calendar_list_text($indis, '<li>', '</li>', true); |
|
| 413 | - if ($content) { |
|
| 414 | - echo '<ul>', $content, '</ul>'; |
|
| 415 | - } |
|
| 402 | + case 'year': |
|
| 403 | + case 'day': |
|
| 404 | + $males = 0; |
|
| 405 | + $females = 0; |
|
| 406 | + echo '<table class="width100"><tr>'; |
|
| 407 | + echo '<td class="descriptionbox center width50"><i class="icon-indis"></i>', I18N::translate('Individuals'), '</td>'; |
|
| 408 | + echo '<td class="descriptionbox center width50"><i class="icon-cfamily"></i>', I18N::translate('Families'), '</td>'; |
|
| 409 | + echo '</tr><tr>'; |
|
| 410 | + echo '<td class="optionbox wrap">'; |
|
| 416 | 411 | |
| 417 | - echo '</td>'; |
|
| 418 | - echo '<td class="optionbox wrap">'; |
|
| 412 | + $content = calendar_list_text($indis, '<li>', '</li>', true); |
|
| 413 | + if ($content) { |
|
| 414 | + echo '<ul>', $content, '</ul>'; |
|
| 415 | + } |
|
| 419 | 416 | |
| 420 | - $content = calendar_list_text($fams, '<li>', '</li>', true); |
|
| 421 | - if ($content) { |
|
| 422 | - echo '<ul>', $content, '</ul>'; |
|
| 423 | - } |
|
| 417 | + echo '</td>'; |
|
| 418 | + echo '<td class="optionbox wrap">'; |
|
| 424 | 419 | |
| 425 | - echo '</td>'; |
|
| 426 | - echo '</tr><tr>'; |
|
| 427 | - echo '<td class="descriptionbox">', I18N::translate('Total individuals: %s', count($indis)); |
|
| 428 | - echo '<br>'; |
|
| 429 | - echo '<i class="icon-sex_m_15x15" title="', I18N::translate('Males'), '"></i> ', $males, ' '; |
|
| 430 | - echo '<i class="icon-sex_f_15x15" title="', I18N::translate('Females'), '"></i> ', $females, ' '; |
|
| 431 | - if (count($indis) !== $males + $females) { |
|
| 432 | - echo '<i class="icon-sex_u_15x15" title="', I18N::translate('All individuals'), '"></i> ', count($indis) - $males - $females; |
|
| 433 | - } |
|
| 434 | - echo '</td>'; |
|
| 435 | - echo '<td class="descriptionbox">', I18N::translate('Total families: %s', count($fams)), '</td>'; |
|
| 436 | - echo '</tr></table>'; |
|
| 420 | + $content = calendar_list_text($fams, '<li>', '</li>', true); |
|
| 421 | + if ($content) { |
|
| 422 | + echo '<ul>', $content, '</ul>'; |
|
| 423 | + } |
|
| 437 | 424 | |
| 438 | - break; |
|
| 439 | - case 'month': |
|
| 440 | -// We use JD%7 = 0/Mon…6/Sun. Standard definitions use 0/Sun…6/Sat. |
|
| 441 | - $week_start = (I18N::firstDay() + 6) % 7; |
|
| 442 | - $weekend_start = (I18N::weekendStart() + 6) % 7; |
|
| 443 | - $weekend_end = (I18N::weekendEnd() + 6) % 7; |
|
| 444 | - // The french calendar has a 10-day week, which starts on primidi |
|
| 445 | - if ($days_in_week === 10) { |
|
| 446 | - $week_start = 0; |
|
| 447 | - $weekend_start = -1; |
|
| 448 | - $weekend_end = -1; |
|
| 449 | - } |
|
| 450 | - echo '<table class="width100"><thead><tr>'; |
|
| 451 | - for ($week_day = 0; $week_day < $days_in_week; ++$week_day) { |
|
| 452 | - $day_name = $cal_date->dayNames(($week_day + $week_start) % $days_in_week); |
|
| 453 | - if ($week_day == $weekend_start || $week_day == $weekend_end) { |
|
| 454 | - echo '<th class="descriptionbox weekend" width="' . (100 / $days_in_week) . '%">', $day_name, '</th>'; |
|
| 455 | - } else { |
|
| 456 | - echo '<th class="descriptionbox" width="' . (100 / $days_in_week) . '%">', $day_name, '</th>'; |
|
| 425 | + echo '</td>'; |
|
| 426 | + echo '</tr><tr>'; |
|
| 427 | + echo '<td class="descriptionbox">', I18N::translate('Total individuals: %s', count($indis)); |
|
| 428 | + echo '<br>'; |
|
| 429 | + echo '<i class="icon-sex_m_15x15" title="', I18N::translate('Males'), '"></i> ', $males, ' '; |
|
| 430 | + echo '<i class="icon-sex_f_15x15" title="', I18N::translate('Females'), '"></i> ', $females, ' '; |
|
| 431 | + if (count($indis) !== $males + $females) { |
|
| 432 | + echo '<i class="icon-sex_u_15x15" title="', I18N::translate('All individuals'), '"></i> ', count($indis) - $males - $females; |
|
| 457 | 433 | } |
| 458 | - } |
|
| 459 | - echo '</tr>'; |
|
| 460 | - echo '</thead>'; |
|
| 461 | - echo '<tbody>'; |
|
| 462 | - // Print days 1 to n of the month, but extend to cover "empty" days before/after the month to make whole weeks. |
|
| 463 | - // e.g. instead of 1 -> 30 (=30 days), we might have -1 -> 33 (=35 days) |
|
| 464 | - $start_d = 1 - ($cal_date->minJD - $week_start) % $days_in_week; |
|
| 465 | - $end_d = $days_in_month + ($days_in_week - ($cal_date->maxJD - $week_start + 1) % $days_in_week) % $days_in_week; |
|
| 466 | - // Make sure that there is an empty box for any leap/missing days |
|
| 467 | - if ($start_d === 1 && $end_d === $days_in_month && count($found_facts[0]) > 0) { |
|
| 468 | - $end_d += $days_in_week; |
|
| 469 | - } |
|
| 470 | - for ($d = $start_d; $d <= $end_d; ++$d) { |
|
| 471 | - if (($d + $cal_date->minJD - $week_start) % $days_in_week === 1) { |
|
| 472 | - echo '<tr>'; |
|
| 434 | + echo '</td>'; |
|
| 435 | + echo '<td class="descriptionbox">', I18N::translate('Total families: %s', count($fams)), '</td>'; |
|
| 436 | + echo '</tr></table>'; |
|
| 437 | + |
|
| 438 | + break; |
|
| 439 | + case 'month': |
|
| 440 | + // We use JD%7 = 0/Mon…6/Sun. Standard definitions use 0/Sun…6/Sat. |
|
| 441 | + $week_start = (I18N::firstDay() + 6) % 7; |
|
| 442 | + $weekend_start = (I18N::weekendStart() + 6) % 7; |
|
| 443 | + $weekend_end = (I18N::weekendEnd() + 6) % 7; |
|
| 444 | + // The french calendar has a 10-day week, which starts on primidi |
|
| 445 | + if ($days_in_week === 10) { |
|
| 446 | + $week_start = 0; |
|
| 447 | + $weekend_start = -1; |
|
| 448 | + $weekend_end = -1; |
|
| 473 | 449 | } |
| 474 | - echo '<td class="optionbox wrap">'; |
|
| 475 | - if ($d < 1 || $d > $days_in_month) { |
|
| 476 | - if (count($cal_facts[0]) > 0) { |
|
| 477 | - echo '<span class="cal_day">', I18N::translate('Day not set'), '</span><br style="clear: both;">'; |
|
| 478 | - echo '<div class="details1" style="height: 180px; overflow: auto;">'; |
|
| 479 | - echo calendar_list_text($cal_facts[0], '', '', false); |
|
| 480 | - echo '</div>'; |
|
| 481 | - $cal_facts[0] = []; |
|
| 482 | - } |
|
| 483 | - } else { |
|
| 484 | - // Format the day number using the calendar |
|
| 485 | - $tmp = new Date($cal_date->format("%@ {$d} %O %E")); |
|
| 486 | - $d_fmt = $tmp->minimumDate()->format('%j'); |
|
| 487 | - if ($d === $today->d && $cal_date->m === $today->m) { |
|
| 488 | - echo '<span class="cal_day current_day">', $d_fmt, '</span>'; |
|
| 450 | + echo '<table class="width100"><thead><tr>'; |
|
| 451 | + for ($week_day = 0; $week_day < $days_in_week; ++$week_day) { |
|
| 452 | + $day_name = $cal_date->dayNames(($week_day + $week_start) % $days_in_week); |
|
| 453 | + if ($week_day == $weekend_start || $week_day == $weekend_end) { |
|
| 454 | + echo '<th class="descriptionbox weekend" width="' . (100 / $days_in_week) . '%">', $day_name, '</th>'; |
|
| 489 | 455 | } else { |
| 490 | - echo '<span class="cal_day">', $d_fmt, '</span>'; |
|
| 456 | + echo '<th class="descriptionbox" width="' . (100 / $days_in_week) . '%">', $day_name, '</th>'; |
|
| 491 | 457 | } |
| 492 | - // Show a converted date |
|
| 493 | - foreach (explode('_and_', $CALENDAR_FORMAT) as $convcal) { |
|
| 494 | - switch ($convcal) { |
|
| 495 | - case 'french': |
|
| 496 | - $alt_date = new FrenchDate($cal_date->minJD + $d - 1); |
|
| 497 | - break; |
|
| 498 | - case 'gregorian': |
|
| 499 | - $alt_date = new GregorianDate($cal_date->minJD + $d - 1); |
|
| 500 | - break; |
|
| 501 | - case 'jewish': |
|
| 502 | - $alt_date = new JewishDate($cal_date->minJD + $d - 1); |
|
| 503 | - break; |
|
| 504 | - case 'julian': |
|
| 505 | - $alt_date = new JulianDate($cal_date->minJD + $d - 1); |
|
| 506 | - break; |
|
| 507 | - case 'hijri': |
|
| 508 | - $alt_date = new HijriDate($cal_date->minJD + $d - 1); |
|
| 509 | - break; |
|
| 510 | - case 'jalali': |
|
| 511 | - $alt_date = new JalaliDate($cal_date->minJD + $d - 1); |
|
| 512 | - break; |
|
| 513 | - default: |
|
| 514 | - break 2; |
|
| 458 | + } |
|
| 459 | + echo '</tr>'; |
|
| 460 | + echo '</thead>'; |
|
| 461 | + echo '<tbody>'; |
|
| 462 | + // Print days 1 to n of the month, but extend to cover "empty" days before/after the month to make whole weeks. |
|
| 463 | + // e.g. instead of 1 -> 30 (=30 days), we might have -1 -> 33 (=35 days) |
|
| 464 | + $start_d = 1 - ($cal_date->minJD - $week_start) % $days_in_week; |
|
| 465 | + $end_d = $days_in_month + ($days_in_week - ($cal_date->maxJD - $week_start + 1) % $days_in_week) % $days_in_week; |
|
| 466 | + // Make sure that there is an empty box for any leap/missing days |
|
| 467 | + if ($start_d === 1 && $end_d === $days_in_month && count($found_facts[0]) > 0) { |
|
| 468 | + $end_d += $days_in_week; |
|
| 469 | + } |
|
| 470 | + for ($d = $start_d; $d <= $end_d; ++$d) { |
|
| 471 | + if (($d + $cal_date->minJD - $week_start) % $days_in_week === 1) { |
|
| 472 | + echo '<tr>'; |
|
| 473 | + } |
|
| 474 | + echo '<td class="optionbox wrap">'; |
|
| 475 | + if ($d < 1 || $d > $days_in_month) { |
|
| 476 | + if (count($cal_facts[0]) > 0) { |
|
| 477 | + echo '<span class="cal_day">', I18N::translate('Day not set'), '</span><br style="clear: both;">'; |
|
| 478 | + echo '<div class="details1" style="height: 180px; overflow: auto;">'; |
|
| 479 | + echo calendar_list_text($cal_facts[0], '', '', false); |
|
| 480 | + echo '</div>'; |
|
| 481 | + $cal_facts[0] = []; |
|
| 482 | + } |
|
| 483 | + } else { |
|
| 484 | + // Format the day number using the calendar |
|
| 485 | + $tmp = new Date($cal_date->format("%@ {$d} %O %E")); |
|
| 486 | + $d_fmt = $tmp->minimumDate()->format('%j'); |
|
| 487 | + if ($d === $today->d && $cal_date->m === $today->m) { |
|
| 488 | + echo '<span class="cal_day current_day">', $d_fmt, '</span>'; |
|
| 489 | + } else { |
|
| 490 | + echo '<span class="cal_day">', $d_fmt, '</span>'; |
|
| 515 | 491 | } |
| 492 | + // Show a converted date |
|
| 493 | + foreach (explode('_and_', $CALENDAR_FORMAT) as $convcal) { |
|
| 494 | + switch ($convcal) { |
|
| 495 | + case 'french': |
|
| 496 | + $alt_date = new FrenchDate($cal_date->minJD + $d - 1); |
|
| 497 | + break; |
|
| 498 | + case 'gregorian': |
|
| 499 | + $alt_date = new GregorianDate($cal_date->minJD + $d - 1); |
|
| 500 | + break; |
|
| 501 | + case 'jewish': |
|
| 502 | + $alt_date = new JewishDate($cal_date->minJD + $d - 1); |
|
| 503 | + break; |
|
| 504 | + case 'julian': |
|
| 505 | + $alt_date = new JulianDate($cal_date->minJD + $d - 1); |
|
| 506 | + break; |
|
| 507 | + case 'hijri': |
|
| 508 | + $alt_date = new HijriDate($cal_date->minJD + $d - 1); |
|
| 509 | + break; |
|
| 510 | + case 'jalali': |
|
| 511 | + $alt_date = new JalaliDate($cal_date->minJD + $d - 1); |
|
| 512 | + break; |
|
| 513 | + default: |
|
| 514 | + break 2; |
|
| 515 | + } |
|
| 516 | 516 | if (get_class($alt_date) !== get_class($cal_date) && $alt_date->inValidRange()) { |
| 517 | 517 | echo '<span class="rtl_cal_day">' . $alt_date->format('%j %M') . '</span>'; |
| 518 | 518 | // Just show the first conversion |
@@ -643,17 +643,17 @@ discard block |
||
| 643 | 643 | $html .= $tag1 . '<a href="' . $tmp->getHtmlUrl() . '">' . $tmp->getFullName() . '</a> '; |
| 644 | 644 | if ($show_sex_symbols && $tmp instanceof Individual) { |
| 645 | 645 | switch ($tmp->getSex()) { |
| 646 | - case 'M': |
|
| 647 | - $html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>'; |
|
| 648 | - ++$males; |
|
| 649 | - break; |
|
| 650 | - case 'F': |
|
| 651 | - $html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>'; |
|
| 652 | - ++$females; |
|
| 653 | - break; |
|
| 654 | - default: |
|
| 655 | - $html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>'; |
|
| 656 | - break; |
|
| 646 | + case 'M': |
|
| 647 | + $html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>'; |
|
| 648 | + ++$males; |
|
| 649 | + break; |
|
| 650 | + case 'F': |
|
| 651 | + $html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>'; |
|
| 652 | + ++$females; |
|
| 653 | + break; |
|
| 654 | + default: |
|
| 655 | + $html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>'; |
|
| 656 | + break; |
|
| 657 | 657 | } |
| 658 | 658 | } |
| 659 | 659 | $html .= '<div class="indent">' . $facts . '</div>' . $tag2; |
@@ -770,13 +770,15 @@ |
||
| 770 | 770 | <p> |
| 771 | 771 | <?php if ($ucnt): ?> |
| 772 | 772 | <input type="submit" value="<?= I18N::translate('delete') ?>"> |
| 773 | - <?php else: ?> |
|
| 773 | + <?php else { |
|
| 774 | + : ?> |
|
| 774 | 775 | <?= I18N::translate('Nothing found to cleanup') ?> |
| 775 | 776 | <?php endif ?> |
| 776 | 777 | </p> |
| 777 | 778 | </form> |
| 778 | 779 | <?php |
| 779 | 780 | break; |
| 781 | +} |
|
| 780 | 782 | |
| 781 | 783 | case 'cleanup2': |
| 782 | 784 | foreach (User::all() as $user) { |
@@ -41,108 +41,108 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Form actions |
| 43 | 43 | switch (Filter::post('action')) { |
| 44 | -case 'save': |
|
| 45 | - if (Filter::checkCsrf()) { |
|
| 46 | - $user_id = Filter::postInteger('user_id'); |
|
| 47 | - $user = User::find($user_id); |
|
| 48 | - $username = Filter::post('username'); |
|
| 49 | - $real_name = Filter::post('real_name'); |
|
| 50 | - $email = Filter::post('email'); |
|
| 51 | - $pass1 = Filter::post('pass1', WT_REGEX_PASSWORD); |
|
| 52 | - $pass2 = Filter::post('pass2', WT_REGEX_PASSWORD); |
|
| 53 | - $theme = Filter::post('theme', implode('|', array_keys(Theme::themeNames())), ''); |
|
| 54 | - $language = Filter::post('language'); |
|
| 55 | - $timezone = Filter::post('timezone'); |
|
| 56 | - $contact_method = Filter::post('contact_method'); |
|
| 57 | - $comment = Filter::post('comment'); |
|
| 58 | - $auto_accept = Filter::postBool('auto_accept'); |
|
| 59 | - $canadmin = Filter::postBool('canadmin'); |
|
| 60 | - $visible_online = Filter::postBool('visible_online'); |
|
| 61 | - $verified = Filter::postBool('verified'); |
|
| 62 | - $approved = Filter::postBool('approved'); |
|
| 63 | - |
|
| 64 | - if ($user_id === 0) { |
|
| 65 | - // Create a new user |
|
| 66 | - if (User::findByUserName($username)) { |
|
| 67 | - FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.')); |
|
| 68 | - } elseif (User::findByEmail($email)) { |
|
| 69 | - FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.')); |
|
| 70 | - } elseif ($pass1 !== $pass2) { |
|
| 71 | - FlashMessages::addMessage(I18N::translate('The passwords do not match.')); |
|
| 44 | + case 'save': |
|
| 45 | + if (Filter::checkCsrf()) { |
|
| 46 | + $user_id = Filter::postInteger('user_id'); |
|
| 47 | + $user = User::find($user_id); |
|
| 48 | + $username = Filter::post('username'); |
|
| 49 | + $real_name = Filter::post('real_name'); |
|
| 50 | + $email = Filter::post('email'); |
|
| 51 | + $pass1 = Filter::post('pass1', WT_REGEX_PASSWORD); |
|
| 52 | + $pass2 = Filter::post('pass2', WT_REGEX_PASSWORD); |
|
| 53 | + $theme = Filter::post('theme', implode('|', array_keys(Theme::themeNames())), ''); |
|
| 54 | + $language = Filter::post('language'); |
|
| 55 | + $timezone = Filter::post('timezone'); |
|
| 56 | + $contact_method = Filter::post('contact_method'); |
|
| 57 | + $comment = Filter::post('comment'); |
|
| 58 | + $auto_accept = Filter::postBool('auto_accept'); |
|
| 59 | + $canadmin = Filter::postBool('canadmin'); |
|
| 60 | + $visible_online = Filter::postBool('visible_online'); |
|
| 61 | + $verified = Filter::postBool('verified'); |
|
| 62 | + $approved = Filter::postBool('approved'); |
|
| 63 | + |
|
| 64 | + if ($user_id === 0) { |
|
| 65 | + // Create a new user |
|
| 66 | + if (User::findByUserName($username)) { |
|
| 67 | + FlashMessages::addMessage(I18N::translate('Duplicate username. A user with that username already exists. Please choose another username.')); |
|
| 68 | + } elseif (User::findByEmail($email)) { |
|
| 69 | + FlashMessages::addMessage(I18N::translate('Duplicate email address. A user with that email already exists.')); |
|
| 70 | + } elseif ($pass1 !== $pass2) { |
|
| 71 | + FlashMessages::addMessage(I18N::translate('The passwords do not match.')); |
|
| 72 | + } else { |
|
| 73 | + $user = User::create($username, $real_name, $email, $pass1); |
|
| 74 | + $user->setPreference('reg_timestamp', date('U'))->setPreference('sessiontime', '0'); |
|
| 75 | + Log::addAuthenticationLog('User ->' . $username . '<- created'); |
|
| 76 | + } |
|
| 72 | 77 | } else { |
| 73 | - $user = User::create($username, $real_name, $email, $pass1); |
|
| 74 | - $user->setPreference('reg_timestamp', date('U'))->setPreference('sessiontime', '0'); |
|
| 75 | - Log::addAuthenticationLog('User ->' . $username . '<- created'); |
|
| 76 | - } |
|
| 77 | - } else { |
|
| 78 | - $user = User::find($user_id); |
|
| 79 | - if ($user && $username && $real_name) { |
|
| 80 | - $user->setEmail($email); |
|
| 81 | - $user->setUserName($username); |
|
| 82 | - $user->setRealName($real_name); |
|
| 83 | - if ($pass1 !== null && $pass1 === $pass2) { |
|
| 84 | - $user->setPassword($pass1); |
|
| 78 | + $user = User::find($user_id); |
|
| 79 | + if ($user && $username && $real_name) { |
|
| 80 | + $user->setEmail($email); |
|
| 81 | + $user->setUserName($username); |
|
| 82 | + $user->setRealName($real_name); |
|
| 83 | + if ($pass1 !== null && $pass1 === $pass2) { |
|
| 84 | + $user->setPassword($pass1); |
|
| 85 | + } |
|
| 85 | 86 | } |
| 86 | 87 | } |
| 87 | - } |
|
| 88 | 88 | |
| 89 | - if ($user) { |
|
| 90 | - // Approving for the first time? Send a confirmation email |
|
| 91 | - if ($approved && !$user->getPreference('verified_by_admin') && $user->getPreference('sessiontime') == 0) { |
|
| 92 | - I18N::init($user->getPreference('language')); |
|
| 93 | - |
|
| 94 | - // Create a dummy user, so we can send messages from the tree. |
|
| 95 | - $sender = new User( |
|
| 96 | - (object) [ |
|
| 97 | - 'user_id' => null, |
|
| 98 | - 'user_name' => '', |
|
| 99 | - 'real_name' => $WT_TREE->getTitle(), |
|
| 100 | - 'email' => $WT_TREE->getPreference('WEBTREES_EMAIL'), |
|
| 101 | - ] |
|
| 102 | - ); |
|
| 103 | - |
|
| 104 | - Mail::send( |
|
| 105 | - $sender, |
|
| 106 | - $user, |
|
| 107 | - $sender, |
|
| 108 | - I18N::translate('Approval of account at %s', WT_BASE_URL), |
|
| 109 | - View::make('emails/approve-user-text', ['user' => $user]), |
|
| 110 | - View::make('emails/approve-user-html', ['user' => $user]) |
|
| 111 | - ); |
|
| 112 | - } |
|
| 89 | + if ($user) { |
|
| 90 | + // Approving for the first time? Send a confirmation email |
|
| 91 | + if ($approved && !$user->getPreference('verified_by_admin') && $user->getPreference('sessiontime') == 0) { |
|
| 92 | + I18N::init($user->getPreference('language')); |
|
| 93 | + |
|
| 94 | + // Create a dummy user, so we can send messages from the tree. |
|
| 95 | + $sender = new User( |
|
| 96 | + (object) [ |
|
| 97 | + 'user_id' => null, |
|
| 98 | + 'user_name' => '', |
|
| 99 | + 'real_name' => $WT_TREE->getTitle(), |
|
| 100 | + 'email' => $WT_TREE->getPreference('WEBTREES_EMAIL'), |
|
| 101 | + ] |
|
| 102 | + ); |
|
| 103 | + |
|
| 104 | + Mail::send( |
|
| 105 | + $sender, |
|
| 106 | + $user, |
|
| 107 | + $sender, |
|
| 108 | + I18N::translate('Approval of account at %s', WT_BASE_URL), |
|
| 109 | + View::make('emails/approve-user-text', ['user' => $user]), |
|
| 110 | + View::make('emails/approve-user-html', ['user' => $user]) |
|
| 111 | + ); |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - $user |
|
| 115 | - ->setPreference('theme', $theme) |
|
| 116 | - ->setPreference('language', $language) |
|
| 117 | - ->setPreference('TIMEZONE', $timezone) |
|
| 118 | - ->setPreference('contactmethod', $contact_method) |
|
| 119 | - ->setPreference('comment', $comment) |
|
| 120 | - ->setPreference('auto_accept', $auto_accept ? '1' : '0') |
|
| 121 | - ->setPreference('visibleonline', $visible_online ? '1' : '0') |
|
| 122 | - ->setPreference('verified', $verified ? '1' : '0') |
|
| 123 | - ->setPreference('verified_by_admin', $approved ? '1' : '0'); |
|
| 124 | - |
|
| 125 | - // We cannot change our own admin status. Another admin will need to do it. |
|
| 126 | - if ($user->getUserId() !== Auth::id()) { |
|
| 127 | - $user->setPreference('canadmin', $canadmin ? '1' : '0'); |
|
| 128 | - } |
|
| 114 | + $user |
|
| 115 | + ->setPreference('theme', $theme) |
|
| 116 | + ->setPreference('language', $language) |
|
| 117 | + ->setPreference('TIMEZONE', $timezone) |
|
| 118 | + ->setPreference('contactmethod', $contact_method) |
|
| 119 | + ->setPreference('comment', $comment) |
|
| 120 | + ->setPreference('auto_accept', $auto_accept ? '1' : '0') |
|
| 121 | + ->setPreference('visibleonline', $visible_online ? '1' : '0') |
|
| 122 | + ->setPreference('verified', $verified ? '1' : '0') |
|
| 123 | + ->setPreference('verified_by_admin', $approved ? '1' : '0'); |
|
| 124 | + |
|
| 125 | + // We cannot change our own admin status. Another admin will need to do it. |
|
| 126 | + if ($user->getUserId() !== Auth::id()) { |
|
| 127 | + $user->setPreference('canadmin', $canadmin ? '1' : '0'); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - foreach (Tree::getAll() as $tree) { |
|
| 131 | - $tree->setUserPreference($user, 'gedcomid', Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF)); |
|
| 132 | - $tree->setUserPreference($user, 'canedit', Filter::post('canedit' . $tree->getTreeId(), implode('|', array_keys($ALL_EDIT_OPTIONS)))); |
|
| 133 | - if (Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF)) { |
|
| 134 | - $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->getTreeId(), 0, 10, 0)); |
|
| 135 | - } else { |
|
| 136 | - // Do not allow a path length to be set if the individual ID is not |
|
| 137 | - $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', null); |
|
| 130 | + foreach (Tree::getAll() as $tree) { |
|
| 131 | + $tree->setUserPreference($user, 'gedcomid', Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF)); |
|
| 132 | + $tree->setUserPreference($user, 'canedit', Filter::post('canedit' . $tree->getTreeId(), implode('|', array_keys($ALL_EDIT_OPTIONS)))); |
|
| 133 | + if (Filter::post('gedcomid' . $tree->getTreeId(), WT_REGEX_XREF)) { |
|
| 134 | + $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', Filter::postInteger('RELATIONSHIP_PATH_LENGTH' . $tree->getTreeId(), 0, 10, 0)); |
|
| 135 | + } else { |
|
| 136 | + // Do not allow a path length to be set if the individual ID is not |
|
| 137 | + $tree->setUserPreference($user, 'RELATIONSHIP_PATH_LENGTH', null); |
|
| 138 | + } |
|
| 138 | 139 | } |
| 139 | 140 | } |
| 140 | 141 | } |
| 141 | - } |
|
| 142 | 142 | |
| 143 | - header('Location: admin_users.php'); |
|
| 143 | + header('Location: admin_users.php'); |
|
| 144 | 144 | |
| 145 | - return; |
|
| 145 | + return; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | switch (Filter::get('action')) { |
@@ -182,12 +182,12 @@ discard block |
||
| 182 | 182 | // Datatables numbers columns 0, 1, 2 |
| 183 | 183 | // MySQL numbers columns 1, 2, 3 |
| 184 | 184 | switch ($value['dir']) { |
| 185 | - case 'asc': |
|
| 186 | - $sql_select .= (1 + $value['column']) . " ASC "; |
|
| 187 | - break; |
|
| 188 | - case 'desc': |
|
| 189 | - $sql_select .= (1 + $value['column']) . " DESC "; |
|
| 190 | - break; |
|
| 185 | + case 'asc': |
|
| 186 | + $sql_select .= (1 + $value['column']) . " ASC "; |
|
| 187 | + break; |
|
| 188 | + case 'desc': |
|
| 189 | + $sql_select .= (1 + $value['column']) . " DESC "; |
|
| 190 | + break; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | } else { |
@@ -235,7 +235,8 @@ discard block |
||
| 235 | 235 | <?php // Reset - otherwise we might "undo all changes", which refreshes the ?> |
| 236 | 236 | <?php // page, which makes them all again! ?> |
| 237 | 237 | <script>reset_reload();</script> |
| 238 | - <?php else: ?> |
|
| 238 | + <?php else { |
|
| 239 | + : ?> |
|
| 239 | 240 | <hr> |
| 240 | 241 | <div id="batch_update2" class="col-sm-12"> |
| 241 | 242 | <?php if ($this->curr_xref): ?> |
@@ -273,6 +274,7 @@ discard block |
||
| 273 | 274 | foreach (array_keys($this->all_xrefs) as $key) { |
| 274 | 275 | if ($key > $xref) { |
| 275 | 276 | $record = self::getLatestRecord($key, $this->all_xrefs[$key]); |
| 277 | +} |
|
| 276 | 278 | if ($this->PLUGIN->doesRecordNeedUpdate($key, $record)) { |
| 277 | 279 | return $key; |
| 278 | 280 | } |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function modAction($mod_action) { |
| 97 | 97 | switch ($mod_action) { |
| 98 | - case 'admin_batch_update': |
|
| 99 | - echo $this->main(); |
|
| 100 | - break; |
|
| 98 | + case 'admin_batch_update': |
|
| 99 | + echo $this->main(); |
|
| 100 | + break; |
|
| 101 | 101 | |
| 102 | - default: |
|
| 103 | - http_response_code(404); |
|
| 104 | - break; |
|
| 102 | + default: |
|
| 103 | + http_response_code(404); |
|
| 104 | + break; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
@@ -126,36 +126,36 @@ discard block |
||
| 126 | 126 | $this->getAllXrefs(); |
| 127 | 127 | |
| 128 | 128 | switch ($this->action) { |
| 129 | - case 'update': |
|
| 130 | - $record = self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]); |
|
| 131 | - if ($this->PLUGIN->doesRecordNeedUpdate($this->xref, $record)) { |
|
| 132 | - $newrecord = $this->PLUGIN->updateRecord($this->xref, $record); |
|
| 133 | - if ($newrecord != $record) { |
|
| 134 | - if ($newrecord) { |
|
| 135 | - GedcomRecord::getInstance($this->xref, $WT_TREE)->updateRecord($newrecord, !$this->PLUGIN->chan); |
|
| 136 | - } else { |
|
| 137 | - GedcomRecord::getInstance($this->xref, $WT_TREE)->deleteRecord(); |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - } |
|
| 141 | - $this->xref = $this->findNextXref($this->xref); |
|
| 142 | - break; |
|
| 143 | - case 'update_all': |
|
| 144 | - foreach ($this->all_xrefs as $xref => $type) { |
|
| 145 | - $record = self::getLatestRecord($xref, $type); |
|
| 146 | - if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) { |
|
| 147 | - $newrecord = $this->PLUGIN->updateRecord($xref, $record); |
|
| 129 | + case 'update': |
|
| 130 | + $record = self::getLatestRecord($this->xref, $this->all_xrefs[$this->xref]); |
|
| 131 | + if ($this->PLUGIN->doesRecordNeedUpdate($this->xref, $record)) { |
|
| 132 | + $newrecord = $this->PLUGIN->updateRecord($this->xref, $record); |
|
| 148 | 133 | if ($newrecord != $record) { |
| 149 | 134 | if ($newrecord) { |
| 150 | - GedcomRecord::getInstance($xref, $WT_TREE)->updateRecord($newrecord, !$this->PLUGIN->chan); |
|
| 135 | + GedcomRecord::getInstance($this->xref, $WT_TREE)->updateRecord($newrecord, !$this->PLUGIN->chan); |
|
| 151 | 136 | } else { |
| 152 | - GedcomRecord::getInstance($xref, $WT_TREE)->deleteRecord(); |
|
| 137 | + GedcomRecord::getInstance($this->xref, $WT_TREE)->deleteRecord(); |
|
| 153 | 138 | } |
| 154 | 139 | } |
| 155 | 140 | } |
| 156 | - } |
|
| 157 | - $this->xref = ''; |
|
| 158 | - break; |
|
| 141 | + $this->xref = $this->findNextXref($this->xref); |
|
| 142 | + break; |
|
| 143 | + case 'update_all': |
|
| 144 | + foreach ($this->all_xrefs as $xref => $type) { |
|
| 145 | + $record = self::getLatestRecord($xref, $type); |
|
| 146 | + if ($this->PLUGIN->doesRecordNeedUpdate($xref, $record)) { |
|
| 147 | + $newrecord = $this->PLUGIN->updateRecord($xref, $record); |
|
| 148 | + if ($newrecord != $record) { |
|
| 149 | + if ($newrecord) { |
|
| 150 | + GedcomRecord::getInstance($xref, $WT_TREE)->updateRecord($newrecord, !$this->PLUGIN->chan); |
|
| 151 | + } else { |
|
| 152 | + GedcomRecord::getInstance($xref, $WT_TREE)->deleteRecord(); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | + $this->xref = ''; |
|
| 158 | + break; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // Make sure that our requested record really does need updating. |
@@ -313,28 +313,28 @@ discard block |
||
| 313 | 313 | $vars = []; |
| 314 | 314 | foreach ($this->PLUGIN->getRecordTypesToUpdate() as $type) { |
| 315 | 315 | switch ($type) { |
| 316 | - case 'INDI': |
|
| 317 | - $sql[] = "SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?"; |
|
| 318 | - $vars[] = $WT_TREE->getTreeId(); |
|
| 319 | - break; |
|
| 320 | - case 'FAM': |
|
| 321 | - $sql[] = "SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?"; |
|
| 322 | - $vars[] = $WT_TREE->getTreeId(); |
|
| 323 | - break; |
|
| 324 | - case 'SOUR': |
|
| 325 | - $sql[] = "SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?"; |
|
| 326 | - $vars[] = $WT_TREE->getTreeId(); |
|
| 327 | - break; |
|
| 328 | - case 'OBJE': |
|
| 329 | - $sql[] = "SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?"; |
|
| 330 | - $vars[] = $WT_TREE->getTreeId(); |
|
| 331 | - break; |
|
| 332 | - default: |
|
| 333 | - $sql[] = "SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?"; |
|
| 334 | - $vars[] = $type; |
|
| 335 | - $vars[] = $type; |
|
| 336 | - $vars[] = $WT_TREE->getTreeId(); |
|
| 337 | - break; |
|
| 316 | + case 'INDI': |
|
| 317 | + $sql[] = "SELECT i_id, 'INDI' FROM `##individuals` WHERE i_file=?"; |
|
| 318 | + $vars[] = $WT_TREE->getTreeId(); |
|
| 319 | + break; |
|
| 320 | + case 'FAM': |
|
| 321 | + $sql[] = "SELECT f_id, 'FAM' FROM `##families` WHERE f_file=?"; |
|
| 322 | + $vars[] = $WT_TREE->getTreeId(); |
|
| 323 | + break; |
|
| 324 | + case 'SOUR': |
|
| 325 | + $sql[] = "SELECT s_id, 'SOUR' FROM `##sources` WHERE s_file=?"; |
|
| 326 | + $vars[] = $WT_TREE->getTreeId(); |
|
| 327 | + break; |
|
| 328 | + case 'OBJE': |
|
| 329 | + $sql[] = "SELECT m_id, 'OBJE' FROM `##media` WHERE m_file=?"; |
|
| 330 | + $vars[] = $WT_TREE->getTreeId(); |
|
| 331 | + break; |
|
| 332 | + default: |
|
| 333 | + $sql[] = "SELECT o_id, ? FROM `##other` WHERE o_type=? AND o_file=?"; |
|
| 334 | + $vars[] = $type; |
|
| 335 | + $vars[] = $type; |
|
| 336 | + $vars[] = $WT_TREE->getTreeId(); |
|
| 337 | + break; |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | $this->all_xrefs = Database::prepare(implode(' UNION ', $sql) . ' ORDER BY 1 ASC') |
@@ -410,20 +410,20 @@ discard block |
||
| 410 | 410 | global $WT_TREE; |
| 411 | 411 | |
| 412 | 412 | switch ($type) { |
| 413 | - case 'INDI': |
|
| 414 | - return Individual::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 415 | - case 'FAM': |
|
| 416 | - return Family::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 417 | - case 'SOUR': |
|
| 418 | - return Source::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 419 | - case 'REPO': |
|
| 420 | - return Repository::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 421 | - case 'OBJE': |
|
| 422 | - return Media::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 423 | - case 'NOTE': |
|
| 424 | - return Note::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 425 | - default: |
|
| 426 | - return GedcomRecord::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 413 | + case 'INDI': |
|
| 414 | + return Individual::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 415 | + case 'FAM': |
|
| 416 | + return Family::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 417 | + case 'SOUR': |
|
| 418 | + return Source::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 419 | + case 'REPO': |
|
| 420 | + return Repository::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 421 | + case 'OBJE': |
|
| 422 | + return Media::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 423 | + case 'NOTE': |
|
| 424 | + return Note::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 425 | + default: |
|
| 426 | + return GedcomRecord::getInstance($xref, $WT_TREE)->getGedcom(); |
|
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | |
@@ -381,7 +381,8 @@ discard block |
||
| 381 | 381 | <a href="<?= $individual->getHtmlUrl() ?>#tab-stories"> |
| 382 | 382 | <?= $individual->getFullName() ?> |
| 383 | 383 | </a> |
| 384 | - <?php else: ?> |
|
| 384 | + <?php else { |
|
| 385 | + : ?> |
|
| 385 | 386 | <?= $story->xref ?> |
| 386 | 387 | <?php endif ?> |
| 387 | 388 | </td> |
@@ -410,6 +411,7 @@ discard block |
||
| 410 | 411 | */ |
| 411 | 412 | private function showList() { |
| 412 | 413 | global $controller, $WT_TREE; |
| 414 | +} |
|
| 413 | 415 | |
| 414 | 416 | $controller = new PageController; |
| 415 | 417 | $controller |
@@ -50,21 +50,21 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function modAction($mod_action) { |
| 52 | 52 | switch ($mod_action) { |
| 53 | - case 'admin_edit': |
|
| 54 | - $this->edit(); |
|
| 55 | - break; |
|
| 56 | - case 'admin_delete': |
|
| 57 | - $this->delete(); |
|
| 58 | - $this->config(); |
|
| 59 | - break; |
|
| 60 | - case 'admin_config': |
|
| 61 | - $this->config(); |
|
| 62 | - break; |
|
| 63 | - case 'show_list': |
|
| 64 | - $this->showList(); |
|
| 65 | - break; |
|
| 66 | - default: |
|
| 67 | - http_response_code(404); |
|
| 53 | + case 'admin_edit': |
|
| 54 | + $this->edit(); |
|
| 55 | + break; |
|
| 56 | + case 'admin_delete': |
|
| 57 | + $this->delete(); |
|
| 58 | + $this->config(); |
|
| 59 | + break; |
|
| 60 | + case 'admin_config': |
|
| 61 | + $this->config(); |
|
| 62 | + break; |
|
| 63 | + case 'show_list': |
|
| 64 | + $this->showList(); |
|
| 65 | + break; |
|
| 66 | + default: |
|
| 67 | + http_response_code(404); |
|
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
@@ -200,7 +200,8 @@ discard block |
||
| 200 | 200 | <div class="tab-pane fade show active" role="tabpanel" id="individuals"> |
| 201 | 201 | <?php if (empty($myindilist)): ?> |
| 202 | 202 | <p><?= I18N::translate('No results found.') ?></p> |
| 203 | - <?php else: ?> |
|
| 203 | + <?php else { |
|
| 204 | + : ?> |
|
| 204 | 205 | <?= FunctionsPrintLists::individualTable($myindilist) ?> |
| 205 | 206 | <?php endif ?> |
| 206 | 207 | </div> |
@@ -216,6 +217,7 @@ discard block |
||
| 216 | 217 | <?php |
| 217 | 218 | } |
| 218 | 219 | echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>'; |
| 220 | +} |
|
| 219 | 221 | |
| 220 | 222 | if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
| 221 | 223 | $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names); |
@@ -46,181 +46,181 @@ |
||
| 46 | 46 | echo '<div id="place-hierarchy">'; |
| 47 | 47 | |
| 48 | 48 | switch ($display) { |
| 49 | -case 'list': |
|
| 50 | - echo '<h2>', $controller->getPageTitle(), '</h2>'; |
|
| 51 | - $list_places = Place::allPlaces($WT_TREE); |
|
| 52 | - $numfound = count($list_places); |
|
| 49 | + case 'list': |
|
| 50 | + echo '<h2>', $controller->getPageTitle(), '</h2>'; |
|
| 51 | + $list_places = Place::allPlaces($WT_TREE); |
|
| 52 | + $numfound = count($list_places); |
|
| 53 | 53 | |
| 54 | - $divisor = $numfound > 20 ? 3 : 2; |
|
| 54 | + $divisor = $numfound > 20 ? 3 : 2; |
|
| 55 | 55 | |
| 56 | - if ($numfound === 0) { |
|
| 57 | - echo '<b>', I18N::translate('No results found.'), '</b><br>'; |
|
| 58 | - } else { |
|
| 59 | - $columns = array_chunk($list_places, ceil($numfound / $divisor)); |
|
| 60 | - |
|
| 61 | - $html = '<table class="list_table"><thead>'; |
|
| 62 | - $html .= '<tr><th class="list_label" colspan="' . $divisor . '">'; |
|
| 63 | - $html .= '<i class="icon-place"></i> ' . I18N::translate('Place list'); |
|
| 64 | - $html .= '</th></tr></thead>'; |
|
| 65 | - $html .= '<tbody><tr>'; |
|
| 66 | - foreach ($columns as $column) { |
|
| 67 | - $html .= '<td class="list_value_wrap"><ul>'; |
|
| 68 | - foreach ($column as $item) { |
|
| 69 | - $html .= '<li><a href="' . $item->getURL() . '">' . $item->getReverseName() . '</a></li>'; |
|
| 56 | + if ($numfound === 0) { |
|
| 57 | + echo '<b>', I18N::translate('No results found.'), '</b><br>'; |
|
| 58 | + } else { |
|
| 59 | + $columns = array_chunk($list_places, ceil($numfound / $divisor)); |
|
| 60 | + |
|
| 61 | + $html = '<table class="list_table"><thead>'; |
|
| 62 | + $html .= '<tr><th class="list_label" colspan="' . $divisor . '">'; |
|
| 63 | + $html .= '<i class="icon-place"></i> ' . I18N::translate('Place list'); |
|
| 64 | + $html .= '</th></tr></thead>'; |
|
| 65 | + $html .= '<tbody><tr>'; |
|
| 66 | + foreach ($columns as $column) { |
|
| 67 | + $html .= '<td class="list_value_wrap"><ul>'; |
|
| 68 | + foreach ($column as $item) { |
|
| 69 | + $html .= '<li><a href="' . $item->getURL() . '">' . $item->getReverseName() . '</a></li>'; |
|
| 70 | + } |
|
| 71 | + $html .= '</ul></td>'; |
|
| 70 | 72 | } |
| 71 | - $html .= '</ul></td>'; |
|
| 73 | + $html .= '</tr></tbody></table>'; |
|
| 74 | + echo $html; |
|
| 72 | 75 | } |
| 73 | - $html .= '</tr></tbody></table>'; |
|
| 74 | - echo $html; |
|
| 75 | - } |
|
| 76 | - echo '<h4><a href="placelist.php?display=hierarchy">', I18N::translate('Show places in hierarchy'), '</a></h4>'; |
|
| 77 | - break; |
|
| 78 | -case 'hierarchy': |
|
| 79 | - $gm_module = Module::getModuleByName('googlemap'); |
|
| 76 | + echo '<h4><a href="placelist.php?display=hierarchy">', I18N::translate('Show places in hierarchy'), '</a></h4>'; |
|
| 77 | + break; |
|
| 78 | + case 'hierarchy': |
|
| 79 | + $gm_module = Module::getModuleByName('googlemap'); |
|
| 80 | 80 | |
| 81 | - // Find this place and its ID |
|
| 82 | - $place = new Place(implode(', ', array_reverse($parent)), $WT_TREE); |
|
| 83 | - $place_id = $place->getPlaceId(); |
|
| 81 | + // Find this place and its ID |
|
| 82 | + $place = new Place(implode(', ', array_reverse($parent)), $WT_TREE); |
|
| 83 | + $place_id = $place->getPlaceId(); |
|
| 84 | 84 | |
| 85 | - $child_places = $place->getChildPlaces(); |
|
| 85 | + $child_places = $place->getChildPlaces(); |
|
| 86 | 86 | |
| 87 | - $numfound = count($child_places); |
|
| 87 | + $numfound = count($child_places); |
|
| 88 | 88 | |
| 89 | - //-- if the number of places found is 0 then automatically redirect to search page |
|
| 90 | - if ($numfound === 0) { |
|
| 91 | - $action = 'show'; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - echo '<h2>', $controller->getPageTitle(); |
|
| 95 | - // Breadcrumbs |
|
| 96 | - if ($place_id) { |
|
| 97 | - $parent_place = $place->getParentPlace(); |
|
| 98 | - while ($parent_place->getPlaceId()) { |
|
| 99 | - echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>'; |
|
| 100 | - $parent_place = $parent_place->getParentPlace(); |
|
| 89 | + //-- if the number of places found is 0 then automatically redirect to search page |
|
| 90 | + if ($numfound === 0) { |
|
| 91 | + $action = 'show'; |
|
| 101 | 92 | } |
| 102 | - echo ', <a href="placelist.php">', I18N::translate('Top level'), '</a>'; |
|
| 103 | - } |
|
| 104 | - echo '</h2>'; |
|
| 105 | 93 | |
| 106 | - if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
|
| 107 | - $linklevels = ''; |
|
| 108 | - $place_names = []; |
|
| 109 | - for ($j = 0; $j < $level; $j++) { |
|
| 110 | - $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); |
|
| 94 | + echo '<h2>', $controller->getPageTitle(); |
|
| 95 | + // Breadcrumbs |
|
| 96 | + if ($place_id) { |
|
| 97 | + $parent_place = $place->getParentPlace(); |
|
| 98 | + while ($parent_place->getPlaceId()) { |
|
| 99 | + echo ', <a href="', $parent_place->getURL(), '" dir="auto">', $parent_place->getPlaceName(), '</a>'; |
|
| 100 | + $parent_place = $parent_place->getParentPlace(); |
|
| 101 | + } |
|
| 102 | + echo ', <a href="placelist.php">', I18N::translate('Top level'), '</a>'; |
|
| 111 | 103 | } |
| 104 | + echo '</h2>'; |
|
| 112 | 105 | |
| 113 | - $gm_module->createMap(); |
|
| 114 | - } elseif (Module::getModuleByName('places_assistant')) { |
|
| 115 | - // Places Assistant is a custom/add-on module that was once part of the core code. |
|
| 116 | - \PlacesAssistantModule::display_map($level, $parent); |
|
| 117 | - } |
|
| 106 | + if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
|
| 107 | + $linklevels = ''; |
|
| 108 | + $place_names = []; |
|
| 109 | + for ($j = 0; $j < $level; $j++) { |
|
| 110 | + $linklevels .= '&parent[' . $j . ']=' . rawurlencode($parent[$j]); |
|
| 111 | + } |
|
| 118 | 112 | |
| 119 | - if ($numfound > 0) { |
|
| 120 | - if ($numfound > 20) { |
|
| 121 | - $divisor = 3; |
|
| 122 | - } elseif ($numfound > 4) { |
|
| 123 | - $divisor = 2; |
|
| 124 | - } else { |
|
| 125 | - $divisor = 1; |
|
| 113 | + $gm_module->createMap(); |
|
| 114 | + } elseif (Module::getModuleByName('places_assistant')) { |
|
| 115 | + // Places Assistant is a custom/add-on module that was once part of the core code. |
|
| 116 | + \PlacesAssistantModule::display_map($level, $parent); |
|
| 126 | 117 | } |
| 127 | 118 | |
| 128 | - $columns = array_chunk($child_places, ceil($numfound / $divisor)); |
|
| 129 | - $html = '<table id="place_hierarchy" class="list_table"><thead><tr><th class="list_label" colspan="' . $divisor . '">'; |
|
| 130 | - $html .= '<i class="icon-place"></i> '; |
|
| 131 | - if ($place_id) { |
|
| 132 | - $html .= I18N::translate('Places in %s', $place->getPlaceName()); |
|
| 133 | - } else { |
|
| 134 | - $html .= I18N::translate('Place hierarchy'); |
|
| 135 | - } |
|
| 136 | - $html .= '</th></tr></thead>'; |
|
| 137 | - $html .= '<tbody><tr>'; |
|
| 138 | - foreach ($columns as $column) { |
|
| 139 | - $html .= '<td class="list_value"><ul>'; |
|
| 140 | - foreach ($column as $item) { |
|
| 141 | - $html .= '<li><a href="' . $item->getURL() . '" class="list_item">' . $item->getPlaceName() . '</a></li>'; |
|
| 142 | - if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
|
| 143 | - list($tmp) = explode(', ', $item->getGedcomName(), 2); |
|
| 144 | - $place_names[] = $tmp; |
|
| 119 | + if ($numfound > 0) { |
|
| 120 | + if ($numfound > 20) { |
|
| 121 | + $divisor = 3; |
|
| 122 | + } elseif ($numfound > 4) { |
|
| 123 | + $divisor = 2; |
|
| 124 | + } else { |
|
| 125 | + $divisor = 1; |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + $columns = array_chunk($child_places, ceil($numfound / $divisor)); |
|
| 129 | + $html = '<table id="place_hierarchy" class="list_table"><thead><tr><th class="list_label" colspan="' . $divisor . '">'; |
|
| 130 | + $html .= '<i class="icon-place"></i> '; |
|
| 131 | + if ($place_id) { |
|
| 132 | + $html .= I18N::translate('Places in %s', $place->getPlaceName()); |
|
| 133 | + } else { |
|
| 134 | + $html .= I18N::translate('Place hierarchy'); |
|
| 135 | + } |
|
| 136 | + $html .= '</th></tr></thead>'; |
|
| 137 | + $html .= '<tbody><tr>'; |
|
| 138 | + foreach ($columns as $column) { |
|
| 139 | + $html .= '<td class="list_value"><ul>'; |
|
| 140 | + foreach ($column as $item) { |
|
| 141 | + $html .= '<li><a href="' . $item->getURL() . '" class="list_item">' . $item->getPlaceName() . '</a></li>'; |
|
| 142 | + if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
|
| 143 | + list($tmp) = explode(', ', $item->getGedcomName(), 2); |
|
| 144 | + $place_names[] = $tmp; |
|
| 145 | + } |
|
| 145 | 146 | } |
| 147 | + $html .= '</ul></td>'; |
|
| 146 | 148 | } |
| 147 | - $html .= '</ul></td>'; |
|
| 148 | - } |
|
| 149 | - $html .= '</tr></tbody>'; |
|
| 150 | - if ($numfound > 0 && $action == 'find' && $place_id) { |
|
| 151 | - $html .= '<tfoot><tr><td class="list_label" colspan="' . $divisor . '">'; |
|
| 152 | - $html .= I18N::translate('View all records found in this place'); |
|
| 153 | - $html .= '</td></tr><tr><td class="list_value" colspan="' . $divisor . '" style="text-align: center;">'; |
|
| 154 | - $html .= '<a href="' . $place->getURL() . '&action=show" class="formField">' . $place->getPlaceName() . '</a>'; |
|
| 155 | - $html .= '</td></tr></tfoot>'; |
|
| 149 | + $html .= '</tr></tbody>'; |
|
| 150 | + if ($numfound > 0 && $action == 'find' && $place_id) { |
|
| 151 | + $html .= '<tfoot><tr><td class="list_label" colspan="' . $divisor . '">'; |
|
| 152 | + $html .= I18N::translate('View all records found in this place'); |
|
| 153 | + $html .= '</td></tr><tr><td class="list_value" colspan="' . $divisor . '" style="text-align: center;">'; |
|
| 154 | + $html .= '<a href="' . $place->getURL() . '&action=show" class="formField">' . $place->getPlaceName() . '</a>'; |
|
| 155 | + $html .= '</td></tr></tfoot>'; |
|
| 156 | + } |
|
| 157 | + $html .= '</table>'; |
|
| 158 | + // -- echo the array |
|
| 159 | + echo $html; |
|
| 156 | 160 | } |
| 157 | - $html .= '</table>'; |
|
| 158 | - // -- echo the array |
|
| 159 | - echo $html; |
|
| 160 | - } |
|
| 161 | - if ($place_id && $action == 'show') { |
|
| 162 | - // -- array of names |
|
| 163 | - $myindilist = []; |
|
| 164 | - $myfamlist = []; |
|
| 165 | - |
|
| 166 | - $positions = |
|
| 167 | - Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?") |
|
| 168 | - ->execute([$place_id, $WT_TREE->getTreeId()]) |
|
| 169 | - ->fetchOneColumn(); |
|
| 170 | - |
|
| 171 | - foreach ($positions as $position) { |
|
| 172 | - $record = GedcomRecord::getInstance($position, $WT_TREE); |
|
| 173 | - if ($record && $record->canShow()) { |
|
| 174 | - if ($record instanceof Individual) { |
|
| 175 | - $myindilist[] = $record; |
|
| 176 | - } |
|
| 177 | - if ($record instanceof Family) { |
|
| 178 | - $myfamlist[] = $record; |
|
| 161 | + if ($place_id && $action == 'show') { |
|
| 162 | + // -- array of names |
|
| 163 | + $myindilist = []; |
|
| 164 | + $myfamlist = []; |
|
| 165 | + |
|
| 166 | + $positions = |
|
| 167 | + Database::prepare("SELECT DISTINCT pl_gid FROM `##placelinks` WHERE pl_p_id=? AND pl_file=?") |
|
| 168 | + ->execute([$place_id, $WT_TREE->getTreeId()]) |
|
| 169 | + ->fetchOneColumn(); |
|
| 170 | + |
|
| 171 | + foreach ($positions as $position) { |
|
| 172 | + $record = GedcomRecord::getInstance($position, $WT_TREE); |
|
| 173 | + if ($record && $record->canShow()) { |
|
| 174 | + if ($record instanceof Individual) { |
|
| 175 | + $myindilist[] = $record; |
|
| 176 | + } |
|
| 177 | + if ($record instanceof Family) { |
|
| 178 | + $myfamlist[] = $record; |
|
| 179 | + } |
|
| 179 | 180 | } |
| 180 | 181 | } |
| 181 | - } |
|
| 182 | - echo '<br>'; |
|
| 182 | + echo '<br>'; |
|
| 183 | 183 | |
| 184 | - ?> |
|
| 184 | + ?> |
|
| 185 | 185 | <ul class="nav nav-tabs" role="tablist"> |
| 186 | 186 | <li class="nav-item"> |
| 187 | 187 | <a class="nav-link active<?= empty($myindilist) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#individuals"> |
| 188 | 188 | <?= I18N::translate('Individuals') ?> |
| 189 | - <?= Bootstrap4::badgeCount($myindilist) ?> |
|
| 189 | + <?= Bootstrap4::badgeCount($myindilist) ?> |
|
| 190 | 190 | </a> |
| 191 | 191 | </li> |
| 192 | 192 | <li class="nav-item"> |
| 193 | 193 | <a class="nav-link<?= empty($myfamlist) ? ' text-muted' : '' ?>" data-toggle="tab" role="tab" href="#families"> |
| 194 | 194 | <?= I18N::translate('Families') ?> |
| 195 | - <?= Bootstrap4::badgeCount($myfamlist) ?> |
|
| 195 | + <?= Bootstrap4::badgeCount($myfamlist) ?> |
|
| 196 | 196 | </a> |
| 197 | 197 | </li> |
| 198 | 198 | </ul> |
| 199 | 199 | <div class="tab-content"> |
| 200 | 200 | <div class="tab-pane fade show active" role="tabpanel" id="individuals"> |
| 201 | 201 | <?php if (empty($myindilist)): ?> |
| 202 | - <p><?= I18N::translate('No results found.') ?></p> |
|
| 202 | + <p><?= I18N::translate('No results found.') ?></p> |
|
| 203 | 203 | <?php else: ?> |
| 204 | - <?= FunctionsPrintLists::individualTable($myindilist) ?> |
|
| 205 | - <?php endif ?> |
|
| 204 | + <?= FunctionsPrintLists::individualTable($myindilist) ?> |
|
| 205 | + <?php endif ?> |
|
| 206 | 206 | </div> |
| 207 | 207 | |
| 208 | 208 | <div class="tab-pane fade" role="tabpanel" id="families"> |
| 209 | 209 | <?php if (empty($myfamlist)): ?> |
| 210 | - <p><?= I18N::translate('No results found.') ?></p> |
|
| 210 | + <p><?= I18N::translate('No results found.') ?></p> |
|
| 211 | 211 | <?php else: ?> |
| 212 | - <?= FunctionsPrintLists::familyTable($myfamlist) ?> |
|
| 213 | - <?php endif ?> |
|
| 212 | + <?= FunctionsPrintLists::familyTable($myfamlist) ?> |
|
| 213 | + <?php endif ?> |
|
| 214 | 214 | </div> |
| 215 | 215 | </div> |
| 216 | 216 | <?php |
| 217 | - } |
|
| 218 | - echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>'; |
|
| 217 | + } |
|
| 218 | + echo '<h4><a href="placelist.php?display=list">', I18N::translate('Show all places in a list'), '</a></h4>'; |
|
| 219 | 219 | |
| 220 | - if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
|
| 221 | - $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names); |
|
| 222 | - } |
|
| 223 | - break; |
|
| 220 | + if ($gm_module && $gm_module->getPreference('GM_PLACE_HIERARCHY')) { |
|
| 221 | + $gm_module->mapScripts($numfound, $level, $parent, $linklevels, $place_names); |
|
| 222 | + } |
|
| 223 | + break; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | echo '</div>'; // <div id="place-hierarchy"> |
@@ -29,10 +29,10 @@ |
||
| 29 | 29 | // Check for updates |
| 30 | 30 | $latest_version_txt = Functions::fetchLatestVersion(); |
| 31 | 31 | if (preg_match('/^[0-9.]+\|[0-9.]+\|/', $latest_version_txt)) { |
| 32 | - list($latest_version, , $download_url) = explode('|', $latest_version_txt); |
|
| 32 | + list($latest_version,, $download_url) = explode('|', $latest_version_txt); |
|
| 33 | 33 | } else { |
| 34 | 34 | // Cannot determine the latest version |
| 35 | - list($latest_version, , $download_url) = explode('|', '||'); |
|
| 35 | + list($latest_version,, $download_url) = explode('|', '||'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $latest_version_html = '<span dir="ltr">' . $latest_version . '</span>'; |
@@ -118,18 +118,18 @@ discard block |
||
| 118 | 118 | foreach (Module::getInstalledModules('disabled') as $module) { |
| 119 | 119 | if (!in_array($module->getName(), Module::getCoreModuleNames())) { |
| 120 | 120 | switch ($modules_action) { |
| 121 | - case 'disable': |
|
| 122 | - Database::prepare( |
|
| 123 | - "UPDATE `##module` SET status = 'disabled' WHERE module_name = ?" |
|
| 124 | - )->execute([$module->getName()]); |
|
| 125 | - break; |
|
| 126 | - case 'ignore': |
|
| 127 | - echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_success; |
|
| 128 | - break; |
|
| 129 | - default: |
|
| 130 | - echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_failure; |
|
| 131 | - $custom_modules = true; |
|
| 132 | - break; |
|
| 121 | + case 'disable': |
|
| 122 | + Database::prepare( |
|
| 123 | + "UPDATE `##module` SET status = 'disabled' WHERE module_name = ?" |
|
| 124 | + )->execute([$module->getName()]); |
|
| 125 | + break; |
|
| 126 | + case 'ignore': |
|
| 127 | + echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_success; |
|
| 128 | + break; |
|
| 129 | + default: |
|
| 130 | + echo '<br>', I18N::translate('Custom module'), ' — ', WT_MODULES_DIR, $module->getName(), ' — ', $module->getTitle(), $icon_failure; |
|
| 131 | + $custom_modules = true; |
|
| 132 | + break; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | } |
@@ -158,40 +158,40 @@ discard block |
||
| 158 | 158 | $custom_themes = false; |
| 159 | 159 | foreach (Theme::themeNames() as $theme_id => $theme_name) { |
| 160 | 160 | switch ($theme_id) { |
| 161 | - case 'clouds': |
|
| 162 | - case 'colors': |
|
| 163 | - case 'fab': |
|
| 164 | - case 'minimal': |
|
| 165 | - case 'webtrees': |
|
| 166 | - case 'xenea': |
|
| 167 | - break; |
|
| 168 | - default: |
|
| 169 | - $theme_used = Database::prepare( |
|
| 170 | - "SELECT EXISTS (SELECT 1 FROM `##site_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 171 | - " OR EXISTS (SELECT 1 FROM `##gedcom_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 172 | - " OR EXISTS (SELECT 1 FROM `##user_setting` WHERE setting_name='theme' AND setting_value=?)" |
|
| 173 | - )->execute([$theme_id, $theme_id, $theme_id])->fetchOne(); |
|
| 174 | - if ($theme_used) { |
|
| 175 | - switch ($themes_action) { |
|
| 176 | - case 'disable': |
|
| 177 | - Database::prepare( |
|
| 178 | - "DELETE FROM `##site_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 179 | - )->execute([$theme_id]); |
|
| 180 | - Database::prepare( |
|
| 181 | - "DELETE FROM `##gedcom_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 182 | - )->execute([$theme_id]); |
|
| 183 | - Database::prepare( |
|
| 184 | - "DELETE FROM `##user_setting` WHERE setting_name = 'theme' AND setting_value = ?" |
|
| 185 | - )->execute([$theme_id]); |
|
| 186 | - break; |
|
| 187 | - case 'ignore': |
|
| 188 | - echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_success; |
|
| 189 | - break; |
|
| 190 | - default: |
|
| 191 | - echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_failure; |
|
| 192 | - $custom_themes = true; |
|
| 193 | - break; |
|
| 194 | - } |
|
| 161 | + case 'clouds': |
|
| 162 | + case 'colors': |
|
| 163 | + case 'fab': |
|
| 164 | + case 'minimal': |
|
| 165 | + case 'webtrees': |
|
| 166 | + case 'xenea': |
|
| 167 | + break; |
|
| 168 | + default: |
|
| 169 | + $theme_used = Database::prepare( |
|
| 170 | + "SELECT EXISTS (SELECT 1 FROM `##site_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 171 | + " OR EXISTS (SELECT 1 FROM `##gedcom_setting` WHERE setting_name='THEME_DIR' AND setting_value=?)" . |
|
| 172 | + " OR EXISTS (SELECT 1 FROM `##user_setting` WHERE setting_name='theme' AND setting_value=?)" |
|
| 173 | + )->execute([$theme_id, $theme_id, $theme_id])->fetchOne(); |
|
| 174 | + if ($theme_used) { |
|
| 175 | + switch ($themes_action) { |
|
| 176 | + case 'disable': |
|
| 177 | + Database::prepare( |
|
| 178 | + "DELETE FROM `##site_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 179 | + )->execute([$theme_id]); |
|
| 180 | + Database::prepare( |
|
| 181 | + "DELETE FROM `##gedcom_setting` WHERE setting_name = 'THEME_DIR' AND setting_value = ?" |
|
| 182 | + )->execute([$theme_id]); |
|
| 183 | + Database::prepare( |
|
| 184 | + "DELETE FROM `##user_setting` WHERE setting_name = 'theme' AND setting_value = ?" |
|
| 185 | + )->execute([$theme_id]); |
|
| 186 | + break; |
|
| 187 | + case 'ignore': |
|
| 188 | + echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_success; |
|
| 189 | + break; |
|
| 190 | + default: |
|
| 191 | + echo '<br>', I18N::translate('Custom theme'), ' — ', $theme_id, ' — ', $theme_name, $icon_failure; |
|
| 192 | + $custom_themes = true; |
|
| 193 | + break; |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | break; |
| 197 | 197 | } |
@@ -146,7 +146,8 @@ discard block |
||
| 146 | 146 | value="<?= Html::escape($controller->getValue($i)) ?>"> |
| 147 | 147 | <?php if (preg_match('/^NAME:/', $currentFieldSearch) > 0): ?> |
| 148 | 148 | <select class="form-control form-control-sm col-3" name="fields[<?= $i ?>]"> |
| 149 | - <option value="<?= $currentField ?>:EXACT" <?php if (preg_match('/:EXACT$/', $currentFieldSearch) > 0) echo 'selected' ?>> |
|
| 149 | + <option value="<?= $currentField ?>:EXACT" <?php if (preg_match('/:EXACT$/', $currentFieldSearch) > 0) { |
|
| 150 | + echo 'selected' ?>> |
|
| 150 | 151 | <?= I18N::translate('Exact') ?> |
| 151 | 152 | </option> |
| 152 | 153 | <option value="<?= $currentField ?>:BEGINS" <?php if (preg_match('/:BEGINS$/', $currentFieldSearch) > 0) echo 'selected' ?>> |
@@ -161,13 +162,15 @@ discard block |
||
| 161 | 162 | <?php else: ?> |
| 162 | 163 | <input type="hidden" name="fields[<?= $i ?>]" value="<?= $controller->getField($i) ?>"> |
| 163 | 164 | <?php endif; |
| 165 | +} |
|
| 164 | 166 | if (preg_match('/:DATE$/', $currentFieldSearch) > 0) { |
| 165 | 167 | ?> |
| 166 | 168 | <select class="form-control form-control-sm col-3" name="plusminus[<?= $i ?>]"> |
| 167 | 169 | <option value=""> |
| 168 | 170 | <?= I18N::translate('Exact date') ?> |
| 169 | 171 | </option> |
| 170 | - <option value="2" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 2) echo 'selected' ?>> |
|
| 172 | + <option value="2" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 2) { |
|
| 173 | + echo 'selected' ?>> |
|
| 171 | 174 | <?= I18N::plural('±%s year', '±%s years', 2, I18N::number(2)) ?> |
| 172 | 175 | </option> |
| 173 | 176 | <option value="5" <?php if (!empty($controller->plusminus[$i]) && $controller->plusminus[$i] == 5) echo 'selected' ?>> |
@@ -183,6 +186,7 @@ discard block |
||
| 183 | 186 | //-- relative fields |
| 184 | 187 | if ($i == 0 && $fct > 4) { |
| 185 | 188 | $j = $fct; |
| 189 | +} |
|
| 186 | 190 | // Get the current options for Father’s and Mother’s name searches |
| 187 | 191 | $fatherGivnOption = 'SDX'; |
| 188 | 192 | $fatherSurnOption = 'SDX'; |
@@ -192,18 +192,18 @@ |
||
| 192 | 192 | $searchField = $controller->getField($k); |
| 193 | 193 | $searchOption = substr($searchField, 20); // Assume we have something like "FAMC:HUSB:NAME:GIVN:foo" |
| 194 | 194 | switch (substr($searchField, 0, 20)) { |
| 195 | - case 'FAMC:HUSB:NAME:GIVN:': |
|
| 196 | - $fatherGivnOption = $searchOption; |
|
| 197 | - break; |
|
| 198 | - case 'FAMC:HUSB:NAME:SURN:': |
|
| 199 | - $fatherSurnOption = $searchOption; |
|
| 200 | - break; |
|
| 201 | - case 'FAMC:WIFE:NAME:GIVN:': |
|
| 202 | - $motherGivnOption = $searchOption; |
|
| 203 | - break; |
|
| 204 | - case 'FAMC:WIFE:NAME:SURN:': |
|
| 205 | - $motherSurnOption = $searchOption; |
|
| 206 | - break; |
|
| 195 | + case 'FAMC:HUSB:NAME:GIVN:': |
|
| 196 | + $fatherGivnOption = $searchOption; |
|
| 197 | + break; |
|
| 198 | + case 'FAMC:HUSB:NAME:SURN:': |
|
| 199 | + $fatherSurnOption = $searchOption; |
|
| 200 | + break; |
|
| 201 | + case 'FAMC:WIFE:NAME:GIVN:': |
|
| 202 | + $motherGivnOption = $searchOption; |
|
| 203 | + break; |
|
| 204 | + case 'FAMC:WIFE:NAME:SURN:': |
|
| 205 | + $motherSurnOption = $searchOption; |
|
| 206 | + break; |
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -150,8 +150,8 @@ |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | foreach ($family->getChildren() as $child) { |
| 153 | - $icon = $controller->record === $child ? '<i class="icon-selected"></i>' : ''; |
|
| 154 | - $menu = new Menu($icon . Functions::getCloseRelationshipName($controller->record, $child)); |
|
| 153 | + $icon = $controller->record === $child ? '<i class="icon-selected"></i>' : ''; |
|
| 154 | + $menu = new Menu($icon . Functions::getCloseRelationshipName($controller->record, $child)); |
|
| 155 | 155 | $menu->addSubmenu(new Menu($this->getFamily($child))); |
| 156 | 156 | ?> |
| 157 | 157 | <tr class="text-center wt-child wt-gender-<?= $child->getSex() ?>"> |
@@ -141,7 +141,8 @@ discard block |
||
| 141 | 141 | <div class="small"> |
| 142 | 142 | <?= $spouse->getLifeSpan() ?> |
| 143 | 143 | </div> |
| 144 | - <?php else: ?> |
|
| 144 | + <?php else { |
|
| 145 | + : ?> |
|
| 145 | 146 | <?= $spouse->getFullName() ?> |
| 146 | 147 | <?php endif ?> |
| 147 | 148 | </td> |
@@ -151,6 +152,7 @@ discard block |
||
| 151 | 152 | |
| 152 | 153 | foreach ($family->getChildren() as $child) { |
| 153 | 154 | $icon = $controller->record === $child ? '<i class="icon-selected"></i>' : ''; |
| 155 | +} |
|
| 154 | 156 | $menu = new Menu($icon . Functions::getCloseRelationshipName($controller->record, $child)); |
| 155 | 157 | $menu->addSubmenu(new Menu($this->getFamily($child))); |
| 156 | 158 | ?> |
@@ -168,7 +170,8 @@ discard block |
||
| 168 | 170 | <div class="small"> |
| 169 | 171 | <?= $child->getLifeSpan() ?> |
| 170 | 172 | </div> |
| 171 | - <?php else: ?> |
|
| 173 | + <?php else { |
|
| 174 | + : ?> |
|
| 172 | 175 | <?= $child->getFullName() ?> |
| 173 | 176 | <?php endif ?> |
| 174 | 177 | </td> |
@@ -192,6 +195,7 @@ discard block |
||
| 192 | 195 | private function getHTML($person, $showUnknown = false) { |
| 193 | 196 | if ($person instanceof Individual) { |
| 194 | 197 | return sprintf(self::LNK, $person->getHtmlUrl(), $person->getFullName()); |
| 198 | +} |
|
| 195 | 199 | } elseif ($showUnknown) { |
| 196 | 200 | return sprintf(self::MSG, I18N::translate('unknown')); |
| 197 | 201 | } else { |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | $row_class .= ' old'; |
| 178 | 178 | } |
| 179 | 179 | $icon = $controller->record === $person ? '<i class="icon-selected"></i>' : ''; |
| 180 | - ?> |
|
| 180 | + ?> |
|
| 181 | 181 | <tr class="<?= $row_class ?>"> |
| 182 | 182 | <th scope="row"> |
| 183 | 183 | <?= $icon ?> |