1<?php use Fisharebest\Webtrees\Database; ?> 2<?php use Fisharebest\Webtrees\I18N; ?> 3 4<?php 5// Count the number of linked records. These numbers include private records. 6// It is not good to bypass privacy, but many servers do not have the resources 7// to process privacy for every record in the tree 8$count_sources = Database::prepare( 9 "SELECT l_to, COUNT(*) FROM `##sources` JOIN `##link` ON l_from = s_id AND l_file = s_file AND l_type = 'REPO' AND l_file = :tree_id GROUP BY l_to" 10)->execute(['tree_id' => $tree->getTreeId()])->fetchAssoc(); 11?> 12 13<table 14 class="table table-bordered table-sm wt-table-source datatables d-none" 15 <?= view('lists/datatables-attributes') ?> 16 data-columns="<?= e(json_encode([ 17 null, 18 ['visible' => array_sum($count_sources) > 0], 19 ['visible' => (bool) $tree->getPreference('SHOW_LAST_CHANGE'), 'searchable' => false], 20 ])) ?>" 21> 22 <caption class="sr-only"> 23 <?= $caption ?? I18N::translate('Repositories') ?> 24 </caption> 25 26 <thead> 27 <tr> 28 <th><?= I18N::translate('Repository name') ?></th> 29 <th><?= I18N::translate('Sources') ?></th> 30 <th><?= I18N::translate('Last change') ?></th> 31 </tr> 32 </thead> 33 34 <tbody> 35 <?php foreach ($repositories as $repository) : ?> 36 <tr class="<?= $repository->isPendingDeletion() ? 'old' : ($repository->isPendingAddition() ? 'new' : '') ?>"> 37 <!-- Repository name --> 38 <td data-sort="<?= e($repository->getSortName()) ?>"> 39 <a href="<?= e($repository->url()) ?>"> 40 <?= $repository->getFullName() ?> 41 </a> 42 </td> 43 44 <!-- Count of linked sources --> 45 <td class="center" data-sort="<?= $count_sources[$repository->getXref()] ?? 0 ?>"> 46 <?= I18N::number($count_sources[$repository->getXref()] ?? 0) ?> 47 </td> 48 49 <!-- Last change --> 50 <td data-sort="<?= $repository->lastChangeTimestamp(true) ?>"> 51 <?= $repository->lastChangeTimestamp() ?> 52 </td> 53 </tr> 54 <?php endforeach ?> 55 </tbody> 56</table> 57