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