xref: /webtrees/resources/views/calendar-page.phtml (revision 4a9ac934d5278a1dcdb5a44fc98f96f8cd8b72f2)
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            </td>
72
73            <th class="wt-page-options-label">
74                <?= I18N::translate('Show') ?>
75            </th>
76
77            <td class="wt-page-options-value">
78                <?php if (!$tree->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) : ?>
79                    <select class="list_value" name="filterof" onchange="document.dateform.submit();">
80                        <option value="all" <?= $filterof === 'all' ? 'selected' : '' ?>>
81                            <?= I18N::translate('All individuals') ?>
82                        </option>
83                        <option value="living" <?= $filterof === 'living' ? 'selected' : '' ?>>
84                            <?= I18N::translate('Living individuals') ?>
85                        </option>
86                        <option value="recent" <?= $filterof === 'recent' ? 'selected' : '' ?>>
87                            <?= I18N::translate('Recent years (&lt; 100 yrs)') ?>
88                        </option>
89                    </select>
90                <?php endif ?>
91
92                <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">
93                    <?php if ($filtersx === '') : ?>
94                        <?= view('icons/sex-M') ?>
95                        <?= view('icons/sex-F') ?>
96                    <?php else: ?>
97                        <small>
98                            <?= view('icons/sex-M') ?>
99                            <?= view('icons/sex-F') ?>
100                        </small>
101                    <?php endif ?>
102                </a>
103                |
104                <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">
105                    <?php if ($filtersx === 'M') : ?>
106                        <?= view('icons/sex-M') ?>
107                    <?php else: ?>
108                        <small>
109                            <?= view('icons/sex-M') ?>
110                        </small>
111                    <?php endif ?>
112                </a>
113                |
114                <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">
115                    <?php if ($filtersx === 'F') : ?>
116                        <?= view('icons/sex-F') ?>
117                    <?php else: ?>
118                        <small>
119                            <?= view('icons/sex-F') ?>
120                        </small>
121                    <?php endif ?>
122                </a>
123
124                <select class="list_value" name="filterev" onchange="document.dateform.submit();">
125                    <option value="BIRT-MARR-DEAT" <?= $filterev === 'BIRT-MARR-DEAT' ? 'selected' : '' ?>>
126                        <?= I18N::translate('Vital records') ?>
127                    </option>
128                    <option value="" <?= $filterev === '' ? 'selected' : '' ?>>
129                        <?= I18N::translate('All') ?>
130                    </option>
131                    <option value="BIRT" <?= $filterev === 'BIRT' ? 'selected' : '' ?>>
132                        <?= I18N::translate('Birth') ?>
133                    </option>
134                    <option value="BAPM-CHR-CHRA" <?= $filterev === 'BAPM-CHR-CHRA' ? 'selected' : '' ?>>
135                        <?= I18N::translate('Baptism') ?>
136                    </option>
137                    <option value="MARR-_COML-_NMR" <?= $filterev === 'MARR-_COML-_NMR' ? 'selected' : '' ?>>
138                        <?= I18N::translate('Marriage') ?>
139                    </option>
140                    <option value="DIV-_SEPR" <?= $filterev === 'DIV-_SEPR' ? 'selected' : '' ?>>
141                        <?= I18N::translate('Divorce') ?>
142                    </option>
143                    <option value="DEAT" <?= $filterev === 'DEAT' ? 'selected' : '' ?>>
144                        <?= I18N::translate('Death') ?>
145                    </option>
146                    <option value="BURI" <?= $filterev === 'BURI' ? 'selected' : '' ?>>
147                        <?= I18N::translate('Burial') ?>
148                    </option>
149                    <option value="IMMI,EMIG" <?= $filterev === 'IMMI,EMIG' ? 'selected' : '' ?>>
150                        <?= I18N::translate('Emigration') ?>
151                    </option>
152                    <option value="EVEN" <?= $filterev === 'EVEN' ? 'selected' : '' ?>>
153                        <?= I18N::translate('Custom event') ?>
154                    </option>
155                </select>
156            </td>
157        </tr>
158    </table>
159
160    <table class="w-100">
161        <tr>
162            <td class="topbottombar text-center">
163                <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">
164                    <?= I18N::translate('View this day') ?>
165                </a>
166                |
167                <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">
168                    <?= I18N::translate('View this month') ?>
169                </a>
170                |
171                <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">
172                    <?= I18N::translate('View this year') ?>
173                </a>
174            </td>
175            <td class="topbottombar text-center">
176                <?php
177                    $n = 0;
178                foreach (Date::calendarNames() as $newcal => $cal_name) {
179                    $tmp = $cal_date->convertToCalendar($newcal);
180                    if ($tmp->inValidRange()) {
181                        if ($n++) {
182                            echo ' | ';
183                        }
184                        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>';
185                    }
186                } ?>
187            </td>
188        </tr>
189    </table>
190</form>
191
192<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>
193
194<?= view('modals/ajax') ?>
195