|
@@ 2564-2621 (lines=58) @@
|
| 2561 |
|
header('Location: ' . $individual->getRawUrl()); |
| 2562 |
|
break; |
| 2563 |
|
|
| 2564 |
|
case 'reorder-children': |
| 2565 |
|
////////////////////////////////////////////////////////////////////////////// |
| 2566 |
|
// Change the order of children within a family record |
| 2567 |
|
////////////////////////////////////////////////////////////////////////////// |
| 2568 |
|
$xref = Filter::get('xref', WT_REGEX_XREF); |
| 2569 |
|
|
| 2570 |
|
$family = Family::getInstance($xref, $controller->tree()); |
| 2571 |
|
check_record_access($family); |
| 2572 |
|
|
| 2573 |
|
$controller |
| 2574 |
|
->addExternalJavascript(WT_SORTABLE_JS_URL) |
| 2575 |
|
->addInlineJavascript('new Sortable(document.querySelector(".wt-sortable-list"), {});') |
| 2576 |
|
->addInlineJavascript('$("#btn-default-order").on("click", function() { $(".wt-sortable-list li").sort(function(x, y) { return Math.sign(x.dataset.sortbydate - y.dataset.sortbydate); }).appendTo(".wt-sortable-list"); });') |
| 2577 |
|
->setPageTitle($family->getFullName() . ' — ' . I18N::translate('Re-order children')) |
| 2578 |
|
->pageHeader(); |
| 2579 |
|
|
| 2580 |
|
?> |
| 2581 |
|
<h2><?= $controller->getPageTitle() ?></h2> |
| 2582 |
|
|
| 2583 |
|
<form name="reorder_form" method="post"> |
| 2584 |
|
<input type="hidden" name="ged" value="<?= $controller->tree()->getNameHtml() ?>"> |
| 2585 |
|
<input type="hidden" name="action" value="reorder-children-save"> |
| 2586 |
|
<input type="hidden" name="xref" value="<?= $xref ?>"> |
| 2587 |
|
<?= Filter::getCsrf() ?> |
| 2588 |
|
<div class="wt-sortable-list"> |
| 2589 |
|
<?php foreach ($family->getFacts('CHIL') as $fact): ?> |
| 2590 |
|
<div class="card mb-2 wt-sortable-item" data-sortbydate="<?= $fact->getTarget()->getBirthDate()->julianDay() ?>"> |
| 2591 |
|
<input type="hidden" name="order[]" value="<?= $fact->getFactId() ?>"> |
| 2592 |
|
<h3 class="card-header"> |
| 2593 |
|
<?= FontAwesome::semanticIcon('drag-handle', '') ?> |
| 2594 |
|
<?= $fact->getTarget()->getFullName() ?> |
| 2595 |
|
</h3> |
| 2596 |
|
<div class="card-body"> |
| 2597 |
|
<?= $fact->getTarget()->formatFirstMajorFact(WT_EVENTS_BIRT, 2) ?> |
| 2598 |
|
<?= $fact->getTarget()->formatFirstMajorFact(WT_EVENTS_DEAT, 2) ?> |
| 2599 |
|
</div> |
| 2600 |
|
</div> |
| 2601 |
|
<?php endforeach ?> |
| 2602 |
|
</div> |
| 2603 |
|
|
| 2604 |
|
<p class="text-center"> |
| 2605 |
|
<button class="btn btn-primary" type="submit"> |
| 2606 |
|
<?= FontAwesome::decorativeIcon('save') ?> |
| 2607 |
|
<?= /* I18N: A button label. */ |
| 2608 |
|
I18N::translate('save') ?> |
| 2609 |
|
</button> |
| 2610 |
|
<button class="btn btn-secondary" id="btn-default-order" type="button"> |
| 2611 |
|
<?= FontAwesome::decorativeIcon('sort') ?> |
| 2612 |
|
<?= /* I18N: A button label. */ I18N::translate('sort by date of birth') ?> |
| 2613 |
|
</button> |
| 2614 |
|
<a class="btn btn-secondary" href="<?= $family->getHtmlUrl() ?>"> |
| 2615 |
|
<?= FontAwesome::decorativeIcon('cancel') ?> |
| 2616 |
|
<?= /* I18N: A button label. */ I18N::translate('cancel') ?> |
| 2617 |
|
</a> |
| 2618 |
|
</p> |
| 2619 |
|
</form> |
| 2620 |
|
<?php |
| 2621 |
|
break; |
| 2622 |
|
|
| 2623 |
|
case 'reorder-children-save': |
| 2624 |
|
////////////////////////////////////////////////////////////////////////////// |
|
@@ 2665-2722 (lines=58) @@
|
| 2662 |
|
header('Location: ' . $family->getRawUrl()); |
| 2663 |
|
break; |
| 2664 |
|
|
| 2665 |
|
case 'reorder-spouses': |
| 2666 |
|
////////////////////////////////////////////////////////////////////////////// |
| 2667 |
|
// Change the order of FAMS records within an INDI record |
| 2668 |
|
////////////////////////////////////////////////////////////////////////////// |
| 2669 |
|
$xref = Filter::get('xref', WT_REGEX_XREF); |
| 2670 |
|
|
| 2671 |
|
$person = Individual::getInstance($xref, $controller->tree()); |
| 2672 |
|
check_record_access($person); |
| 2673 |
|
|
| 2674 |
|
$controller |
| 2675 |
|
->addExternalJavascript(WT_SORTABLE_JS_URL) |
| 2676 |
|
->addInlineJavascript('new Sortable(document.querySelector(".wt-sortable-list"), {});') |
| 2677 |
|
->addInlineJavascript('$("#btn-default-order").on("click", function() { $(".wt-sortable-list li").sort(function(x, y) { return Math.sign(x.dataset.sortbydate - y.dataset.sortbydate); }).appendTo(".wt-sortable-list"); });') |
| 2678 |
|
->setPageTitle($person->getFullName() . ' — ' . I18N::translate('Re-order families')) |
| 2679 |
|
->pageHeader(); |
| 2680 |
|
|
| 2681 |
|
?> |
| 2682 |
|
<h2><?= $controller->getPageTitle() ?></h2> |
| 2683 |
|
|
| 2684 |
|
<form name="reorder_form" method="post"> |
| 2685 |
|
<input type="hidden" name="ged" value="<?= $controller->tree()->getNameHtml() ?>"> |
| 2686 |
|
<input type="hidden" name="action" value="reorder-spouses-save"> |
| 2687 |
|
<input type="hidden" name="xref" value="<?= $xref ?>"> |
| 2688 |
|
<?= Filter::getCsrf() ?> |
| 2689 |
|
<div class="wt-sortable-list"> |
| 2690 |
|
<?php foreach ($person->getFacts('FAMS') as $fact): ?> |
| 2691 |
|
<div class="card mb-2 wt-sortable-item" data-sortbydate="<?= $fact->getTarget()->getMarriageDate()->julianDay() ?>"> |
| 2692 |
|
<input type="hidden" name="order[]" value="<?= $fact->getFactId() ?>"> |
| 2693 |
|
<h3 class="card-header"> |
| 2694 |
|
<?= FontAwesome::semanticIcon('drag-handle', '') ?> |
| 2695 |
|
<?= $fact->getTarget()->getFullName() ?> |
| 2696 |
|
</h3> |
| 2697 |
|
<div class="card-body"> |
| 2698 |
|
<?= $fact->getTarget()->formatFirstMajorFact(WT_EVENTS_MARR, 2) ?> |
| 2699 |
|
<?= $fact->getTarget()->formatFirstMajorFact(WT_EVENTS_DIV, 2) ?> |
| 2700 |
|
</div> |
| 2701 |
|
</div> |
| 2702 |
|
<?php endforeach ?> |
| 2703 |
|
</div> |
| 2704 |
|
|
| 2705 |
|
<p class="text-center"> |
| 2706 |
|
<button class="btn btn-primary" type="submit"> |
| 2707 |
|
<?= FontAwesome::decorativeIcon('save') ?> |
| 2708 |
|
<?= /* I18N: A button label. */ |
| 2709 |
|
I18N::translate('save') ?> |
| 2710 |
|
</button> |
| 2711 |
|
<button class="btn btn-secondary" id="btn-default-order" type="button"> |
| 2712 |
|
<?= FontAwesome::decorativeIcon('sort') ?> |
| 2713 |
|
<?= /* I18N: A button label. */ I18N::translate('sort by date of marriage') ?> |
| 2714 |
|
</button> |
| 2715 |
|
<a class="btn btn-secondary" href="<?= $person->getHtmlUrl() ?>"> |
| 2716 |
|
<?= FontAwesome::decorativeIcon('cancel') ?> |
| 2717 |
|
<?= /* I18N: A button label. */ I18N::translate('cancel') ?> |
| 2718 |
|
</a> |
| 2719 |
|
</p> |
| 2720 |
|
</form> |
| 2721 |
|
<?php |
| 2722 |
|
break; |
| 2723 |
|
|
| 2724 |
|
case 'reorder-spouses-save': |
| 2725 |
|
////////////////////////////////////////////////////////////////////////////// |