xref: /webtrees/resources/views/layouts/administration.phtml (revision b6017f990d38d8c56e04c0096ce9a7e8745ad4ba)
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;
14
15/** @var string $title */
16/** @var string $content */
17
18?>
19
20<!DOCTYPE html>
21<html dir="<?= I18N::locale()->direction() ?>" lang="<?= I18N::locale()->languageTag() ?>">
22    <head>
23        <meta charset="UTF-8">
24        <meta name="viewport" content="width=device-width, initial-scale=1">
25        <meta name="csrf" content="<?= e(csrf_token()) ?>">
26
27        <title><?= strip_tags($title) ?></title>
28
29        <link rel="icon" href="<?= e(asset('favicon.ico')) ?>" type="image/x-icon">
30
31        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
32        <link rel="stylesheet" href="<?= e(asset('css/administration.min.css')) ?>">
33
34        <?= View::stack('styles') ?>
35
36        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
37    return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->headContent();
38        })->implode('') ?>
39
40        <?= DebugBar::renderHead() ?>
41    </head>
42    <body class="container-lg wt-global wt-control-panel">
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() ?> <?= I18N::languageTag() === $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)) ?>" data-reload-url="<?= e(route(HomePage::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 {
90    return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->bodyContent();
91        })->implode('') ?>
92
93        <?= DebugBar::render() ?>
94    </body>
95</html>
96