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/lists/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/webtrees/resources/views/lists/submitters-table.phtml
<?php

declare(strict_types=1);

use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Submitter;
use Fisharebest\Webtrees\Tree;
use Illuminate\Database\Capsule\Manager as DB;
use Illuminate\Database\Query\Expression;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;

/**
 * @var Collection<int,Submitter> $submitters
 * @var Tree                      $tree
 */

?>

<?php
// Count the number of linked records. These numbers include private records.
// It is not good to bypass privacy, but many servers do not have the resources
// to process privacy for every record in the tree
// Count the number of linked records. These numbers include private records.
// It is not good to bypass privacy, but many servers do not have the resources
// to process privacy for every record in the tree
$count_individuals = DB::table('individuals')
    ->join('link', static function (JoinClause $join): void {
        $join->on('l_from', '=', 'i_id');
        $join->on('l_file', '=', 'i_file');
    })
    ->where('l_type', '=', Submitter::RECORD_TYPE)
    ->where('l_file', '=', $tree->id())
    ->groupBy(['l_to'])
    ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
    ->map(static fn (string $n) => (int) $n)
    ->all();

$count_families = DB::table('families')
    ->join('link', static function (JoinClause $join): void {
        $join->on('l_from', '=', 'f_id');
        $join->on('l_file', '=', 'f_file');
    })
    ->where('l_type', '=', Submitter::RECORD_TYPE)
    ->where('l_file', '=', $tree->id())
    ->groupBy(['l_to'])
    ->pluck(new Expression('COUNT(*) AS total'), 'l_to')
    ->map(static fn (string $n) => (int) $n)
    ->all();
?>

<table
    class="table table-bordered table-sm wt-table-submitter datatables d-none"
    <?= view('lists/datatables-attributes') ?>
    data-columns="<?= e(json_encode([
        ['type' => 'html'],
        ['visible' => array_sum($count_individuals) > 0],
        ['visible' => array_sum($count_families) > 0],
        ['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false],
    ], JSON_THROW_ON_ERROR)) ?>"
    data-searchable="true"
>
    <caption class="visually-hidden">
        <?= $caption ?? I18N::translate('Submitters') ?>
    </caption>

    <thead>
        <tr>
            <th><?= I18N::translate('Submitter name') ?></th>
            <th><?= I18N::translate('Individuals') ?></th>
            <th><?= I18N::translate('Families') ?></th>
            <th><?= I18N::translate('Last change') ?></th>
        </tr>
    </thead>

    <tbody>
        <?php foreach ($submitters as $submitter) : ?>
            <tr class="<?= $submitter->isPendingAddition() ? 'wt-new' : '' ?> <?= $submitter->isPendingDeletion() ? 'wt-old' : '' ?>">
                <td data-sort="<?= e($submitter->sortName()) ?>">
                    <a href="<?= e($submitter->url()) ?>">
                        <?= $submitter->fullName() ?>
                    </a>
                </td>

                <td class="text-center" data-sort="<?= $count_individuals[$submitter->xref()] ?? 0 ?>">
                    <?= I18N::number($count_individuals[$submitter->xref()] ?? 0) ?>
                </td>

                <td class="text-center" data-sort="<?= $count_families[$submitter->xref()] ?? 0 ?>">
                    <?= I18N::number($count_families[$submitter->xref()] ?? 0) ?>
                </td>

                <td data-sort="<?= $submitter->lastChangeTimestamp()->timestamp() ?>">
                    <?= view('components/datetime', ['timestamp' => $submitter->lastChangeTimestamp()]) ?>
                </td>
            </tr>
        <?php endforeach ?>
    </tbody>
</table>

VaKeR 2022