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