xref: /webtrees/resources/views/calendar-page.phtml (revision d70512ab02636ee884ef6d7907223ed02c754ff5)
1a69f5655SGreg Roach<?php
2*d70512abSGreg Roach
3a69f5655SGreg Roachuse Fisharebest\Webtrees\Auth;
4a69f5655SGreg Roachuse Fisharebest\Webtrees\Date;
5a69f5655SGreg Roachuse Fisharebest\Webtrees\I18N;
6*d70512abSGreg Roach
7a69f5655SGreg Roach?>
8dd6b2bfcSGreg Roach
9dd6b2bfcSGreg Roach<h2 class="wt-page-title">
10dd6b2bfcSGreg Roach    <?= $title ?>
11dd6b2bfcSGreg Roach</h2>
12dd6b2bfcSGreg Roach
13dd6b2bfcSGreg Roach<table class="table-sm wt-page-options w-100" role="presentation">
14dd6b2bfcSGreg Roach    <tr>
15dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
16dd6b2bfcSGreg Roach            <?= I18N::translate('Day') ?>
17dd6b2bfcSGreg Roach        </th>
18dd6b2bfcSGreg Roach        <td class="wt-page-options-value" colspan="3">
19dd6b2bfcSGreg Roach            <?php for ($d = 1; $d <= $days_in_month; $d++) : ?>
20d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
21dd6b2bfcSGreg Roach                    <?= (new Date($cal_date->format("%@ {$d} %O %E")))->minimumDate()->format('%j') ?>
22dd6b2bfcSGreg Roach                </a>
23dd6b2bfcSGreg Roach                |
24dd6b2bfcSGreg Roach            <?php endfor ?>
25d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
26dd6b2bfcSGreg Roach                <b><?php $tmp = new Date($today->format('%@ %A %O %E')); echo $tmp->display() ?></b>
27dd6b2bfcSGreg Roach            </a>
28dd6b2bfcSGreg Roach        </td>
29dd6b2bfcSGreg Roach    </tr>
30dd6b2bfcSGreg Roach    <tr>
31dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
32dd6b2bfcSGreg Roach            <?= I18N::translate('Month') ?>
33dd6b2bfcSGreg Roach        </th>
34dd6b2bfcSGreg Roach        <td class="wt-page-options-value" colspan="3">
35dd6b2bfcSGreg Roach            <?php foreach ($months as $m => $month_name) : ?>
36d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
37dd6b2bfcSGreg Roach                    <?php if ($m === $cal_month) : ?>
38dd6b2bfcSGreg Roach                        <span class="error"><?= e($month_name) ?></span>
39dd6b2bfcSGreg Roach                    <?php else : ?>
40dd6b2bfcSGreg Roach                        <?= e($month_name) ?>
41dd6b2bfcSGreg Roach                    <?php endif ?>
42dd6b2bfcSGreg Roach                </a> |
43dd6b2bfcSGreg Roach            <?php endforeach ?>
44d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
45dd6b2bfcSGreg Roach                <b><?= $today->format('%F %Y') ?></b>
46dd6b2bfcSGreg Roach            </a>
47dd6b2bfcSGreg Roach        </td>
48dd6b2bfcSGreg Roach    </tr>
49dd6b2bfcSGreg Roach    <tr>
50dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
51dd6b2bfcSGreg Roach            <label for="year"><?= I18N::translate('Year') ?></label>
52dd6b2bfcSGreg Roach        </th>
5340296c5fSGreg Roach
54dd6b2bfcSGreg Roach        <td class="wt-page-options-value">
5540296c5fSGreg Roach            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
5640296c5fSGreg Roach                <?= csrf_field() ?>
5740296c5fSGreg Roach                <input type="hidden" name="cal" value="<?= e($cal) ?>">
5840296c5fSGreg Roach                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
5940296c5fSGreg Roach                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
6040296c5fSGreg Roach                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
6140296c5fSGreg Roach                <input type="hidden" name="filterof" value="<?= e($filtersx) ?>">
6240296c5fSGreg Roach                <input type="hidden" name="filterev" value="<?= e($filtersx) ?>">
6340296c5fSGreg Roach
64d72b284aSGreg 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, 'tree' => $tree->name()])) ?>" rel="nofollow">
65dd6b2bfcSGreg Roach                    -1
66dd6b2bfcSGreg Roach                </a>
6740296c5fSGreg Roach
68dd6b2bfcSGreg Roach                <input type="text" id="year" name="year" value="<?= $year ?>" size="4">
6940296c5fSGreg Roach
70d72b284aSGreg 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, 'tree' => $tree->name()])) ?>" rel="nofollow">
71dd6b2bfcSGreg Roach                    +1
72dd6b2bfcSGreg Roach                </a>
73dd6b2bfcSGreg Roach                |
74d72b284aSGreg 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, 'tree' => $tree->name()])) ?>" rel="nofollow">
75dd6b2bfcSGreg Roach                    <?= $today->format('%Y') ?>
76dd6b2bfcSGreg Roach                </a>
7740296c5fSGreg Roach            </form>
78dd6b2bfcSGreg Roach        </td>
79dd6b2bfcSGreg Roach
80dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
81dd6b2bfcSGreg Roach            <?= I18N::translate('Show') ?>
82dd6b2bfcSGreg Roach        </th>
83dd6b2bfcSGreg Roach
84dd6b2bfcSGreg Roach        <td class="wt-page-options-value">
85dd6b2bfcSGreg Roach            <?php if (!$tree->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) : ?>
8640296c5fSGreg Roach            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
8740296c5fSGreg Roach                <?= csrf_field() ?>
8840296c5fSGreg Roach                <input type="hidden" name="cal" value="<?= e($cal) ?>">
8940296c5fSGreg Roach                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
9040296c5fSGreg Roach                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
9140296c5fSGreg Roach                <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
9240296c5fSGreg Roach                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
9340296c5fSGreg Roach                <input type="hidden" name="filterev" value="<?= e($filtersx) ?>">
9440296c5fSGreg Roach
9540296c5fSGreg Roach                <select class="list_value" name="filterof" onchange="this.form.submit();">
96dd6b2bfcSGreg Roach                    <option value="all" <?= $filterof === 'all' ? 'selected' : '' ?>>
97dd6b2bfcSGreg Roach                        <?= I18N::translate('All individuals') ?>
98dd6b2bfcSGreg Roach                    </option>
99dd6b2bfcSGreg Roach                    <option value="living" <?= $filterof === 'living' ? 'selected' : '' ?>>
100dd6b2bfcSGreg Roach                        <?= I18N::translate('Living individuals') ?>
101dd6b2bfcSGreg Roach                    </option>
102dd6b2bfcSGreg Roach                    <option value="recent" <?= $filterof === 'recent' ? 'selected' : '' ?>>
103dd6b2bfcSGreg Roach                        <?= I18N::translate('Recent years (&lt; 100 yrs)') ?>
104dd6b2bfcSGreg Roach                    </option>
105dd6b2bfcSGreg Roach                </select>
10640296c5fSGreg Roach            </form>
107dd6b2bfcSGreg Roach            <?php endif ?>
108dd6b2bfcSGreg Roach
109d72b284aSGreg 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, 'tree' => $tree->name()])) ?>" rel="nofollow">
11097c22350SGreg Roach                <?php if ($filtersx === '') : ?>
11108362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'M']) ?>
11208362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'F']) ?>
11397c22350SGreg Roach                <?php else : ?>
11497c22350SGreg Roach                    <small>
11508362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'M']) ?>
11608362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'F']) ?>
11797c22350SGreg Roach                    </small>
11897c22350SGreg Roach                <?php endif ?>
119dd6b2bfcSGreg Roach            </a>
120dd6b2bfcSGreg Roach            |
121d72b284aSGreg 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, 'tree' => $tree->name()])) ?>" rel="nofollow">
12297c22350SGreg Roach                <?php if ($filtersx === 'M') : ?>
12308362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'M']) ?>
12497c22350SGreg Roach                <?php else : ?>
12597c22350SGreg Roach                    <small>
12608362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'M']) ?>
12797c22350SGreg Roach                    </small>
12897c22350SGreg Roach                <?php endif ?>
129dd6b2bfcSGreg Roach            </a>
130dd6b2bfcSGreg Roach            |
131d72b284aSGreg 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, 'tree' => $tree->name()])) ?>" rel="nofollow">
13297c22350SGreg Roach                <?php if ($filtersx === 'F') : ?>
13308362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'F']) ?>
13497c22350SGreg Roach                <?php else : ?>
13597c22350SGreg Roach                    <small>
13608362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'F']) ?>
13797c22350SGreg Roach                    </small>
13897c22350SGreg Roach                <?php endif ?>
139dd6b2bfcSGreg Roach            </a>
140dd6b2bfcSGreg Roach
14140296c5fSGreg Roach            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
14240296c5fSGreg Roach                <?= csrf_field() ?>
14340296c5fSGreg Roach                <input type="hidden" name="cal" value="<?= e($cal) ?>">
14440296c5fSGreg Roach                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
14540296c5fSGreg Roach                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
14640296c5fSGreg Roach                <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
14740296c5fSGreg Roach                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
14840296c5fSGreg Roach                <input type="hidden" name="filterof" value="<?= e($filtersx) ?>">
14940296c5fSGreg Roach
15040296c5fSGreg Roach                <select class="list_value" name="filterev" onchange="this.form.submit();">
151dd6b2bfcSGreg Roach                <option value="BIRT-MARR-DEAT" <?= $filterev === 'BIRT-MARR-DEAT' ? 'selected' : '' ?>>
152dd6b2bfcSGreg Roach                    <?= I18N::translate('Vital records') ?>
153dd6b2bfcSGreg Roach                </option>
154dd6b2bfcSGreg Roach                <option value="" <?= $filterev === '' ? 'selected' : '' ?>>
155dd6b2bfcSGreg Roach                    <?= I18N::translate('All') ?>
156dd6b2bfcSGreg Roach                </option>
157dd6b2bfcSGreg Roach                <option value="BIRT" <?= $filterev === 'BIRT' ? 'selected' : '' ?>>
158dd6b2bfcSGreg Roach                    <?= I18N::translate('Birth') ?>
159dd6b2bfcSGreg Roach                </option>
160dd6b2bfcSGreg Roach                <option value="BAPM-CHR-CHRA" <?= $filterev === 'BAPM-CHR-CHRA' ? 'selected' : '' ?>>
161dd6b2bfcSGreg Roach                    <?= I18N::translate('Baptism') ?>
162dd6b2bfcSGreg Roach                </option>
163dd6b2bfcSGreg Roach                <option value="MARR-_COML-_NMR" <?= $filterev === 'MARR-_COML-_NMR' ? 'selected' : '' ?>>
164dd6b2bfcSGreg Roach                    <?= I18N::translate('Marriage') ?>
165dd6b2bfcSGreg Roach                </option>
166dd6b2bfcSGreg Roach                <option value="DIV-_SEPR" <?= $filterev === 'DIV-_SEPR' ? 'selected' : '' ?>>
167dd6b2bfcSGreg Roach                    <?= I18N::translate('Divorce') ?>
168dd6b2bfcSGreg Roach                </option>
169dd6b2bfcSGreg Roach                <option value="DEAT" <?= $filterev === 'DEAT' ? 'selected' : '' ?>>
170dd6b2bfcSGreg Roach                    <?= I18N::translate('Death') ?>
171dd6b2bfcSGreg Roach                </option>
172dd6b2bfcSGreg Roach                <option value="BURI" <?= $filterev === 'BURI' ? 'selected' : '' ?>>
173dd6b2bfcSGreg Roach                    <?= I18N::translate('Burial') ?>
174dd6b2bfcSGreg Roach                </option>
175dd6b2bfcSGreg Roach                <option value="IMMI,EMIG" <?= $filterev === 'IMMI,EMIG' ? 'selected' : '' ?>>
176dd6b2bfcSGreg Roach                    <?= I18N::translate('Emigration') ?>
177dd6b2bfcSGreg Roach                </option>
178dd6b2bfcSGreg Roach                <option value="EVEN" <?= $filterev === 'EVEN' ? 'selected' : '' ?>>
179dd6b2bfcSGreg Roach                    <?= I18N::translate('Custom event') ?>
180dd6b2bfcSGreg Roach                </option>
181dd6b2bfcSGreg Roach            </select>
18240296c5fSGreg Roach            </form>
183dd6b2bfcSGreg Roach        </td>
184dd6b2bfcSGreg Roach    </tr>
185dd6b2bfcSGreg Roach</table>
186dd6b2bfcSGreg Roach
187e7f5c669SGreg Roach    <table class="w-100">
188dd6b2bfcSGreg Roach        <tr>
18997c22350SGreg Roach            <td class="topbottombar text-center">
190d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
191dd6b2bfcSGreg Roach                    <?= I18N::translate('View this day') ?>
192dd6b2bfcSGreg Roach                </a>
193dd6b2bfcSGreg Roach                |
194d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
195dd6b2bfcSGreg Roach                    <?= I18N::translate('View this month') ?>
196dd6b2bfcSGreg Roach                </a>
197dd6b2bfcSGreg Roach                |
198d72b284aSGreg 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', 'tree' => $tree->name()])) ?>" rel="nofollow">
199dd6b2bfcSGreg Roach                    <?= I18N::translate('View this year') ?>
200dd6b2bfcSGreg Roach                </a>
201dd6b2bfcSGreg Roach            </td>
20297c22350SGreg Roach            <td class="topbottombar text-center">
203dd6b2bfcSGreg Roach                <?php
204dd6b2bfcSGreg Roach                    $n = 0;
205dd6b2bfcSGreg Roach                foreach (Date::calendarNames() as $newcal => $cal_name) {
206dd6b2bfcSGreg Roach                    $tmp = $cal_date->convertToCalendar($newcal);
207dd6b2bfcSGreg Roach                    if ($tmp->inValidRange()) {
208dd6b2bfcSGreg Roach                        if ($n++) {
209dd6b2bfcSGreg Roach                            echo ' | ';
210dd6b2bfcSGreg Roach                        }
211d72b284aSGreg 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, 'tree' => $tree->name()])) . '" rel="nofollow">', $cal_name, '</a>';
212dd6b2bfcSGreg Roach                    }
213dd6b2bfcSGreg Roach                } ?>
214dd6b2bfcSGreg Roach            </td>
215dd6b2bfcSGreg Roach        </tr>
216dd6b2bfcSGreg Roach    </table>
217dd6b2bfcSGreg Roach
218d72b284aSGreg Roach<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>
219dd6b2bfcSGreg Roach
220dd6b2bfcSGreg Roach<?= view('modals/ajax') ?>
221