xref: /webtrees/resources/views/calendar-page.phtml (revision e603ca4054e8cd9931c7eb2b7375dde965312173)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Date;
5use Fisharebest\Webtrees\I18N;
6
7?>
8
9<h2 class="wt-page-title">
10    <?= $title ?>
11</h2>
12
13<table class="table-sm wt-page-options w-100" role="presentation">
14    <tr>
15        <th class="wt-page-options-label">
16            <?= I18N::translate('Day') ?>
17        </th>
18        <td class="wt-page-options-value" colspan="3">
19            <?php for ($d = 1; $d <= $days_in_month; $d++) : ?>
20                <a <?= $d === $cal_date->day() ? 'class="error"' : '' ?> href="<?= e(route('calendar', ['cal' => $cal, 'day' => $d, 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'day', 'tree' => $tree->name()])) ?>" rel="nofollow">
21                    <?= (new Date($cal_date->format("%@ {$d} %O %E")))->minimumDate()->format('%j') ?>
22                </a>
23                |
24            <?php endfor ?>
25            <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => $today->day(), 'month' => $today_month, 'year' => $today->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'day', 'tree' => $tree->name()])) ?>" rel="nofollow">
26                <b><?php $tmp = new Date($today->format('%@ %A %O %E')); echo $tmp->display() ?></b>
27            </a>
28        </td>
29    </tr>
30    <tr>
31        <th class="wt-page-options-label">
32            <?= I18N::translate('Month') ?>
33        </th>
34        <td class="wt-page-options-value" colspan="3">
35            <?php foreach ($months as $m => $month_name) : ?>
36                <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $m, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'month', 'tree' => $tree->name()])) ?>" rel="nofollow">
37                    <?php if ($m === $cal_month) : ?>
38                        <span class="error"><?= e($month_name) ?></span>
39                    <?php else : ?>
40                        <?= e($month_name) ?>
41                    <?php endif ?>
42                </a> |
43            <?php endforeach ?>
44            <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => min($cal_date->day(), $today->daysInMonth()), 'month' => $today_month, 'year' => $today->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'month', 'tree' => $tree->name()])) ?>" rel="nofollow">
45                <b><?= $today->format('%F %Y') ?></b>
46            </a>
47        </td>
48    </tr>
49    <tr>
50        <th class="wt-page-options-label">
51            <label for="year"><?= I18N::translate('Year') ?></label>
52        </th>
53
54        <td class="wt-page-options-value">
55            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
56                <?= csrf_field() ?>
57                <input type="hidden" name="cal" value="<?= e($cal) ?>">
58                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
59                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
60                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
61                <input type="hidden" name="filterof" value="<?= e($filtersx) ?>">
62                <input type="hidden" name="filterev" value="<?= e($filtersx) ?>">
63
64                <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year() === 1 ? -1 : $cal_date->year() - 1, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => $view, 'tree' => $tree->name()])) ?>" rel="nofollow">
65                    -1
66                </a>
67
68                <input type="text" id="year" name="year" value="<?= $year ?>" size="4">
69
70                <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year() === -1 ? 1 : $cal_date->year() + 1, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => $view, 'tree' => $tree->name()])) ?>" rel="nofollow">
71                    +1
72                </a>
73                |
74                <a href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $today->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => $view, 'tree' => $tree->name()])) ?>" rel="nofollow">
75                    <?= $today->format('%Y') ?>
76                </a>
77            </form>
78        </td>
79
80        <th class="wt-page-options-label">
81            <?= I18N::translate('Show') ?>
82        </th>
83
84        <td class="wt-page-options-value">
85            <?php if (!$tree->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) : ?>
86            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
87                <?= csrf_field() ?>
88                <input type="hidden" name="cal" value="<?= e($cal) ?>">
89                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
90                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
91                <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
92                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
93                <input type="hidden" name="filterev" value="<?= e($filtersx) ?>">
94
95                <select class="list_value" name="filterof" onchange="this.form.submit();">
96                    <option value="all" <?= $filterof === 'all' ? 'selected' : '' ?>>
97                        <?= I18N::translate('All individuals') ?>
98                    </option>
99                    <option value="living" <?= $filterof === 'living' ? 'selected' : '' ?>>
100                        <?= I18N::translate('Living individuals') ?>
101                    </option>
102                    <option value="recent" <?= $filterof === 'recent' ? 'selected' : '' ?>>
103                        <?= I18N::translate('Recent years (&lt; 100 yrs)') ?>
104                    </option>
105                </select>
106            </form>
107            <?php endif ?>
108
109            <a title="<?= I18N::translate('All individuals') ?>" href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => '', 'view' => $view, 'tree' => $tree->name()])) ?>" rel="nofollow">
110                <?php if ($filtersx === '') : ?>
111                    <?= view('icons/sex', ['sex' => 'M']) ?>
112                    <?= view('icons/sex', ['sex' => 'F']) ?>
113                <?php else : ?>
114                    <small>
115                        <?= view('icons/sex', ['sex' => 'M']) ?>
116                        <?= view('icons/sex', ['sex' => 'F']) ?>
117                    </small>
118                <?php endif ?>
119            </a>
120            |
121            <a title="<?= I18N::translate('Males') ?>" href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => 'M', 'view' => $view, 'tree' => $tree->name()])) ?>" rel="nofollow">
122                <?php if ($filtersx === 'M') : ?>
123                    <?= view('icons/sex', ['sex' => 'M']) ?>
124                <?php else : ?>
125                    <small>
126                        <?= view('icons/sex', ['sex' => 'M']) ?>
127                    </small>
128                <?php endif ?>
129            </a>
130            |
131            <a title="<?= I18N::translate('Females') ?>" href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => 'F', 'view' => $view, 'tree' => $tree->name()])) ?>" rel="nofollow">
132                <?php if ($filtersx === 'F') : ?>
133                    <?= view('icons/sex', ['sex' => 'F']) ?>
134                <?php else : ?>
135                    <small>
136                        <?= view('icons/sex', ['sex' => 'F']) ?>
137                    </small>
138                <?php endif ?>
139            </a>
140
141            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
142                <?= csrf_field() ?>
143                <input type="hidden" name="cal" value="<?= e($cal) ?>">
144                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
145                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
146                <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
147                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
148                <input type="hidden" name="filterof" value="<?= e($filtersx) ?>">
149
150                <select class="list_value" name="filterev" onchange="this.form.submit();">
151                <option value="BIRT-MARR-DEAT" <?= $filterev === 'BIRT-MARR-DEAT' ? 'selected' : '' ?>>
152                    <?= I18N::translate('Vital records') ?>
153                </option>
154                <option value="" <?= $filterev === '' ? 'selected' : '' ?>>
155                    <?= I18N::translate('All') ?>
156                </option>
157                <option value="BIRT" <?= $filterev === 'BIRT' ? 'selected' : '' ?>>
158                    <?= I18N::translate('Birth') ?>
159                </option>
160                <option value="BAPM-CHR-CHRA" <?= $filterev === 'BAPM-CHR-CHRA' ? 'selected' : '' ?>>
161                    <?= I18N::translate('Baptism') ?>
162                </option>
163                <option value="MARR-_COML-_NMR" <?= $filterev === 'MARR-_COML-_NMR' ? 'selected' : '' ?>>
164                    <?= I18N::translate('Marriage') ?>
165                </option>
166                <option value="DIV-_SEPR" <?= $filterev === 'DIV-_SEPR' ? 'selected' : '' ?>>
167                    <?= I18N::translate('Divorce') ?>
168                </option>
169                <option value="DEAT" <?= $filterev === 'DEAT' ? 'selected' : '' ?>>
170                    <?= I18N::translate('Death') ?>
171                </option>
172                <option value="BURI" <?= $filterev === 'BURI' ? 'selected' : '' ?>>
173                    <?= I18N::translate('Burial') ?>
174                </option>
175                <option value="IMMI,EMIG" <?= $filterev === 'IMMI,EMIG' ? 'selected' : '' ?>>
176                    <?= I18N::translate('Emigration') ?>
177                </option>
178                <option value="EVEN" <?= $filterev === 'EVEN' ? 'selected' : '' ?>>
179                    <?= I18N::translate('Custom event') ?>
180                </option>
181            </select>
182            </form>
183        </td>
184    </tr>
185</table>
186
187    <table class="w-100">
188        <tr>
189            <td class="topbottombar text-center">
190                <a class="<?= $view === 'day' ? 'error' : '' ?>" href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'day', 'tree' => $tree->name()])) ?>" rel="nofollow">
191                    <?= I18N::translate('View this day') ?>
192                </a>
193                |
194                <a class="<?= $view === 'month' ? 'error' : '' ?>" href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'month', 'tree' => $tree->name()])) ?>" rel="nofollow">
195                    <?= I18N::translate('View this month') ?>
196                </a>
197                |
198                <a class="<?= $view === 'year' ? 'error' : '' ?>" href="<?= e(route('calendar', ['cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'year', 'tree' => $tree->name()])) ?>" rel="nofollow">
199                    <?= I18N::translate('View this year') ?>
200                </a>
201            </td>
202            <td class="topbottombar text-center">
203                <?php
204                    $n = 0;
205                foreach (Date::calendarNames() as $newcal => $cal_name) {
206                    $tmp = $cal_date->convertToCalendar($newcal);
207                    if ($tmp->inValidRange()) {
208                        if ($n++) {
209                            echo ' | ';
210                        }
211                        echo '<a ' . (get_class($tmp) === get_class($cal_date) ? 'class="error"' : '') . ' href="' . e(route('calendar', ['cal' => $tmp->format('%@'), 'day' => $tmp->day(), 'month' => $tmp->format('%O'), 'year' => $tmp->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => $view, 'tree' => $tree->name()])) . '" rel="nofollow">', $cal_name, '</a>';
212                    }
213                } ?>
214            </td>
215        </tr>
216    </table>
217
218<div class="wt-ajax-load wt-page-content" data-ajax-url="<?= e(route('calendar-events', ['tree' => $tree->name(), 'cal' => $cal, 'day' => $day, 'month' => $month, 'year' => $year, 'view' => $view, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx])) ?>"></div>
219
220<?= view('modals/ajax') ?>
221