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