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