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