xref: /webtrees/resources/views/layouts/administration.phtml (revision 1a218474113038005e50986fff24ebcbd58554ff)
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\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;
13use Psr\Http\Message\ServerRequestInterface;
14
15/** @var string $title */
16/** @var string $content */
17
18?>
19
20<!DOCTYPE html>
21<html dir="<?= I18N::direction() ?>" lang="<?= WT_LOCALE ?>">
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><?= $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 { return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->headContent(); })->implode('') ?>
37
38        <?= DebugBar::renderHead() ?>
39    </head>
40    <body class="container wt-global wt-route-<?= e(app(ServerRequestInterface::class)->getAttribute('route')) ?>">
41        <header>
42            <div class="wt-accessibility-links position-fixed">
43                <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
44                    <?= /* I18N: Skip over the headers and menus, to the main content of the page */
45                    I18N::translate('Skip to content') ?>
46                </a>
47            </div>
48
49            <ul class="nav small d-flex justify-content-end">
50                <li class="nav-item menu-mypage">
51                    <a class="nav-link active" href="<?= e(route(HomePage::class)) ?>"><?= I18N::translate('My page') ?></a>
52                </li>
53                <li class="nav-item dropdown menu-language">
54                    <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
55                        <?= I18N::translate('Language') ?>
56                    </a>
57                    <div class="dropdown-menu">
58                        <?php foreach (I18N::activeLocales() as $locale) : ?>
59                            <a class="dropdown-item menu-language-<?= $locale->languageTag() ?> <?= WT_LOCALE === $locale->languageTag() ? ' active' : '' ?>" data-language="<?= $locale->languageTag() ?>" href="#"><?= $locale->endonym() ?></a>
60                        <?php endforeach ?>
61                    </div>
62                </li>
63                <li class="nav-item menu-logout">
64                    <a class="nav-link" href="#" data-post-url="<?= e(route(Logout::class)) ?>"><?= I18N::translate('Sign out') ?></a>
65                </li>
66            </ul>
67        </header>
68
69        <div id="content"></div>
70
71        <?php foreach (FlashMessages::getMessages() as $message) : ?>
72            <div class="alert alert-<?= $message->status ?> alert-dismissible" role="alert">
73                <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
74                    <span aria-hidden="true">&times;</span>
75                </button>
76                <?= $message->text ?>
77            </div>
78        <?php endforeach ?>
79
80        <?= $content ?>
81
82        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
83        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
84
85        <?= View::stack('javascript') ?>
86
87        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->bodyContent(); })->implode('') ?>
88
89        <?= DebugBar::render() ?>
90    </body>
91</html>
92