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