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