VaKeR CYBER ARMY
Logo of a company Server : Apache/2.4.41 (Ubuntu)
System : Linux absol.cf 5.4.0-198-generic #218-Ubuntu SMP Fri Sep 27 20:18:53 UTC 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Directory :  /var/www/html/webtrees/resources/views/edit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/webtrees/resources/views/edit/reorder-children.phtml
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\Fact;
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\Gedcom;
use Fisharebest\Webtrees\Http\RequestHandlers\ReorderChildrenAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\View;

/**
 * @var Family $family
 * @var string $title
 * @var string $url
 */

?>

<h2 class="wt-page-title"><?= $title ?></h2>

<form method="post" action="<?= e(route(ReorderChildrenAction::class, ['tree' => $family->tree()->name(), 'xref' => $family->xref()])) ?>" class="wt-page-content">
    <input type="hidden" name="url" value="<?= e($url) ?>">
    <div class="wt-sortable-list">
        <?php foreach ($family->facts(['CHIL'])->filter(static fn (Fact $fact): bool => $fact->target() instanceof Individual) as $fact) : ?>
            <div class="card my-2 wt-sortable-item" data-wt-sort-by-date="<?= $fact->target()->getBirthDate()->julianDay() ?>">
                <input type="hidden" name="order[]" value="<?= $fact->id() ?>">
                <div class="card-header">
                    <?= view('edit/reorder-card-header', ['title' => $fact->target()->fullName()]) ?>
                </div>

                <div class="card-body">
                    <?= $fact->target()->formatFirstMajorFact(Gedcom::BIRTH_EVENTS, 2) ?>
                    <?= $fact->target()->formatFirstMajorFact(Gedcom::DEATH_EVENTS, 2) ?>
                </div>
            </div>
        <?php endforeach ?>
    </div>

    <p>
        <button class="btn btn-primary" type="submit">
            <?= view('icons/save') ?>
            <?= /* I18N: A button label. */ I18N::translate('save') ?>
        </button>

        <button class="btn btn-secondary" id="btn-default-order" type="button">
            <?= view('icons/sort') ?>
            <?= /* I18N: A button label. */ I18N::translate('sort by date of birth') ?>
        </button>

        <a class="btn btn-secondary" href="<?= e($url) ?>">
            <?= view('icons/cancel') ?>
            <?= /* I18N: A button label. */ I18N::translate('cancel') ?>
        </a>
    </p>

    <?= csrf_field() ?>
</form>

<?php View::push('javascript') ?>
<script>
    new Sortable(document.querySelector(".wt-sortable-list"), {
        handle: ".card-header",
    });

    $("#btn-default-order").on("click", function () {
        $(".wt-sortable-list .wt-sortable-item").sort(function (x, y) {
            return Math.sign(x.dataset.wtSortByDate - y.dataset.wtSortByDate);
        }).appendTo(".wt-sortable-list");
    });
</script>
<?php View::endpush() ?>

VaKeR 2022