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