xref: /webtrees/resources/views/layouts/default.phtml (revision 6fd4f6e3d5a2c64c159e88e10883a1ccab4d4a42)
1<?php use Fisharebest\Webtrees\Auth; ?>
2<?php use Fisharebest\Webtrees\DebugBar; ?>
3<?php use Fisharebest\Webtrees\FlashMessages; ?>
4<?php use Fisharebest\Webtrees\I18N; ?>
5<?php use Fisharebest\Webtrees\Module; ?>
6<?php use Fisharebest\Webtrees\Module\ModuleAnalyticsInterface; ?>
7<?php use Fisharebest\Webtrees\Module\ModuleFooterInterface; ?>
8<?php use Fisharebest\Webtrees\Module\ModuleThemeInterface; ?>
9<?php use Fisharebest\Webtrees\Services\ModuleService; ?>
10<?php use Fisharebest\Webtrees\View; ?>
11<?php use Fisharebest\Webtrees\Webtrees; ?>
12
13<!DOCTYPE html>
14<html <?= I18N::htmlAttributes() ?>>
15    <head>
16        <meta charset="UTF-8">
17        <meta name="csrf" content="<?= e(csrf_token()) ?>">
18        <meta name="viewport" content="width=device-width, initial-scale=1">
19        <meta name="robots" content="<?= e($meta_robots ?? 'noindex') ?>">
20        <meta name="generator" content="<?= e(Webtrees::NAME) ?> <?= e(Webtrees::VERSION) ?>">
21        <?php if ($tree !== null) : ?>
22            <meta name="description" content="<?= e($tree->getPreference('META_DESCRIPTION')) ?>">
23        <?php endif ?>
24
25        <title>
26            <?= strip_tags($title) ?>
27            <?php if ($tree !== null && $tree->getPreference('META_TITLE') !== '') : ?>
28<?= e($tree->getPreference('META_TITLE')) ?>
29            <?php endif ?>
30        </title>
31
32        <link rel="icon" href="<?= app()->make(ModuleThemeInterface::class)::ASSET_DIR ?>favicon.png" type="image/png">
33        <link rel="icon" type="image/png" href="<?= app()->make(ModuleThemeInterface::class)::ASSET_DIR ?>favicon192.png" sizes="192x192">
34        <link rel="apple-touch-icon" sizes="180x180" href="<?= app()->make(ModuleThemeInterface::class)::ASSET_DIR ?>favicon180.png">
35
36        <?php if (I18N::direction() === 'rtl') : ?>
37            <link rel="stylesheet" type="text/css" href="<?= e(Webtrees::ASSETS_PATH . 'css/vendor-rtl.css') ?>">
38        <?php else : ?>
39            <link rel="stylesheet" type="text/css" href="<?= e(Webtrees::ASSETS_PATH . 'css/vendor.css') ?>">
40        <?php endif ?>
41
42        <?php foreach (app()->make(ModuleThemeInterface::class)->stylesheets() as $stylesheet) : ?>
43            <link rel="stylesheet" type="text/css" href="<?=  $stylesheet ?>">
44        <?php endforeach ?>
45
46        <?= View::stack('styles') ?>
47
48        <?= app()->make(ModuleService::class)->findByInterface(ModuleAnalyticsInterface::class)->filter(function (ModuleAnalyticsInterface $module): bool { return $module->analyticsCanShow(); })->map(function (ModuleAnalyticsInterface $module): string { return $module->analyticsSnippet($module->analyticsParameters()); })->implode('') ?>
49
50        <?= DebugBar::renderHead() ?>
51    </head>
52
53    <body class="wt-global">
54        <header class="wt-header-wrapper d-print-none">
55            <div class="container wt-header-container">
56                <div class="row wt-header-content">
57                    <div class="wt-accessibility-links">
58                        <a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
59                            <?= /* I18N: Skip over the headers and menus, to the main content of the page */ I18N::translate('Skip to content') ?>
60                        </a>
61                    </div>
62                    <div class="col wt-site-logo"></div>
63
64                    <?php if ($tree !== null) : ?>
65                        <h1 class="col wt-site-title"><?= e($tree->title()) ?></h1>
66
67                        <div class="col wt-header-search">
68                            <form class="wt-header-search-form" role="search">
69                                <input type="hidden" name="route" value="search-quick">
70                                <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
71                                <div class="input-group">
72                                    <label class="sr-only" for="quick-search"><?= I18N::translate('Search') ?></label>
73                                    <input type="search" class="form-control wt-header-search-field" id="quick-search" name="query" size="15" placeholder="<?= I18N::translate('Search') ?>">
74                                    <span class="input-group-btn">
75                                        <button type="submit" class="btn btn-primary wt-header-search-button">
76                                            <?= view('icons/search') ?>
77                                        </button>
78                                    </span>
79                                </div>
80                            </form>
81                        </div>
82                    <?php endif ?>
83
84                    <div class="col wt-secondary-navigation">
85                        <ul class="nav wt-secondary-menu">
86                            <?php foreach (app()->make(ModuleThemeInterface::class)->secondaryMenu() as $menu) : ?>
87                                <?= $menu->bootstrap4() ?>
88                            <?php endforeach ?>
89                        </ul>
90                    </div>
91
92                    <?php if ($tree !== null) : ?>
93                    <nav class="col wt-primary-navigation">
94                        <ul class="nav wt-primary-menu">
95                            <?php foreach (app()->make(ModuleThemeInterface::class)->primaryMenu($individual ?? $tree->significantIndividual(Auth::user())) as $menu) : ?>
96                                <?= $menu->bootstrap4() ?>
97                            <?php endforeach ?>
98                        </ul>
99                    </nav>
100                    <?php endif ?>
101                </div>
102            </div>
103        </header>
104
105        <main id="content" class="wt-main-wrapper">
106            <div class="container wt-main-container">
107                <div class="flash-messages">
108                    <?php foreach (FlashMessages::getMessages() as $message) : ?>
109                        <div class="alert alert-<?= e($message->status) ?> alert-dismissible" role="alert">
110                            <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>">
111                                <span aria-hidden="true">&times;</span>
112                            </button>
113                            <?= $message->text ?>
114                        </div>
115                    <?php endforeach ?>
116                </div>
117
118                <?= $content ?>
119            </div>
120        </main>
121
122        <footer class="wt-footer-container">
123            <div class="wt-footer-content container d-print-none">
124                <?= app()->make(ModuleService::class)->findByInterface(ModuleFooterInterface::class)->map(function (ModuleFooterInterface $module) use ($tree): string { return app()->dispatch($module, 'getFooter'); })->implode('') ?>
125            </div>
126        </footer>
127
128        <script src="<?= e(Webtrees::ASSETS_PATH . 'js/vendor.js') ?>?<?= filemtime(WT_ROOT . Webtrees::ASSETS_PATH . 'js/vendor.js') ?>"></script>
129        <script src="<?= e(Webtrees::ASSETS_PATH . 'js/webtrees.js') ?>?<?= filemtime(WT_ROOT . Webtrees::ASSETS_PATH . 'js/webtrees.js') ?>"></script>
130
131        <script>
132      activate_colorbox();
133      jQuery.extend(jQuery.colorbox.settings, {
134       width: "85%",
135       height: "85%",
136       transition: "none",
137       slideshowStart: "<?= I18N::translate('Play') ?>",
138       slideshowStop: "<?= I18N::translate('Stop') ?>",
139       title: function() { return this.dataset.title; }
140      });
141    </script>
142
143        <?= View::stack('javascript') ?>
144
145        <?= DebugBar::render() ?>
146    </body>
147</html>
148