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