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