xref: /webtrees/resources/views/layouts/default.phtml (revision a951c2d069b2f799cc35677fa0257021e2ce903b)
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;
11a907ae44SGreg 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
18a907ae44SGreg Roach * @var ServerRequestInterface $request
19a907ae44SGreg Roach * @var string                 $title
20a907ae44SGreg 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
42*a951c2d0SGreg Roach        <!--iOS-->
43*a951c2d0SGreg Roach        <link rel="apple-touch-icon" sizes="180x180" href="<?= e(asset('apple-touch-icon.png')) ?>">
4452bcc402SGreg Roach        <!--Generic favicons-->
4552bcc402SGreg Roach        <link rel="icon" sizes="32x32" href="<?= e(asset('favicon-32.png')) ?>">
4652bcc402SGreg Roach        <link rel="icon" sizes="192x192" href="<?= e(asset('favicon-192.png')) ?>">
470601cabdSGreg Roach        <!--IE11/Edge-->
4852bcc402SGreg Roach        <meta name="msapplication-config" content="<?= e(asset('browserconfig.xml')) ?>">
49dd6b2bfcSGreg Roach
50c4d12d2bSGreg Roach        <link rel="manifest" href="<?= e(asset('site.webmanifest')) ?>">
51c4d12d2bSGreg Roach
52e837ff07SGreg Roach        <link rel="stylesheet" href="<?= e(asset('css/vendor.min.css')) ?>">
53cab242e7SGreg Roach        <?php foreach (app(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
54e837ff07SGreg Roach            <link rel="stylesheet" href="<?= e($stylesheet) ?>">
55dd6b2bfcSGreg Roach        <?php endforeach ?>
56dd6b2bfcSGreg Roach
57dd6b2bfcSGreg Roach        <?= View::stack('styles') ?>
58dd6b2bfcSGreg Roach
59d70512abSGreg Roach        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
60d70512abSGreg Roach            return $module->headContent();
61d70512abSGreg Roach        })->implode('') ?>
62dd6b2bfcSGreg Roach
63dd6b2bfcSGreg Roach        <?= DebugBar::renderHead() ?>
64dd6b2bfcSGreg Roach    </head>
65dd6b2bfcSGreg Roach
66a907ae44SGreg Roach    <body class="wt-global wt-theme-<?= e(app(ModuleThemeInterface::class)->name()) ?> wt-route-<?= e(substr(strrchr($request->getAttribute('route')->name, '\\'),1)) ?>">
67dd6b2bfcSGreg Roach        <header class="wt-header-wrapper d-print-none">
6816543441SGreg Roach            <div class="container-lg wt-header-container">
69dd6b2bfcSGreg Roach                <div class="row wt-header-content">
7097c22350SGreg Roach                    <div class="wt-accessibility-links position-fixed">
71dd6b2bfcSGreg Roach                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
726ccdf4f0SGreg Roach                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */
736ccdf4f0SGreg Roach                            I18N::translate('Skip to content') ?>
74dd6b2bfcSGreg Roach                        </a>
75dd6b2bfcSGreg Roach                    </div>
76dd6b2bfcSGreg Roach                    <div class="col wt-site-logo"></div>
77dd6b2bfcSGreg Roach
78dd6b2bfcSGreg Roach                    <?php if ($tree !== null) : ?>
79cc13d6d8SGreg Roach                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
80dd6b2bfcSGreg Roach
81dd6b2bfcSGreg Roach                        <div class="col wt-header-search">
82a907ae44SGreg Roach                            <form method="post"
83a907ae44SGreg Roach                                  action="<?= e(route(SearchQuickAction::class, ['tree' => $tree->name()])) ?>"
84a907ae44SGreg Roach                                  class="wt-header-search-form" role="search">
85d1fc782cSGreg Roach                                <?= csrf_field() ?>
86dd6b2bfcSGreg Roach                                <div class="input-group">
87dd6b2bfcSGreg Roach                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
88a907ae44SGreg Roach                                    <input type="search" class="form-control wt-header-search-field" id="quick-search"
89a907ae44SGreg Roach                                           name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
90b6c326d8SGreg Roach                                    <div class="input-group-append">
91dd6b2bfcSGreg Roach                                        <button type="submit" class="btn btn-primary wt-header-search-button">
92dd6b2bfcSGreg Roach                                            <?= view('icons/search') ?>
93dd6b2bfcSGreg Roach                                        </button>
94b6c326d8SGreg Roach                                    </div>
95dd6b2bfcSGreg Roach                                </div>
96dd6b2bfcSGreg Roach                            </form>
97dd6b2bfcSGreg Roach                        </div>
98dd6b2bfcSGreg Roach                    <?php endif ?>
99dd6b2bfcSGreg Roach
100dd6b2bfcSGreg Roach                    <div class="col wt-secondary-navigation">
1010c8c69d4SGreg Roach                        <ul class="nav wt-user-menu">
102cab242e7SGreg Roach                            <?php foreach (app(ModuleThemeInterface::class)->userMenu($tree) as $menu) : ?>
103f78837dcSGreg Roach                                <?= view('components/menu-item', ['menu' => $menu]) ?>
104dd6b2bfcSGreg Roach                            <?php endforeach ?>
105dd6b2bfcSGreg Roach                        </ul>
106dd6b2bfcSGreg Roach                    </div>
107dd6b2bfcSGreg Roach
108dd6b2bfcSGreg Roach                    <?php if ($tree !== null) : ?>
109dd6b2bfcSGreg Roach                        <nav class="col wt-primary-navigation">
1100c8c69d4SGreg Roach                            <ul class="nav wt-genealogy-menu">
111cab242e7SGreg Roach                                <?php foreach (app(ModuleThemeInterface::class)->genealogyMenu($tree) as $menu) : ?>
112f78837dcSGreg Roach                                    <?= view('components/menu-item', ['menu' => $menu]) ?>
113dd6b2bfcSGreg Roach                                <?php endforeach ?>
114dd6b2bfcSGreg Roach                            </ul>
115dd6b2bfcSGreg Roach                        </nav>
116dd6b2bfcSGreg Roach                    <?php endif ?>
117dd6b2bfcSGreg Roach                </div>
118dd6b2bfcSGreg Roach            </div>
119dd6b2bfcSGreg Roach        </header>
120dd6b2bfcSGreg Roach
121dd6b2bfcSGreg Roach        <main id="content" class="wt-main-wrapper">
12216543441SGreg Roach            <div class="container-lg wt-main-container">
123dd6b2bfcSGreg Roach                <div class="flash-messages">
124dd6b2bfcSGreg Roach                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
125dd6b2bfcSGreg Roach                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
126a907ae44SGreg Roach                            <button type="button" class="close" data-dismiss="alert"
127a907ae44SGreg Roach                                    aria-label="<?= I18N::translate('close') ?>">
128dd6b2bfcSGreg Roach                                <span aria-hidden="true">&times;</span>
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">
140d70512abSGreg Roach            <?= app(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: "",
158cee51dfdSGreg Roach                    previous: '<i class="fas fa-arrow-left wt-icon-flip-rtl" title="<?= I18N::translate('previous') ?>"></i>',
159cee51dfdSGreg Roach                    next: '<i class="fas fa-arrow-right wt-icon-flip-rtl" title="<?= I18N::translate('next') ?>"></i>',
160cee51dfdSGreg Roach                    slideshowStart: '<i class="fas fa-play" title="<?= I18N::translate('Play') ?>"></i>',
161cee51dfdSGreg Roach                    slideshowStop: '<i class="fas fa-stop" title="<?= I18N::translate('Stop') ?>"></i>',
162cee51dfdSGreg Roach                    close: '<i class="fas 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,
170cee51dfdSGreg Roach                    // Add wheelzoom to the displayed image
171cee51dfdSGreg Roach                    onComplete: function () {
172cee51dfdSGreg Roach                        // Disable click on image triggering next image
173cee51dfdSGreg Roach                        // https://github.com/jackmoore/colorbox/issues/668
174cee51dfdSGreg Roach                        $(".cboxPhoto").unbind("click");
1753cf811e8SGreg Roach                        // Enable wheel/pinch zooming
1763cf811e8SGreg Roach                        $('.cboxPhoto').wrap("<pinch-zoom></pinch-zoom>");
177cee51dfdSGreg Roach                    }
178cee51dfdSGreg Roach                });
179dd6b2bfcSGreg Roach            });
180dd6b2bfcSGreg Roach        </script>
181dd6b2bfcSGreg Roach
182dd6b2bfcSGreg Roach        <?= View::stack('javascript') ?>
183dd6b2bfcSGreg Roach
184d70512abSGreg Roach        <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(static function (ModuleGlobalInterface $module): string {
185d70512abSGreg Roach            return $module->bodyContent();
186d70512abSGreg Roach        })->implode('') ?>
187abafa13cSGreg Roach
188dd6b2bfcSGreg Roach        <?= DebugBar::render() ?>
189dd6b2bfcSGreg Roach    </body>
190dd6b2bfcSGreg Roach</html>
191