xref: /webtrees/resources/views/layouts/administration.phtml (revision 8e8cc1789a4650d0c35646fe9d3377735c49816a)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\FlashMessages;
6use Fisharebest\Webtrees\Http\RequestHandlers\Logout;
7use Fisharebest\Webtrees\Http\RequestHandlers\HomePage;
8use Fisharebest\Webtrees\Http\RequestHandlers\SelectLanguage;
9use Fisharebest\Webtrees\I18N;
10use Fisharebest\Webtrees\Module\CustomCssJsModule;
11use Fisharebest\Webtrees\Module\ModuleCustomInterface;
12use Fisharebest\Webtrees\Module\ModuleGlobalInterface;
13use Fisharebest\Webtrees\Registry;
14use Fisharebest\Webtrees\Services\ModuleService;
15use Fisharebest\Webtrees\View;
16
17/**
18 * @var string $title
19 * @var string $content
20 */
21
22?>
23
24<!DOCTYPE html>
25<html dir="<?= I18N::locale()->direction() ?>" lang="<?= I18N::locale()->languageTag() ?>">
26    <head>
27        <meta charset="UTF-8">
28        <meta name="viewport" content="width=device-width, initial-scale=1">
29        <meta name="csrf" content="<?= e(csrf_token()) ?>">
30
31        <title><?= strip_tags($title) ?></title>
32
33        <link rel="icon" href="<?= e(asset('favicon.ico')) ?>" type="image/x-icon">
34
35        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
36        <link rel="stylesheet" href="<?= e(asset('css/administration.min.css')) ?>">
37
38        <?= View::stack('styles') ?>
39
40        <?= Registry::container()->get(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
41    return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->headContent();
42        })->implode('') ?>
43    </head>
44    <body class="container-lg wt-global wt-control-panel">
45        <header>
46            <div class="wt-accessibility-links position-fixed">
47                <a class="visually-hidden visually-hidden-focusable btn btn-info btn-sm" href="#content">
48                    <?= /* I18N: Skip over the headers and menus, to the main content of the page */
49                    I18N::translate('Skip to content') ?>
50                </a>
51            </div>
52
53            <ul class="nav small d-flex justify-content-end">
54                <li class="nav-item menu-mypage">
55                    <a class="nav-link active" href="<?= e(route(HomePage::class)) ?>"><?= I18N::translate('My page') ?></a>
56                </li>
57                <li class="nav-item dropdown menu-language">
58                    <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
59                        <?= I18N::translate('Language') ?>
60                    </a>
61                    <div class="dropdown-menu">
62                        <?php foreach (I18N::activeLocales() as $locale) : ?>
63                            <a class="dropdown-item menu-language-<?= $locale->languageTag() ?> <?= I18N::languageTag() === $locale->languageTag() ? ' active' : '' ?>" href="#" data-wt-post-url="<?= e(route(SelectLanguage::class, ['language' => $locale->languageTag()])) ?>"><?= $locale->endonym() ?></a>
64                        <?php endforeach ?>
65                    </div>
66                </li>
67                <li class="nav-item menu-logout">
68                    <a class="nav-link" href="#" data-wt-post-url="<?= e(route(Logout::class)) ?>" data-wt-reload-url="<?= e(route(HomePage::class)) ?>"><?= I18N::translate('Sign out') ?></a>
69                </li>
70            </ul>
71        </header>
72
73        <main id="content">
74            <?php foreach (FlashMessages::getMessages() as $message) : ?>
75                <div class="alert alert-<?= $message->status ?> alert-dismissible" role="alert">
76                    <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
77                    </button>
78                    <?= $message->text ?>
79                </div>
80            <?php endforeach ?>
81
82            <?= $content ?>
83        </main>
84
85
86        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
87        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
88
89        <?= View::stack('javascript') ?>
90
91        <?= Registry::container()->get(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
92    return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->bodyContent();
93        })->implode('') ?>
94    </body>
95</html>
96