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