xref: /webtrees/resources/views/search-general-page.phtml (revision 8121b9bec19818120092699199161a1357bb8f3f)
1<?php use Fisharebest\Webtrees\I18N; ?>
2
3<h2 class="wt-page-title">
4    <?= $title ?>
5</h2>
6
7<form class="wt-page-options wt-page-options-search hidden-print mb-4" name="searchform">
8    <input type="hidden" name="route" value="search-general">
9    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
10    <div class="row form-group">
11        <label class="col-sm-3 col-form-label wt-page-options-label" for="query">
12            <?= I18N::translate('Search for') ?>
13        </label>
14        <div class="col-sm-9 wt-page-options-value">
15            <div class="input-group input-group-sm">
16                <input id="query" class="form-control form-control-sm" type="text" name="query" value="<?= e($query) ?>" required>
17                <?= view('edit/input-addon-keyboard', ['id' => 'query']) ?>
18            </div>
19        </div>
20    </div>
21    <fieldset class="form-group">
22        <div class="row">
23            <label class="col-sm-3 col-form-label wt-page-options-label">
24                <?= I18N::translate('Records') ?>
25            </label>
26            <div class="col-sm-9 wt-page-options-value">
27                <div class="form-check form-check-inline">
28                    <label class="form-check-label">
29                        <input class="form-check-input" <?= $search_individuals ? 'checked' : '' ?> name="search_individuals" type="checkbox">
30                        <?= I18N::translate('Individuals') ?>
31                    </label>
32                </div>
33
34                <div class="form-check form-check-inline">
35                    <label class="form-check-label">
36                        <input class="form-check-input" <?= $search_families ? 'checked' : '' ?> name="search_families" type="checkbox">
37                        <?= I18N::translate('Families') ?>
38                    </label>
39                </div>
40
41                <div class="form-check form-check-inline">
42                    <label class="form-check-label">
43                        <input class="form-check-input" <?= $search_sources ? 'checked' : '' ?> name="search_sources" type="checkbox">
44                        <?= I18N::translate('Sources') ?>
45                    </label>
46                </div>
47
48                <div class="form-check form-check-inline">
49                    <label class="form-check-label">
50                        <input class="form-check-input" <?= $search_repositories ? 'checked' : '' ?> name="search_repositories" type="checkbox">
51                        <?= I18N::translate('Repositories') ?>
52                    </label>
53                </div>
54
55                <div class="form-check form-check-inline">
56                    <label class="form-check-label">
57                        <input class="form-check-input" <?= $search_notes ? 'checked' : '' ?> name="search_notes" type="checkbox">
58                        <?= I18N::translate('Shared notes') ?>
59                    </label>
60                </div>
61            </div>
62        </div>
63    </fieldset>
64
65    <?php if (count($all_trees) > 1) : ?>
66        <fieldset class="form-group">
67            <div class="row">
68                <label class="col-sm-3 col-form-label wt-page-options-label">
69                    <?= I18N::translate('Family trees') ?>
70                </label>
71                <div class="col-sm-9 wt-page-options-value pt-2">
72                    <div class="d-flex justify-content-between">
73                        <div id="search-trees" class="form-check">
74                            <?php foreach ($all_trees as $tree) : ?>
75                                <div class="col px-0">
76                                    <label class="form-check-label">
77                                        <input class="form-check form-check-input" type="checkbox" <?= in_array($tree, $search_trees) ? 'checked' : '' ?> value="<?= $tree->name() ?>" name="search_trees[]">
78                                        <?= e($tree->title()) ?>
79                                    </label>
80                                </div>
81                            <?php endforeach ?>
82                        </div>
83                        <?php if (count($all_trees) > 3) : ?>
84                            <div class="d-row align-self-end mb-2">
85                                <input type="button" class="btn btn-sm btn-secondary mx-1" value="<?= /* I18N: select all (of the family trees) */ I18N::translate('select all') ?>" onclick="$('#search-trees :checkbox').each(function(){$(this).attr('checked', true);});return false;">
86                                <input type="button" class="btn btn-sm btn-secondary mx-1" value="<?= /* I18N: select none (of the family trees) */ I18N::translate('select none') ?>" onclick="$('#search-trees :checkbox').each(function(){$(this).attr('checked', false);});return false;">
87                                <?php if (count($all_trees) > 10) : ?>
88                                    <input type="button" value="<?= I18N::translate('invert selection') ?>" onclick="$('#search-trees :checkbox').each(function(){$(this).attr('checked', !$(this).attr('checked'));});return false;">
89                                <?php endif ?>
90                            </div>
91                        <?php endif ?>
92                    </div>
93                </div>
94            </div>
95        </fieldset>
96    <?php endif ?>
97
98    <div class="row form-group">
99        <label class="col-sm-3 col-form-label wt-page-options-label"></label>
100        <div class="col-sm-9 wt-page-options-value">
101            <input type="submit" class="btn btn-primary" value="<?=  /* I18N: A button label. */ I18N::translate('search') ?>">
102        </div>
103    </div>
104</form>
105
106<?php if ($query !== '') : ?>
107    <?php if (empty($individuals) && empty($families) && empty($repositories) && empty($sources) && empty($notes)) : ?>
108        <div class="alert alert-info row">
109            <?= I18N::translate('No results found.') ?>
110        </div>
111    <?php else : ?>
112        <?= view('search-results', ['families' => $families, 'individuals' => $individuals, 'notes' => $notes, 'repositories' => $repositories, 'sources' => $sources, 'search_families' => $search_families, 'search_individuals' => $search_individuals, 'search_notes' => $search_notes, 'search_repositories' => $search_repositories, 'search_sources' => $search_sources]) ?>
113    <?php endif ?>
114<?php endif ?>
115
116<?= view('modals/on-screen-keyboard') ?>
117