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