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