xref: /webtrees/resources/views/layouts/administration.phtml (revision e3c147d0d53873311b7c137c41b4439e01d4189e)
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?>
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
41        <?= DebugBar::renderHead() ?>
42    </head>
43    <body class="container wt-global wt-control-panel wt-route-<?= e(app(ServerRequestInterface::class)->getAttribute('route')->name) ?>">
44        <header>
45            <div class="wt-accessibility-links position-fixed">
46                <a class="sr-only sr-only-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-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-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-post-url="<?= e(route(Logout::class)) ?>"><?= I18N::translate('Sign out') ?></a>
68                </li>
69            </ul>
70        </header>
71
72        <div id="content"></div>
73
74        <?php foreach (FlashMessages::getMessages() as $message) : ?>
75            <div class="alert alert-<?= $message->status ?> alert-dismissible" role="alert">
76                <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
77                    <span aria-hidden="true">&times;</span>
78                </button>
79                <?= $message->text ?>
80            </div>
81        <?php endforeach ?>
82
83        <?= $content ?>
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
94        <?= DebugBar::render() ?>
95    </body>
96</html>
97