xref: /webtrees/resources/views/layouts/default.phtml (revision f5402f3dbd759ec94d88460e5ae9815f9b823dae)
1<?php
2
3use Fisharebest\Webtrees\DebugBar;
4use Fisharebest\Webtrees\FlashMessages;
5use Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Module\ModuleFooterInterface;
8use Fisharebest\Webtrees\Module\ModuleGlobalInterface;
9use Fisharebest\Webtrees\Module\ModuleThemeInterface;
10use Fisharebest\Webtrees\Services\ModuleService;
11use Fisharebest\Webtrees\View;
12use Fisharebest\Webtrees\Webtrees;
13use Psr\Http\Message\ServerRequestInterface;
14
15/**
16 * @var string $title
17 * @var string $content
18 */
19
20?>
21
22<!DOCTYPE html>
23<html dir="<?= I18N::direction() ?>" lang="<?= WT_LOCALE ?>">
24    <head>
25        <meta charset="UTF-8">
26        <meta name="csrf" content="<?= e(csrf_token()) ?>">
27        <meta name="viewport" content="width=device-width, initial-scale=1">
28        <meta name="robots" content="<?= e($meta_robots ?? 'noindex') ?>">
29        <meta name="generator" content="<?= e(Webtrees::NAME) ?> <?= e(Webtrees::VERSION) ?>">
30        <?php if ($tree !== null) : ?>
31            <meta name="description" content="<?= e($tree->getPreference('META_DESCRIPTION')) ?>">
32        <?php endif ?>
33
34        <title>
35            <?= strip_tags($title) ?>
36            <?php if ($tree !== null && $tree->getPreference('META_TITLE') !== '') : ?>
37<?= e($tree->getPreference('META_TITLE')) ?>
38            <?php endif ?>
39        </title>
40
41        <!--Generic favicons-->
42        <link rel="icon" sizes="32x32" href="<?= e(asset('favicon-32.png')) ?>">
43        <link rel="icon" sizes="57x57" href="<?= e(asset('favicon-57.png')) ?>">
44        <link rel="icon" sizes="76x76" href="<?= e(asset('favicon-76.png')) ?>">
45        <link rel="icon" sizes="96x96" href="<?= e(asset('favicon-96.png')) ?>">
46        <link rel="icon" sizes="128x128" href="<?= e(asset('favicon-128.png')) ?>">
47        <link rel="icon" sizes="192x192" href="<?= e(asset('favicon-192.png')) ?>">
48        <!--Android-->
49        <link rel="shortcut icon" sizes="196x196" href="<?= e(asset('favicon-196.png')) ?>">
50        <!--iOS-->
51        <link rel="apple-touch-icon" sizes="120x120" href="<?= e(asset('favicon-120.png')) ?>">
52        <link rel="apple-touch-icon" sizes="152x152" href="<?= e(asset('favicon-152.png')) ?>">
53        <link rel="apple-touch-icon" sizes="180x180" href="<?= e(asset('favicon-180.png')) ?>">
54        <!--Windows 8 IE 10-->
55        <meta name="msapplication-TileColor" content="#FFFFFF">
56        <meta name="msapplication-TileImage" content="<?= e(asset('favicon-144.png')) ?>">
57        <!--Windows 8.1 + IE11 and above-->
58        <meta name="msapplication-config" content="<?= e(asset('browserconfig.xml')) ?>">
59
60        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
61        <?php foreach (app(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
62            <link rel="stylesheet" href="<?= e($stylesheet) ?>">
63        <?php endforeach ?>
64
65        <?= View::stack('styles') ?>
66
67        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module->headContent(); })->implode('') ?>
68
69        <?= DebugBar::renderHead() ?>
70    </head>
71
72    <body class="wt-global wt-theme-<?= e(app(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(app(ServerRequestInterface::class)->getAttribute('route')) ?>">
73        <header class="wt-header-wrapper d-print-none">
74            <div class="container wt-header-container">
75                <div class="row wt-header-content">
76                    <div class="wt-accessibility-links position-fixed">
77                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
78                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
79                            I18N::translate('Skip to content') ?>
80                        </a>
81                    </div>
82                    <div class="col wt-site-logo"></div>
83
84                    <?php if ($tree !== null) : ?>
85                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
86
87                        <div class="col wt-header-search">
88                            <form method="post" action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>" class="wt-header-search-form" role="search">
89                                <div class="input-group">
90                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
91                                    <input type="search" class="form-control wt-header-search-field" id="quick-search" name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
92                                    <div class="input-group-append">
93                                        <button type="submit" class="btn btn-primary wt-header-search-button">
94                                            <?= view('icons/search') ?>
95                                        </button>
96                                    </div>
97                                </div>
98                            </form>
99                        </div>
100                    <?php endif ?>
101
102                    <div class="col wt-secondary-navigation">
103                        <ul class="nav wt-user-menu">
104                            <?php foreach (app(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
105                                <?= $menu->bootstrap4() ?>
106                            <?php endforeach ?>
107                        </ul>
108                    </div>
109
110                    <?php if ($tree !== null) : ?>
111                        <nav class="col wt-primary-navigation">
112                            <ul class="nav wt-genealogy-menu">
113                                <?php foreach (app(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
114                                    <?= $menu->bootstrap4() ?>
115                                <?php endforeach ?>
116                            </ul>
117                        </nav>
118                    <?php endif ?>
119                </div>
120            </div>
121        </header>
122
123        <main id="content" class="wt-main-wrapper">
124            <div class="container wt-main-container">
125                <div class="flash-messages">
126                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
127                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
128                            <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
129                                <span aria-hidden="true">&times;</span>
130                            </button>
131                            <?= $message->text ?>
132                        </div>
133                    <?php endforeach ?>
134                </div>
135
136                <?= $content ?>
137            </div>
138        </main>
139
140        <footer class="wt-footers container d-print-none">
141            <?= app(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(static function (ModuleFooterInterface $module) use ($request): string { return $module->getFooter($request); })->implode('') ?>
142        </footer>
143
144        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
145        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
146
147        <script>
148            activate_colorbox();
149            jQuery.extend(jQuery.colorbox.settings, {
150                width:          "85%",
151                height:         "85%",
152                transition:     "none",
153                slideshowStart: "<?= I18N::translate('Play') ?>",
154                slideshowStop:  "<?= I18N::translate('Stop') ?>",
155                title:          function () {
156                    return this.dataset.title;
157                },
158            });
159        </script>
160
161        <?= View::stack('javascript') ?>
162
163        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string { return $module->bodyContent(); })->implode('') ?>
164
165        <?= DebugBar::render() ?>
166    </body>
167</html>
168