xref: /webtrees/resources/views/layouts/default.phtml (revision a907ae444ee9e5c94de12917f8eb2ee22b571ddf)
16ccdf4f0SGreg Roach<?php
26ccdf4f0SGreg Roach
36ccdf4f0SGreg Roachuse Fisharebest\Webtrees\DebugBar;
46ccdf4f0SGreg Roachuse Fisharebest\Webtrees\FlashMessages;
5f5402f3dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\SearchQuickAction;
66ccdf4f0SGreg Roachuse Fisharebest\Webtrees\I18N;
76ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleFooterInterface;
86ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleGlobalInterface;
96ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Module\ModuleThemeInterface;
106ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Services\ModuleService;
11*a907ae44SGreg Roachuse Fisharebest\Webtrees\Tree;
126ccdf4f0SGreg Roachuse Fisharebest\Webtrees\View;
136ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Webtrees;
146ccdf4f0SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
156ccdf4f0SGreg Roach
166ccdf4f0SGreg Roach/**
176ccdf4f0SGreg Roach * @var string                 $content
18*a907ae44SGreg Roach * @var ServerRequestInterface $request
19*a907ae44SGreg Roach * @var string                 $title
20*a907ae44SGreg Roach * @var Tree                   $tree
216ccdf4f0SGreg Roach */
226ccdf4f0SGreg Roach
236ccdf4f0SGreg Roach?>
24dd6b2bfcSGreg Roach
25dd6b2bfcSGreg Roach<!DOCTYPE html>
2665cf5706SGreg Roach<html dir="<?= I18N::locale()->direction() ?>" lang="<?= I18N::locale()->languageTag() ?>">
27dd6b2bfcSGreg Roach    <head>
28dd6b2bfcSGreg Roach        <meta charset="UTF-8">
29dd6b2bfcSGreg Roach        <meta name="csrf" content="<?= e(csrf_token()) ?>">
30dd6b2bfcSGreg Roach        <meta name="viewport" content="width=device-width, initial-scale=1">
31377a2979SGreg Roach        <meta name="robots" content="<?= e($meta_robots ?? 'noindex') ?>">
328d0ebef0SGreg Roach        <meta name="generator" content="<?= e(Webtrees::NAME) ?> <?= e(Webtrees::VERSION) ?>">
332406e0e0SGreg Roach        <meta name="description" content="<?= $meta_description ?? '' ?>">
34dd6b2bfcSGreg Roach
35dd6b2bfcSGreg Roach        <title>
36dd6b2bfcSGreg Roach            <?= strip_tags($title) ?>
37dd6b2bfcSGreg Roach            <?php if ($tree !== null && $tree->getPreference('META_TITLE') !== '') : ?>
38dd6b2bfcSGreg Roach<?= e($tree->getPreference('META_TITLE')) ?>
39dd6b2bfcSGreg Roach            <?php endif ?>
40dd6b2bfcSGreg Roach        </title>
41dd6b2bfcSGreg Roach
4252bcc402SGreg Roach        <!--Generic favicons-->
4352bcc402SGreg Roach        <link rel="icon" sizes="32x32" href="<?= e(asset('favicon-32.png')) ?>">
4452bcc402SGreg Roach        <link rel="icon" sizes="128x128" href="<?= e(asset('favicon-128.png')) ?>">
4552bcc402SGreg Roach        <link rel="icon" sizes="192x192" href="<?= e(asset('favicon-192.png')) ?>">
4652bcc402SGreg Roach        <!--Android-->
4790b733bfSGreg Roach        <link rel="shortcut icon" sizes="196x196" href="<?= e(asset('favicon-196.png')) ?>">
480601cabdSGreg Roach        <!--iPad-->
4952bcc402SGreg Roach        <link rel="apple-touch-icon" sizes="152x152" href="<?= e(asset('favicon-152.png')) ?>">
500601cabdSGreg Roach        <!--iPhone-->
5152bcc402SGreg Roach        <link rel="apple-touch-icon" sizes="180x180" href="<?= e(asset('favicon-180.png')) ?>">
520601cabdSGreg Roach        <!--IE11/Edge-->
5352bcc402SGreg Roach        <meta name="msapplication-config" content="<?= e(asset('browserconfig.xml')) ?>">
54dd6b2bfcSGreg Roach
55c4d12d2bSGreg Roach        <link rel="manifest" href="<?= e(asset('site.webmanifest')) ?>">
56c4d12d2bSGreg Roach
57e837ff07SGreg Roach        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
58cab242e7SGreg Roach        <?php foreach (app(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
59e837ff07SGreg Roach            <link rel="stylesheet" href="<?= e($stylesheet) ?>">
60dd6b2bfcSGreg Roach        <?php endforeach ?>
61dd6b2bfcSGreg Roach
62dd6b2bfcSGreg Roach        <?= View::stack('styles') ?>
63dd6b2bfcSGreg Roach
64d70512abSGreg Roach        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
65d70512abSGreg Roach            return $module->headContent();
66d70512abSGreg Roach        })->implode('') ?>
67dd6b2bfcSGreg Roach
68dd6b2bfcSGreg Roach        <?= DebugBar::renderHead() ?>
69dd6b2bfcSGreg Roach    </head>
70dd6b2bfcSGreg Roach
71*a907ae44SGreg Roach    <body class="wt-global wt-theme-<?= e(app(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(substr(strrchr($request->getAttribute('route')->name, '\\'),1)) ?>">
72dd6b2bfcSGreg Roach        <header class="wt-header-wrapper d-print-none">
73dd6b2bfcSGreg Roach            <div class="container wt-header-container">
74dd6b2bfcSGreg Roach                <div class="row wt-header-content">
7597c22350SGreg Roach                    <div class="wt-accessibility-links position-fixed">
76dd6b2bfcSGreg Roach                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
776ccdf4f0SGreg Roach                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
786ccdf4f0SGreg Roach                            I18N::translate('Skip to content') ?>
79dd6b2bfcSGreg Roach                        </a>
80dd6b2bfcSGreg Roach                    </div>
81dd6b2bfcSGreg Roach                    <div class="col wt-site-logo"></div>
82dd6b2bfcSGreg Roach
83dd6b2bfcSGreg Roach                    <?php if ($tree !== null) : ?>
84cc13d6d8SGreg Roach                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
85dd6b2bfcSGreg Roach
86dd6b2bfcSGreg Roach                        <div class="col wt-header-search">
87*a907ae44SGreg Roach                            <form method="post"
88*a907ae44SGreg Roach                                  action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>"
89*a907ae44SGreg Roach                                  class="wt-header-search-form" role="search">
90d1fc782cSGreg Roach                                <?= csrf_field() ?>
91dd6b2bfcSGreg Roach                                <div class="input-group">
92dd6b2bfcSGreg Roach                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
93*a907ae44SGreg Roach                                    <input type="search" class="form-control wt-header-search-field" id="quick-search"
94*a907ae44SGreg Roach                                           name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
95b6c326d8SGreg Roach                                    <div class="input-group-append">
96dd6b2bfcSGreg Roach                                        <button type="submit" class="btn btn-primary wt-header-search-button">
97dd6b2bfcSGreg Roach                                            <?= view('icons/search') ?>
98dd6b2bfcSGreg Roach                                        </button>
99b6c326d8SGreg Roach                                    </div>
100dd6b2bfcSGreg Roach                                </div>
101dd6b2bfcSGreg Roach                            </form>
102dd6b2bfcSGreg Roach                        </div>
103dd6b2bfcSGreg Roach                    <?php endif ?>
104dd6b2bfcSGreg Roach
105dd6b2bfcSGreg Roach                    <div class="col wt-secondary-navigation">
1060c8c69d4SGreg Roach                        <ul class="nav wt-user-menu">
107cab242e7SGreg Roach                            <?php foreach (app(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
108f78837dcSGreg Roach                                <?= view('components/menu-item', ['menu' => $menu]) ?>
109dd6b2bfcSGreg Roach                            <?php endforeach ?>
110dd6b2bfcSGreg Roach                        </ul>
111dd6b2bfcSGreg Roach                    </div>
112dd6b2bfcSGreg Roach
113dd6b2bfcSGreg Roach                    <?php if ($tree !== null) : ?>
114dd6b2bfcSGreg Roach                        <nav class="col wt-primary-navigation">
1150c8c69d4SGreg Roach                            <ul class="nav wt-genealogy-menu">
116cab242e7SGreg Roach                                <?php foreach (app(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
117f78837dcSGreg Roach                                    <?= view('components/menu-item', ['menu' => $menu]) ?>
118dd6b2bfcSGreg Roach                                <?php endforeach ?>
119dd6b2bfcSGreg Roach                            </ul>
120dd6b2bfcSGreg Roach                        </nav>
121dd6b2bfcSGreg Roach                    <?php endif ?>
122dd6b2bfcSGreg Roach                </div>
123dd6b2bfcSGreg Roach            </div>
124dd6b2bfcSGreg Roach        </header>
125dd6b2bfcSGreg Roach
126dd6b2bfcSGreg Roach        <main id="content" class="wt-main-wrapper">
127dd6b2bfcSGreg Roach            <div class="container wt-main-container">
128dd6b2bfcSGreg Roach                <div class="flash-messages">
129dd6b2bfcSGreg Roach                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
130dd6b2bfcSGreg Roach                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
131*a907ae44SGreg Roach                            <button type="button" class="close" data-dismiss="alert"
132*a907ae44SGreg Roach                                    aria-label="<?= I18N::translate('close') ?>">
133dd6b2bfcSGreg Roach                                <span aria-hidden="true">&times;</span>
134dd6b2bfcSGreg Roach                            </button>
135dd6b2bfcSGreg Roach                            <?= $message->text ?>
136dd6b2bfcSGreg Roach                        </div>
137dd6b2bfcSGreg Roach                    <?php endforeach ?>
138dd6b2bfcSGreg Roach                </div>
139dd6b2bfcSGreg Roach
140dd6b2bfcSGreg Roach                <?= $content ?>
141dd6b2bfcSGreg Roach            </div>
142dd6b2bfcSGreg Roach        </main>
143dd6b2bfcSGreg Roach
14497c22350SGreg Roach        <footer class="wt-footers container d-print-none">
145d70512abSGreg Roach            <?= app(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(static function (ModuleFooterInterface $module) use ($request): string {
146d70512abSGreg Roach                return $module->getFooter($request);
147d70512abSGreg Roach            })->implode('') ?>
148dd6b2bfcSGreg Roach        </footer>
149dd6b2bfcSGreg Roach
150ad727080SGreg Roach        <script src="<?= e(asset('js/vendor.min.js')) ?>"></script>
151ad727080SGreg Roach        <script src="<?= e(asset('js/webtrees.min.js')) ?>"></script>
152dd6b2bfcSGreg Roach
153dd6b2bfcSGreg Roach        <script>
154cee51dfdSGreg Roach            // Trigger an event when we click on an (any) image
155cee51dfdSGreg Roach            $('body').on('click', 'a.gallery', function () {
156cee51dfdSGreg Roach                // Enable colorbox for images
157cee51dfdSGreg Roach                $("a[type^=image].gallery").colorbox({
158cee51dfdSGreg Roach                    // Don't scroll window with document
159cee51dfdSGreg Roach                    fixed: true,
160dd6b2bfcSGreg Roach                    width: "85%",
161dd6b2bfcSGreg Roach                    height: "85%",
162cee51dfdSGreg Roach                    current: "",
163cee51dfdSGreg Roach                    previous: '<i class="fas fa-arrow-left wt-icon-flip-rtl" title="<?= I18N::translate('previous') ?>"></i>',
164cee51dfdSGreg Roach                    next: '<i class="fas fa-arrow-right wt-icon-flip-rtl" title="<?= I18N::translate('next') ?>"></i>',
165cee51dfdSGreg Roach                    slideshowStart: '<i class="fas fa-play" title="<?= I18N::translate('Play') ?>"></i>',
166cee51dfdSGreg Roach                    slideshowStop: '<i class="fas fa-stop" title="<?= I18N::translate('Stop') ?>"></i>',
167cee51dfdSGreg Roach                    close: '<i class="fas fa-times" title="<?= I18N::translate('close') ?>"></i>',
1686ccdf4f0SGreg Roach                    title: function () {
1696ccdf4f0SGreg Roach                        return this.dataset.title;
1706ccdf4f0SGreg Roach                    },
171cee51dfdSGreg Roach                    photo: true,
172cee51dfdSGreg Roach                    rel: "gallery", // Turn all images on the page into a slideshow
173cee51dfdSGreg Roach                    slideshow: true,
174cee51dfdSGreg Roach                    slideshowAuto: false,
175cee51dfdSGreg Roach                    // Add wheelzoom to the displayed image
176cee51dfdSGreg Roach                    onComplete: function () {
177cee51dfdSGreg Roach                        // Disable click on image triggering next image
178cee51dfdSGreg Roach                        // https://github.com/jackmoore/colorbox/issues/668
179cee51dfdSGreg Roach                        $(".cboxPhoto").unbind("click");
180cee51dfdSGreg Roach
181cee51dfdSGreg Roach                        wheelzoom(document.querySelectorAll(".cboxPhoto"));
182cee51dfdSGreg Roach                    }
183cee51dfdSGreg Roach                });
184dd6b2bfcSGreg Roach            });
185dd6b2bfcSGreg Roach        </script>
186dd6b2bfcSGreg Roach
187dd6b2bfcSGreg Roach        <?= View::stack('javascript') ?>
188dd6b2bfcSGreg Roach
189d70512abSGreg Roach        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
190d70512abSGreg Roach            return $module->bodyContent();
191d70512abSGreg Roach        })->implode('') ?>
192abafa13cSGreg Roach
193dd6b2bfcSGreg Roach        <?= DebugBar::render() ?>
194dd6b2bfcSGreg Roach    </body>
195dd6b2bfcSGreg Roach</html>
196