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