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