xref: /webtrees/resources/views/layouts/default.phtml (revision 00b1984e374faddab4698e73088f0c964e529b65)
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::locale()->direction() ?>" lang="<?= I18N::locale()->languageTag() ?>">
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        <meta name="description" content="<?= $meta_description ?? '' ?>">
31
32        <title>
33            <?= strip_tags($title) ?>
34            <?php if ($tree !== null && $tree->getPreference('META_TITLE') !== '') : ?>
35<?= e($tree->getPreference('META_TITLE')) ?>
36            <?php endif ?>
37        </title>
38
39        <!--Generic favicons-->
40        <link rel="icon" sizes="32x32" href="<?= e(asset('favicon-32.png')) ?>">
41        <link rel="icon" sizes="57x57" href="<?= e(asset('favicon-57.png')) ?>">
42        <link rel="icon" sizes="76x76" href="<?= e(asset('favicon-76.png')) ?>">
43        <link rel="icon" sizes="96x96" href="<?= e(asset('favicon-96.png')) ?>">
44        <link rel="icon" sizes="128x128" href="<?= e(asset('favicon-128.png')) ?>">
45        <link rel="icon" sizes="192x192" href="<?= e(asset('favicon-192.png')) ?>">
46        <!--Android-->
47        <link rel="shortcut icon" sizes="196x196" href="<?= e(asset('favicon-196.png')) ?>">
48        <!--iOS-->
49        <link rel="apple-touch-icon" sizes="120x120" href="<?= e(asset('favicon-120.png')) ?>">
50        <link rel="apple-touch-icon" sizes="152x152" href="<?= e(asset('favicon-152.png')) ?>">
51        <link rel="apple-touch-icon" sizes="180x180" href="<?= e(asset('favicon-180.png')) ?>">
52        <!--Windows 8 IE 10-->
53        <meta name="msapplication-TileColor" content="#FFFFFF">
54        <meta name="msapplication-TileImage" content="<?= e(asset('favicon-144.png')) ?>">
55        <!--Windows 8.1 + IE11 and above-->
56        <meta name="msapplication-config" content="<?= e(asset('browserconfig.xml')) ?>">
57
58        <link rel="manifest" href="<?= e(asset('site.webmanifest')) ?>">
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 {
68    return $module->headContent();
69        })->implode('') ?>
70
71        <?= DebugBar::renderHead() ?>
72    </head>
73
74    <body class="wt-global wt-theme-<?= e(app(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(app(ServerRequestInterface::class)->getAttribute('route')->name) ?>">
75        <header class="wt-header-wrapper d-print-none">
76            <div class="container wt-header-container">
77                <div class="row wt-header-content">
78                    <div class="wt-accessibility-links position-fixed">
79                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
80                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
81                            I18N::translate('Skip to content') ?>
82                        </a>
83                    </div>
84                    <div class="col wt-site-logo"></div>
85
86                    <?php if ($tree !== null) : ?>
87                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
88
89                        <div class="col wt-header-search">
90                            <form method="post" action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>" class="wt-header-search-form" role="search">
91                                <?= csrf_field() ?>
92                                <div class="input-group">
93                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
94                                    <input type="search" class="form-control wt-header-search-field" id="quick-search" name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
95                                    <div class="input-group-append">
96                                        <button type="submit" class="btn btn-primary wt-header-search-button">
97                                            <?= view('icons/search') ?>
98                                        </button>
99                                    </div>
100                                </div>
101                            </form>
102                        </div>
103                    <?php endif ?>
104
105                    <div class="col wt-secondary-navigation">
106                        <ul class="nav wt-user-menu">
107                            <?php foreach (app(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
108                                <?= view('components/menu-item', ['menu' => $menu]) ?>
109                            <?php endforeach ?>
110                        </ul>
111                    </div>
112
113                    <?php if ($tree !== null) : ?>
114                        <nav class="col wt-primary-navigation">
115                            <ul class="nav wt-genealogy-menu">
116                                <?php foreach (app(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
117                                    <?= view('components/menu-item', ['menu' => $menu]) ?>
118                                <?php endforeach ?>
119                            </ul>
120                        </nav>
121                    <?php endif ?>
122                </div>
123            </div>
124        </header>
125
126        <main id="content" class="wt-main-wrapper">
127            <div class="container wt-main-container">
128                <div class="flash-messages">
129                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
130                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
131                            <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
132                                <span aria-hidden="true">&times;</span>
133                            </button>
134                            <?= $message->text ?>
135                        </div>
136                    <?php endforeach ?>
137                </div>
138
139                <?= $content ?>
140            </div>
141        </main>
142
143        <footer class="wt-footers container d-print-none">
144            <?= app(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(static function (ModuleFooterInterface $module) use ($request): string {
145    return $module->getFooter($request);
146            })->implode('') ?>
147        </footer>
148
149        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
150        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
151
152        <script>
153            // Trigger an event when we click on an (any) image
154            $('body').on('click', 'a.gallery', function () {
155                // Enable colorbox for images
156                $("a[type^=image].gallery").colorbox({
157                    // Don't scroll window with document
158                    fixed:          true,
159                    width:          "85%",
160                    height:         "85%",
161                    current:        "",
162                    previous:       '<i class="fas fa-arrow-left wt-icon-flip-rtl" title="<?= I18N::translate('previous') ?>"></i>',
163                    next:           '<i class="fas fa-arrow-right wt-icon-flip-rtl" title="<?= I18N::translate('next') ?>"></i>',
164                    slideshowStart: '<i class="fas fa-play" title="<?= I18N::translate('Play') ?>"></i>',
165                    slideshowStop:  '<i class="fas fa-stop" title="<?= I18N::translate('Stop') ?>"></i>',
166                    close:          '<i class="fas fa-times" title="<?= I18N::translate('close') ?>"></i>',
167                    title:          function () {
168                        return this.dataset.title;
169                    },
170                    photo:          true,
171                    rel:            "gallery", // Turn all images on the page into a slideshow
172                    slideshow:      true,
173                    slideshowAuto:  false,
174                    // Add wheelzoom to the displayed image
175                    onComplete:     function () {
176                        // Disable click on image triggering next image
177                        // https://github.com/jackmoore/colorbox/issues/668
178                        $(".cboxPhoto").unbind("click");
179
180                        wheelzoom(document.querySelectorAll(".cboxPhoto"));
181                    }
182                });
183            });
184        </script>
185
186        <?= View::stack('javascript') ?>
187
188        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
189    return $module->bodyContent();
190        })->implode('') ?>
191
192        <?= DebugBar::render() ?>
193    </body>
194</html>
195