xref: /webtrees/resources/views/admin/trees.phtml (revision 59597b37d69e8147c3f4a27643e9c8edaa2a0592)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
5use Fisharebest\Webtrees\Http\RequestHandlers\DeleteTreeAction;
6use Fisharebest\Webtrees\Http\RequestHandlers\SelectDefaultTree;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Site;
9use Fisharebest\Webtrees\View;
10use Illuminate\Database\Capsule\Manager as DB;
11
12?>
13
14<?php if (!empty($all_trees)): ?>
15    <?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
16<?php endif ?>
17
18<h1><?= $title ?></h1>
19
20<?php if (empty($all_trees)) : ?>
21    <div class="alert alert-info">
22        <?= I18N::translate('You need to create a family tree.') ?>
23    </div>
24<?php endif ?>
25
26<div id="accordion" role="tablist" aria-multiselectable="true">
27    <?php foreach ($all_trees as $managed_tree) : ?>
28        <?php if (Auth::isManager($managed_tree)) : ?>
29            <div class="card">
30                <div class="card-header" role="tab" id="card-tree-header-<?= $managed_tree->id() ?>">
31                    <h2 class="mb-0">
32                        <?= view('icons/tree') ?>
33                        <a data-toggle="collapse" data-parent="#accordion" href="#card-tree-content-<?= $managed_tree->id() ?>" <?= $managed_tree == $tree || $managed_tree->getPreference('imported') === '0' ? 'aria-expanded="true"' : '' ?> aria-controls="card-tree-content-<?= $managed_tree->id() ?>">
34                            <?= e($managed_tree->name()) ?><?= e($managed_tree->title()) ?>
35                        </a>
36                    </h2>
37                </div>
38                <div id="card-tree-content-<?= $managed_tree->id() ?>" class="collapse<?= $managed_tree == $tree || $managed_tree->getPreference('imported') === '0' ? ' show' : '' ?>" role="tabpanel" aria-labelledby="panel-tree-header-<?= $managed_tree->id() ?>">
39                    <div class="card-body">
40                        <?php $importing = DB::table('gedcom_chunk')->where('gedcom_id', '=', $managed_tree->id())->where('imported', '=', 0)->exists() ?>
41                        <?php if ($importing) : ?>
42                            <div id="import<?= $managed_tree->id() ?>" class="col-xs-12">
43                                <div class="progress">
44                                    <?= I18N::translate('Calculating…') ?>
45                                </div>
46                            </div>
47                            <?php View::push('javascript'); ?>
48                                <script>
49                                    $("#import<?= $managed_tree->id() ?>").load("<?= route('import', ['tree' => $managed_tree->name()]) ?>", {});
50                                </script>
51                                <?php View::endpush() ?>
52                            <?php endif ?>
53                        <div class="row<?= $importing ? ' d-none' : '' ?>" id="actions<?= $managed_tree->id() ?>">
54                            <div class="col-sm-6 col-md-3">
55                                <h3>
56                                    <?= I18N::translate('Family tree') ?>
57                                </h3>
58                                <ul class="fa-ul">
59                                    <li>
60                                        <span class="fa-li"><?= view('icons/tree') ?></span>
61                                        <a href="<?= e(route('tree-page', ['tree' => $managed_tree->name()])) ?>">
62                                            <?= I18N::translate('Home page') ?>
63                                        </a>
64                                    </li>
65                                </ul>
66                                <ul class="fa-ul">
67                                    <!-- PREFERENCES -->
68                                    <li>
69                                        <span class="fa-li"><?= view('icons/preferences') ?></span>
70                                        <a href="<?= e(route('admin-trees-preferences', ['tree' => $managed_tree->name()])) ?>">
71                                            <?= I18N::translate('Preferences') ?>
72                                            <span class="sr-only">
73                                        <?= e($managed_tree->title()) ?>
74                                    </span>
75                                        </a>
76                                    </li>
77                                    <!-- PRIVACY -->
78                                    <li>
79                                        <span class="fa-li"><?= view('icons/lock') ?></span>
80                                        <a href="<?= e(route('tree-privacy', ['tree' => $managed_tree->name()])) ?>">
81                                            <?= I18N::translate('Privacy') ?>
82                                            <span class="sr-only">
83                                        <?= e($managed_tree->title()) ?>
84                                    </span>
85                                        </a>
86                                    </li>
87                                    <!-- DELETE -->
88                                    <?php if (count($all_trees) > 1 && Auth::isAdmin()) : ?>
89                                        <li>
90                                            <span class="fa-li"><?= view('icons/delete') ?></span>
91                                            <a href="#" data-post-url="<?= e(route(DeleteTreeAction::class, ['tree' => $managed_tree->name()])) ?>" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($managed_tree->title())) ?>">
92                                                <?= I18N::translate('Delete') ?>
93                                            </a>
94                                        </li>
95                                    <?php endif ?>
96
97                                    <!-- SET AS DEFAULT -->
98                                    <?php if (count($all_trees) > 1 && Auth::isAdmin()) : ?>
99                                        <li>
100                                            <span class="fa-li"><?= view('icons/favorite') ?></span>
101                                            <?php if ($managed_tree->name() === Site::getPreference('DEFAULT_GEDCOM')) : ?>
102                                                <?= I18N::translate('Default family tree') ?>
103                                            <?php else : ?>
104                                                <a href="#" onclick="document.defaultform<?= $managed_tree->id() ?>.submit();">
105                                                    <?= I18N::translate('Set as default') ?>
106                                                    <span class="sr-only"><?= e($managed_tree->title()) ?></span>
107                                                </a>
108                                                <form method="post" action="<?= route(SelectDefaultTree::class, ['tree' => $managed_tree->name()]) ?>" name="defaultform<?= $managed_tree->id() ?>">
109                                                    <?= csrf_field() ?>
110                                                    <!-- A11Y - forms need submit buttons, but they look ugly here -->
111                                                    <button class="sr-only" type="submit">
112                                                        <?= I18N::translate('Set as default') ?>
113                                                    </button>
114                                                </form>
115                                            <?php endif ?>
116                                        </li>
117                                    <?php endif ?>
118                                </ul>
119                            </div>
120                            <div class="col-sm-6 col-md-3">
121                                <h3>
122                                    <?= /* I18N: Individuals, sources, dates, places, etc. */
123                                    I18N::translate('Genealogy data') ?>
124                                </h3>
125                                <ul class="fa-ul">
126                                    <!-- FIND DUPLICATES -->
127                                    <li>
128                                        <span class="fa-li"><?= view('icons/copy') ?></span>
129                                        <a href="<?= e(route('admin-trees-duplicates', ['tree' => $managed_tree->name()])) ?>">
130                                            <?= I18N::translate('Find duplicates') ?>
131                                            <span class="sr-only">
132                                              <?= e($managed_tree->title()) ?>
133                                            </span>
134                                        </a>
135                                    </li>
136                                    <!-- MERGE -->
137                                    <li>
138                                        <span class="fa-li"><?= view('icons/merge') ?></span>
139                                        <a href="<?= e(route('merge-records', ['tree' => $managed_tree->name()])) ?>">
140                                            <?= I18N::translate('Merge records') ?>
141                                            <span class="sr-only">
142                                                <?= e($managed_tree->title()) ?>
143                                          </span>
144                                        </a>
145                                    </li>
146                                    <!-- UPDATE PLACE NAMES -->
147                                    <li>
148                                        <span class="fa-li"><?= view('icons/location') ?></span>
149                                        <a href="<?= e(route('admin-trees-places', ['tree' => $managed_tree->name()])) ?>">
150                                            <?= I18N::translate('Update place names') ?>
151                                            <span class="sr-only">
152                                                <?= e($managed_tree->title()) ?>
153                                            </span>
154                                        </a>
155                                    </li>
156                                    <!-- CHECK FOR ERRORS -->
157                                    <li>
158                                        <span class="fa-li"><?= view('icons/warning') ?></span>
159                                        <a href="<?= e(route('admin-trees-check', ['tree' => $managed_tree->name()])) ?>">
160                                            <?= I18N::translate('Check for errors') ?>
161                                            <span class="sr-only">
162                                                <?= e($managed_tree->title()) ?>
163                                            </span>
164                                        </a>
165                                    </li>
166                                    <!-- UNCONNECTED INDIVIDUALS -->
167                                    <li>
168                                        <span class="fa-li"><?= view('icons/unlink') ?></span>
169                                        <a href="<?= e(route('admin-trees-unconnected', ['tree' => $managed_tree->name()])) ?>">
170                                            <?= I18N::translate('Find unrelated individuals') ?>
171                                            <span class="sr-only">
172                                                <?= e($managed_tree->title()) ?>
173                                            </span>
174                                        </a>
175                                    </li>
176                                    <!-- RENUMBER -->
177                                    <li>
178                                        <span class="fa-li"><?= view('icons/sort') ?></span>
179                                        <a href="<?= e(route('admin-trees-renumber', ['tree' => $managed_tree->name()])) ?>">
180                                            <?= I18N::translate('Renumber') ?>
181                                            <span class="sr-only">
182                                        <?= e($managed_tree->title()) ?>
183                                    </span>
184                                        </a>
185                                    </li>
186                                    <!-- CHANGES -->
187                                    <li>
188                                        <span class="fa-li"><?= view('icons/edit') ?></span>
189                                        <a href="<?= route('admin-changes-log', ['tree' => $managed_tree->name()]) ?>">
190                                            <?= I18N::translate('Changes log') ?>
191                                            <span class="sr-only">
192                                                <?= e($managed_tree->title()) ?>
193                                            </span>
194                                        </a>
195                                    </li>
196                                </ul>
197                            </div>
198                            <div class="clearfix visible-sm-block"></div>
199                            <div class="col-sm-6 col-md-3">
200                                <h3>
201                                    <?= I18N::translate('Add unlinked records') ?>
202                                </h3>
203                                <ul class="fa-ul">
204                                    <!-- UNLINKED INDIVIDUAL -->
205                                    <li>
206                                        <span class="fa-li"><?= view('icons/individual') ?></span>
207                                        <a href="<?= e(route('add-unlinked-individual', ['tree' => $managed_tree->name()])) ?>">
208                                            <?= I18N::translate('Individual') ?>
209                                            <span class="sr-only">
210                                                <?= e($managed_tree->title()) ?>
211                                            </span>
212                                        </a>
213                                    </li>
214                                    <!-- UNLINKED SOURCE -->
215                                    <li>
216                                        <span class="fa-li"><?= view('icons/source') ?></span>
217                                        <a href="#" data-href="<?= e(route('create-source', ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
218                                            <?= I18N::translate('Source') ?>
219                                            <span class="sr-only">
220                                                <?= e($managed_tree->title()) ?>
221                                            </span>
222                                        </a>
223                                    </li>
224                                    <!-- UNLINKED REPOSITORY -->
225                                    <li>
226                                        <span class="fa-li"><?= view('icons/repository') ?></span>
227                                        <a href="#" data-href="<?= e(route('create-repository', ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
228                                            <?= I18N::translate('Repository') ?>
229                                            <span class="sr-only">
230                                                <?= e($managed_tree->title()) ?>
231                                            </span>
232                                        </a>
233                                    </li>
234                                    <!-- UNLINKED MEDIA OBJECT -->
235                                    <li>
236                                        <span class="fa-li"><?= view('icons/media') ?></span>
237                                        <a href="#" data-href="<?= e(route('create-media-object', ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
238
239                                            <?= I18N::translate('Media object') ?>
240                                            <span class="sr-only">
241                                                <?= e($managed_tree->title()) ?>
242                                            </span>
243                                        </a>
244                                    </li>
245                                    <!-- UNLINKED NOTE -->
246                                    <li>
247                                        <span class="fa-li"><?= view('icons/note') ?></span>
248                                        <a href="#" data-href="<?= e(route('create-note-object', ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
249                                            <span class="sr-only">
250                                                <?= e($managed_tree->title()) ?>
251                                            </span>
252                                            <?= I18N::translate('Shared note') ?>
253                                        </a>
254                                    </li>
255                                    <!-- UNLINKED SUBMITTER -->
256                                    <li>
257                                        <span class="fa-li"><?= view('icons/submitter') ?></span>
258                                        <a href="#" data-href="<?= e(route('create-submitter', ['tree' => $managed_tree->name()])) ?>" data-target="#wt-ajax-modal" data-toggle="modal">
259                                            <span class="sr-only">
260                                                <?= e($managed_tree->title()) ?>
261                                            </span>
262                                            <?= I18N::translate('Submitter') ?>
263                                        </a>
264                                    </li>
265                                </ul>
266                            </div>
267                            <div class="col-sm-6 col-md-3">
268                                <h3>
269                                    <?= I18N::translate('GEDCOM file') ?>
270                                </h3>
271                                <ul class="fa-ul">
272                                    <!-- DOWNLOAD/Export -->
273                                    <li>
274                                        <span class="fa-li"><?= view('icons/download') ?></span>
275                                        <a href="<?= e(route('admin-trees-export', ['tree' => $managed_tree->name()])) ?>">
276                                            <?= I18N::translate('Export') ?>
277                                            <span class="sr-only">
278                                        <?= e($managed_tree->title()) ?>
279                                    </span>
280                                        </a>
281                                    </li>
282                                    <!-- UPLOAD/IMPORT -->
283                                    <li>
284                                        <span class="fa-li"><?= view('icons/upload') ?></span>
285                                        <a href="<?= e(route('admin-trees-import', ['tree' => $managed_tree->name()])) ?>">
286                                            <?= I18N::translate('Import') ?>
287                                            <span class="sr-only">
288                                        <?= e($managed_tree->title()) ?>
289                                    </span>
290                                        </a>
291                                    </li>
292                                </ul>
293                            </div>
294                        </div>
295                    </div>
296                </div>
297            </div>
298        <?php endif ?>
299    <?php endforeach ?>
300
301    <!-- BULK LOAD/SYNCHRONISE GEDCOM FILES -->
302    <?php if (count($gedcom_files) >= $multiple_tree_threshold) : ?>
303        <div class="card">
304            <div class="card-header" id="card-tree-create-header">
305                <h2 class="mb-0">
306                    <?= view('icons/sync') ?>
307                    <a data-toggle="collapse" data-parent="#accordion" href="#synchronize-gedcom-files">
308                        <?= I18N::translate('Synchronize family trees with GEDCOM files') ?>
309                    </a>
310                </h2>
311            </div>
312
313            <div id="synchronize-gedcom-files" class="panel-collapse collapse">
314                <div class="card-body">
315                    <p>
316                        <?= I18N::translate('Create, update, and delete a family tree for every GEDCOM file in the data folder.') ?>
317                    </p>
318                    <form method="post" action="<?= e(route('admin-trees-sync')) ?>" class="form form-horizontal">
319                        <?= csrf_field() ?>
320                        <button type="submit" class="btn btn-danger">
321                            <?= view('icons/save') ?>
322                            <?= /* I18N: A button label. */
323                            I18N::translate('continue') ?>
324                        </button>
325                        <p class="small text-muted">
326                            <?= I18N::translate('Caution! This may take a long time. Be patient.') ?>
327                        </p>
328                    </form>
329                </div>
330            </div>
331        </div>
332    <?php endif ?>
333</div>
334
335<?= view('modals/ajax') ?>
336