xref: /webtrees/resources/views/layouts/default.phtml (revision d35568b467207589ea9059739da0bf1f7e785a0d)
16ccdf4f0SGreg Roach<?php
26ccdf4f0SGreg Roach
310e06497SGreg Roachdeclare(strict_types=1);
410e06497SGreg Roach
56ccdf4f0SGreg Roachuse Fisharebest\Webtrees\FlashMessages;
6d36fce8cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\AppleTouchIconPng;
7d36fce8cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\BrowserconfigXml;
8f5402f3dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
9439bf5cfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\WebmanifestJson;
106ccdf4f0SGreg Roachuse Fisharebest\Webtrees\I18N;
116ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleFooterInterface;
126ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleGlobalInterface;
136ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleThemeInterface;
14*d35568b4SGreg Roachuse Fisharebest\Webtrees\Registry;
156ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Services\ModuleService;
16a907ae44SGreg Roachuse Fisharebest\Webtrees\Tree;
17b55cbc6bSGreg Roachuse Fisharebest\Webtrees\Validator;
186ccdf4f0SGreg Roachuse Fisharebest\Webtrees\View;
196ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Webtrees;
206ccdf4f0SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
216ccdf4f0SGreg Roach
226ccdf4f0SGreg Roach/**
236ccdf4f0SGreg Roach * @var string                 $content
24a907ae44SGreg Roach * @var ServerRequestInterface $request
25a907ae44SGreg Roach * @var string                 $title
26a907ae44SGreg Roach * @var Tree                   $tree
276ccdf4f0SGreg Roach */
286ccdf4f0SGreg Roach
296ccdf4f0SGreg Roach?>
30dd6b2bfcSGreg Roach
31dd6b2bfcSGreg Roach<!DOCTYPE html>
3265cf5706SGreg Roach<html dir="<?= I18N::locale()->direction() ?>" lang="<?= I18N::locale()->languageTag() ?>">
33dd6b2bfcSGreg Roach    <head>
34dd6b2bfcSGreg Roach        <meta charset="UTF-8">
35dd6b2bfcSGreg Roach        <meta name="csrf" content="<?= e(csrf_token()) ?>">
36dd6b2bfcSGreg Roach        <meta name="viewport" content="width=device-width, initial-scale=1">
37377a2979SGreg Roach        <meta name="robots" content="<?= e($meta_robots ?? 'noindex') ?>">
388d0ebef0SGreg Roach        <meta name="generator" content="<?= e(Webtrees::NAME) ?> <?= e(Webtrees::VERSION) ?>">
392406e0e0SGreg Roach        <meta name="description" content="<?= $meta_description ?? '' ?>">
40dd6b2bfcSGreg Roach
41dd6b2bfcSGreg Roach        <title>
42dd6b2bfcSGreg Roach            <?= strip_tags($title) ?>
43dd6b2bfcSGreg Roach            <?php if ($tree !== null && $tree->getPreference('META_TITLE') !== '') : ?>
44dd6b2bfcSGreg Roach<?= e($tree->getPreference('META_TITLE')) ?>
45dd6b2bfcSGreg Roach            <?php endif ?>
46dd6b2bfcSGreg Roach        </title>
47dd6b2bfcSGreg Roach
48a951c2d0SGreg Roach        <!--iOS-->
49d36fce8cSGreg Roach        <link rel="apple-touch-icon" sizes="180x180" href="<?= e(route(AppleTouchIconPng::class)) ?>">
5052bcc402SGreg Roach        <!--Generic favicons-->
5152bcc402SGreg Roach        <link rel="icon" sizes="32x32" href="<?= e(asset('favicon-32.png')) ?>">
5252bcc402SGreg Roach        <link rel="icon" sizes="192x192" href="<?= e(asset('favicon-192.png')) ?>">
530601cabdSGreg Roach        <!--IE11/Edge-->
54d36fce8cSGreg Roach        <meta name="msapplication-config" content="<?= e(route(BrowserconfigXml::class)) ?>">
55dd6b2bfcSGreg Roach
56a6f0d6ddSGreg Roach        <link rel="manifest" href="<?= e(route(WebmanifestJson::class)) ?>" crossorigin="use-credentials">
57c4d12d2bSGreg Roach
58e837ff07SGreg Roach        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
59*d35568b4SGreg Roach        <?php foreach (Registry::container()->get(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
60e837ff07SGreg Roach            <link rel="stylesheet" href="<?= e($stylesheet) ?>">
61dd6b2bfcSGreg Roach        <?php endforeach ?>
62dd6b2bfcSGreg Roach
63dd6b2bfcSGreg Roach        <?= View::stack('styles') ?>
64dd6b2bfcSGreg Roach
65*d35568b4SGreg Roach        <?= Registry::container()->get(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
66d70512abSGreg Roach            return $module->headContent();
67d70512abSGreg Roach        })->implode('') ?>
68dd6b2bfcSGreg Roach    </head>
69dd6b2bfcSGreg Roach
70*d35568b4SGreg Roach    <body class="wt-global wt-theme-<?= e(Registry::container()->get(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(basename(strtr(Validator::attributes($request)->route()->name ?? '/', ['\\' => '/']))) ?>">
71dd6b2bfcSGreg Roach        <header class="wt-header-wrapper d-print-none">
7216543441SGreg Roach            <div class="container-lg wt-header-container">
73dd6b2bfcSGreg Roach                <div class="row wt-header-content">
7497c22350SGreg Roach                    <div class="wt-accessibility-links position-fixed">
75315eb316SGreg Roach                        <a class="visually-hidden visually-hidden-focusable btn btn-info btn-sm" href="#content">
766ccdf4f0SGreg Roach                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
776ccdf4f0SGreg Roach                            I18N::translate('Skip to content') ?>
78dd6b2bfcSGreg Roach                        </a>
79dd6b2bfcSGreg Roach                    </div>
80dd6b2bfcSGreg Roach                    <div class="col wt-site-logo"></div>
81dd6b2bfcSGreg Roach
82dd6b2bfcSGreg Roach                    <?php if ($tree !== null) : ?>
83cc13d6d8SGreg Roach                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
84dd6b2bfcSGreg Roach
85dd6b2bfcSGreg Roach                        <div class="col wt-header-search">
8681443e3cSGreg Roach                            <form method="post" action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>" class="wt-header-search-form" role="search">
87dd6b2bfcSGreg Roach                                <div class="input-group">
88315eb316SGreg Roach                                    <label class="visually-hidden" for="quick-search"><?= I18N::translate('Search') ?></label>
8981443e3cSGreg Roach
9081443e3cSGreg Roach                                    <input type="search" class="form-control wt-header-search-field" id="quick-search" name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
9181443e3cSGreg Roach
9227c789f1SGreg Roach                                    <button type="submit" class="btn btn-primary wt-header-search-button" aria-label="<?= I18N::translate('Search') ?>">
93dd6b2bfcSGreg Roach                                        <?= view('icons/search') ?>
94dd6b2bfcSGreg Roach                                    </button>
95b6c326d8SGreg Roach                                </div>
9681443e3cSGreg Roach
9781443e3cSGreg Roach                                <?= csrf_field() ?>
98dd6b2bfcSGreg Roach                            </form>
99dd6b2bfcSGreg Roach                        </div>
100dd6b2bfcSGreg Roach                    <?php endif ?>
101dd6b2bfcSGreg Roach
102dd6b2bfcSGreg Roach                    <div class="col wt-secondary-navigation">
1030c8c69d4SGreg Roach                        <ul class="nav wt-user-menu">
104*d35568b4SGreg Roach                            <?php foreach (Registry::container()->get(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
105f78837dcSGreg Roach                                <?= view('components/menu-item', ['menu' => $menu]) ?>
106dd6b2bfcSGreg Roach                            <?php endforeach ?>
107dd6b2bfcSGreg Roach                        </ul>
108dd6b2bfcSGreg Roach                    </div>
109dd6b2bfcSGreg Roach
110dd6b2bfcSGreg Roach                    <?php if ($tree !== null) : ?>
111dd6b2bfcSGreg Roach                        <nav class="col wt-primary-navigation">
1120c8c69d4SGreg Roach                            <ul class="nav wt-genealogy-menu">
113*d35568b4SGreg Roach                                <?php foreach (Registry::container()->get(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
114f78837dcSGreg Roach                                    <?= view('components/menu-item', ['menu' => $menu]) ?>
115dd6b2bfcSGreg Roach                                <?php endforeach ?>
116dd6b2bfcSGreg Roach                            </ul>
117dd6b2bfcSGreg Roach                        </nav>
118dd6b2bfcSGreg Roach                    <?php endif ?>
119dd6b2bfcSGreg Roach                </div>
120dd6b2bfcSGreg Roach            </div>
121dd6b2bfcSGreg Roach        </header>
122dd6b2bfcSGreg Roach
123dd6b2bfcSGreg Roach        <main id="content" class="wt-main-wrapper">
12416543441SGreg Roach            <div class="container-lg wt-main-container">
125dd6b2bfcSGreg Roach                <div class="flash-messages">
126dd6b2bfcSGreg Roach                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
127dd6b2bfcSGreg Roach                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
128315eb316SGreg Roach                            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
129dd6b2bfcSGreg Roach                            </button>
130dd6b2bfcSGreg Roach                            <?= $message->text ?>
131dd6b2bfcSGreg Roach                        </div>
132dd6b2bfcSGreg Roach                    <?php endforeach ?>
133dd6b2bfcSGreg Roach                </div>
134dd6b2bfcSGreg Roach
135dd6b2bfcSGreg Roach                <?= $content ?>
136dd6b2bfcSGreg Roach            </div>
137dd6b2bfcSGreg Roach        </main>
138dd6b2bfcSGreg Roach
13916543441SGreg Roach        <footer class="container-lg wt-footers d-print-none">
140*d35568b4SGreg Roach            <?= Registry::container()->get(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(static function (ModuleFooterInterface $module) use ($request): string {
141d70512abSGreg Roach                return $module->getFooter($request);
142d70512abSGreg Roach            })->implode('') ?>
143dd6b2bfcSGreg Roach        </footer>
144dd6b2bfcSGreg Roach
145ad727080SGreg Roach        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
146ad727080SGreg Roach        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
147dd6b2bfcSGreg Roach
148dd6b2bfcSGreg Roach        <script>
149cee51dfdSGreg Roach            // Trigger an event when we click on an (any) image
150cee51dfdSGreg Roach            $('body').on('click', 'a.gallery', function () {
151cee51dfdSGreg Roach                // Enable colorbox for images
152cee51dfdSGreg Roach                $("a[type^=image].gallery").colorbox({
153cee51dfdSGreg Roach                    // Don't scroll window with document
154cee51dfdSGreg Roach                    fixed: true,
155dd6b2bfcSGreg Roach                    width: "85%",
156dd6b2bfcSGreg Roach                    height: "85%",
157cee51dfdSGreg Roach                    current: "",
15828281361SGreg Roach                    previous: '<i class="fa-solid fa-arrow-left wt-icon-flip-rtl" title="<?= I18N::translate('previous') ?>"></i>',
15928281361SGreg Roach                    next: '<i class="fa-solid fa-arrow-right wt-icon-flip-rtl" title="<?= I18N::translate('next') ?>"></i>',
16028281361SGreg Roach                    slideshowStart: '<i class="fa-solid fa-play" title="<?= I18N::translate('Play') ?>"></i>',
16128281361SGreg Roach                    slideshowStop: '<i class="fa-solid fa-stop" title="<?= I18N::translate('Stop') ?>"></i>',
16228281361SGreg Roach                    close: '<i class="fa-solid fa-times" title="<?= I18N::translate('close') ?>"></i>',
1636ccdf4f0SGreg Roach                    title: function () {
1646ccdf4f0SGreg Roach                        return this.dataset.title;
1656ccdf4f0SGreg Roach                    },
166cee51dfdSGreg Roach                    photo: true,
167cee51dfdSGreg Roach                    rel: "gallery", // Turn all images on the page into a slideshow
168cee51dfdSGreg Roach                    slideshow: true,
169cee51dfdSGreg Roach                    slideshowAuto: false,
170033999b0SGreg Roach                    slideshowSpeed: 4000,
171cee51dfdSGreg Roach                    // Add wheelzoom to the displayed image
172cee51dfdSGreg Roach                    onComplete: function () {
173cee51dfdSGreg Roach                        // Disable click on image triggering next image
174cee51dfdSGreg Roach                        // https://github.com/jackmoore/colorbox/issues/668
175cee51dfdSGreg Roach                        $(".cboxPhoto").unbind("click");
1763cf811e8SGreg Roach                        // Enable wheel/pinch zooming
1773cf811e8SGreg Roach                        $('.cboxPhoto').wrap("<pinch-zoom></pinch-zoom>");
178cee51dfdSGreg Roach                    }
179cee51dfdSGreg Roach                });
180dd6b2bfcSGreg Roach            });
181dd6b2bfcSGreg Roach        </script>
182dd6b2bfcSGreg Roach
183dd6b2bfcSGreg Roach        <?= View::stack('javascript') ?>
184dd6b2bfcSGreg Roach
185*d35568b4SGreg Roach        <?= Registry::container()->get(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
186d70512abSGreg Roach            return $module->bodyContent();
187d70512abSGreg Roach        })->implode('') ?>
188dd6b2bfcSGreg Roach    </body>
189dd6b2bfcSGreg Roach</html>
190