xref: /webtrees/resources/views/calendar-page.phtml (revision 4874f72da8279544d9c0a459e2920a9986acfaa0)
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<form method="get" action="<?= e(route('calendar', ['tree' => $tree->name()])) ?>" name="dateform">
12    <input type="hidden" name="route" value="calendar">
13    <input type="hidden" name="cal" value="<?= e($cal) ?>">
14    <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
15    <input type="hidden" name="month" value="<?= e($cal_month) ?>">
16    <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
17    <input type="hidden" name="view" value="<?= e($view) ?>">
18    <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
19
20    <table class="table-sm wt-page-options w-100" role="presentation">
21        <tr>
22            <th class="wt-page-options-label">
23                <?= I18N::translate('Day') ?>
24            </th>
25            <td class="wt-page-options-value" colspan="3">
26                <?php for ($d = 1; $d <= $days_in_month; $d++) : ?>
27                    <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">
28                        <?= (new Date($cal_date->format("%@ {$d} %O %E")))->minimumDate()->format('%j') ?>
29                    </a>
30                    |
31                <?php endfor ?>
32                <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">
33                    <b><?php $tmp = new Date($today->format('%@ %A %O %E')); echo $tmp->display() ?></b>
34                </a>
35            </td>
36        </tr>
37        <tr>
38            <th class="wt-page-options-label">
39                <?= I18N::translate('Month') ?>
40            </th>
41            <td class="wt-page-options-value" colspan="3">
42                <?php foreach ($months as $m => $month_name) : ?>
43                    <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">
44                        <?php if ($m === $cal_month) : ?>
45                            <span class="error"><?= e($month_name) ?></span>
46                        <?php else : ?>
47                            <?= e($month_name) ?>
48                        <?php endif ?>
49                    </a> |
50                <?php endforeach ?>
51                <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">
52                    <b><?= $today->format('%F %Y') ?></b>
53                </a>
54            </td>
55        </tr>
56        <tr>
57            <th class="wt-page-options-label">
58                <label for="year"><?= I18N::translate('Year') ?></label>
59            </th>
60            <td class="wt-page-options-value">
61                <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">
62                    -1
63                </a>
64                <input type="text" id="year" name="year" value="<?= $year ?>" size="4">
65                <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">
66                    +1
67                </a>
68                |
69                <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">
70                    <?= $today->format('%Y') ?>
71                </a>
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, 'tree' => $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, 'tree' => $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, 'tree' => $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', 'tree' => $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', 'tree' => $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', 'tree' => $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, 'tree' => $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', ['tree' => $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