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