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