xref: /webtrees/resources/views/calendar-page.phtml (revision 08362db417156410ee02c6391bd9eb83a2df65fc)
1a69f5655SGreg Roach<?php
2a69f5655SGreg Roachuse Fisharebest\Webtrees\Auth;
3a69f5655SGreg Roachuse Fisharebest\Webtrees\Date;
4a69f5655SGreg Roachuse Fisharebest\Webtrees\I18N;
5a69f5655SGreg Roach?>
6dd6b2bfcSGreg Roach
7dd6b2bfcSGreg Roach<h2 class="wt-page-title">
8dd6b2bfcSGreg Roach    <?= $title ?>
9dd6b2bfcSGreg Roach</h2>
10dd6b2bfcSGreg Roach
11dd6b2bfcSGreg Roach<table class="table-sm wt-page-options w-100" role="presentation">
12dd6b2bfcSGreg Roach    <tr>
13dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
14dd6b2bfcSGreg Roach            <?= I18N::translate('Day') ?>
15dd6b2bfcSGreg Roach        </th>
16dd6b2bfcSGreg Roach        <td class="wt-page-options-value" colspan="3">
17dd6b2bfcSGreg Roach            <?php for ($d = 1; $d <= $days_in_month; $d++) : ?>
18d72b284aSGreg 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">
19dd6b2bfcSGreg Roach                    <?= (new Date($cal_date->format("%@ {$d} %O %E")))->minimumDate()->format('%j') ?>
20dd6b2bfcSGreg Roach                </a>
21dd6b2bfcSGreg Roach                |
22dd6b2bfcSGreg Roach            <?php endfor ?>
23d72b284aSGreg 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">
24dd6b2bfcSGreg Roach                <b><?php $tmp = new Date($today->format('%@ %A %O %E')); echo $tmp->display() ?></b>
25dd6b2bfcSGreg Roach            </a>
26dd6b2bfcSGreg Roach        </td>
27dd6b2bfcSGreg Roach    </tr>
28dd6b2bfcSGreg Roach    <tr>
29dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
30dd6b2bfcSGreg Roach            <?= I18N::translate('Month') ?>
31dd6b2bfcSGreg Roach        </th>
32dd6b2bfcSGreg Roach        <td class="wt-page-options-value" colspan="3">
33dd6b2bfcSGreg Roach            <?php foreach ($months as $m => $month_name) : ?>
34d72b284aSGreg 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">
35dd6b2bfcSGreg Roach                    <?php if ($m === $cal_month) : ?>
36dd6b2bfcSGreg Roach                        <span class="error"><?= e($month_name) ?></span>
37dd6b2bfcSGreg Roach                    <?php else : ?>
38dd6b2bfcSGreg Roach                        <?= e($month_name) ?>
39dd6b2bfcSGreg Roach                    <?php endif ?>
40dd6b2bfcSGreg Roach                </a> |
41dd6b2bfcSGreg Roach            <?php endforeach ?>
42d72b284aSGreg 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">
43dd6b2bfcSGreg Roach                <b><?= $today->format('%F %Y') ?></b>
44dd6b2bfcSGreg Roach            </a>
45dd6b2bfcSGreg Roach        </td>
46dd6b2bfcSGreg Roach    </tr>
47dd6b2bfcSGreg Roach    <tr>
48dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
49dd6b2bfcSGreg Roach            <label for="year"><?= I18N::translate('Year') ?></label>
50dd6b2bfcSGreg Roach        </th>
5140296c5fSGreg Roach
52dd6b2bfcSGreg Roach        <td class="wt-page-options-value">
5340296c5fSGreg Roach            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
5440296c5fSGreg Roach                <?= csrf_field() ?>
5540296c5fSGreg Roach                <input type="hidden" name="cal" value="<?= e($cal) ?>">
5640296c5fSGreg Roach                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
5740296c5fSGreg Roach                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
5840296c5fSGreg Roach                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
5940296c5fSGreg Roach                <input type="hidden" name="filterof" value="<?= e($filtersx) ?>">
6040296c5fSGreg Roach                <input type="hidden" name="filterev" value="<?= e($filtersx) ?>">
6140296c5fSGreg Roach
62d72b284aSGreg 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">
63dd6b2bfcSGreg Roach                    -1
64dd6b2bfcSGreg Roach                </a>
6540296c5fSGreg Roach
66dd6b2bfcSGreg Roach                <input type="text" id="year" name="year" value="<?= $year ?>" size="4">
6740296c5fSGreg Roach
68d72b284aSGreg 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">
69dd6b2bfcSGreg Roach                    +1
70dd6b2bfcSGreg Roach                </a>
71dd6b2bfcSGreg Roach                |
72d72b284aSGreg 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">
73dd6b2bfcSGreg Roach                    <?= $today->format('%Y') ?>
74dd6b2bfcSGreg Roach                </a>
7540296c5fSGreg Roach            </form>
76dd6b2bfcSGreg Roach        </td>
77dd6b2bfcSGreg Roach
78dd6b2bfcSGreg Roach        <th class="wt-page-options-label">
79dd6b2bfcSGreg Roach            <?= I18N::translate('Show') ?>
80dd6b2bfcSGreg Roach        </th>
81dd6b2bfcSGreg Roach
82dd6b2bfcSGreg Roach        <td class="wt-page-options-value">
83dd6b2bfcSGreg Roach            <?php if (!$tree->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) : ?>
8440296c5fSGreg Roach            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
8540296c5fSGreg Roach                <?= csrf_field() ?>
8640296c5fSGreg Roach                <input type="hidden" name="cal" value="<?= e($cal) ?>">
8740296c5fSGreg Roach                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
8840296c5fSGreg Roach                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
8940296c5fSGreg Roach                <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
9040296c5fSGreg Roach                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
9140296c5fSGreg Roach                <input type="hidden" name="filterev" value="<?= e($filtersx) ?>">
9240296c5fSGreg Roach
9340296c5fSGreg Roach                <select class="list_value" name="filterof" onchange="this.form.submit();">
94dd6b2bfcSGreg Roach                    <option value="all" <?= $filterof === 'all' ? 'selected' : '' ?>>
95dd6b2bfcSGreg Roach                        <?= I18N::translate('All individuals') ?>
96dd6b2bfcSGreg Roach                    </option>
97dd6b2bfcSGreg Roach                    <option value="living" <?= $filterof === 'living' ? 'selected' : '' ?>>
98dd6b2bfcSGreg Roach                        <?= I18N::translate('Living individuals') ?>
99dd6b2bfcSGreg Roach                    </option>
100dd6b2bfcSGreg Roach                    <option value="recent" <?= $filterof === 'recent' ? 'selected' : '' ?>>
101dd6b2bfcSGreg Roach                        <?= I18N::translate('Recent years (&lt; 100 yrs)') ?>
102dd6b2bfcSGreg Roach                    </option>
103dd6b2bfcSGreg Roach                </select>
10440296c5fSGreg Roach            </form>
105dd6b2bfcSGreg Roach            <?php endif ?>
106dd6b2bfcSGreg Roach
107d72b284aSGreg 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">
10897c22350SGreg Roach                <?php if ($filtersx === '') : ?>
109*08362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'M']) ?>
110*08362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'F']) ?>
11197c22350SGreg Roach                <?php else: ?>
11297c22350SGreg Roach                    <small>
113*08362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'M']) ?>
114*08362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'F']) ?>
11597c22350SGreg Roach                    </small>
11697c22350SGreg Roach                <?php endif ?>
117dd6b2bfcSGreg Roach            </a>
118dd6b2bfcSGreg Roach            |
119d72b284aSGreg 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">
12097c22350SGreg Roach                <?php if ($filtersx === 'M') : ?>
121*08362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'M']) ?>
12297c22350SGreg Roach                <?php else: ?>
12397c22350SGreg Roach                    <small>
124*08362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'M']) ?>
12597c22350SGreg Roach                    </small>
12697c22350SGreg Roach                <?php endif ?>
127dd6b2bfcSGreg Roach            </a>
128dd6b2bfcSGreg Roach            |
129d72b284aSGreg 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">
13097c22350SGreg Roach                <?php if ($filtersx === 'F') : ?>
131*08362db4SGreg Roach                    <?= view('icons/sex', ['sex' => 'F']) ?>
13297c22350SGreg Roach                <?php else: ?>
13397c22350SGreg Roach                    <small>
134*08362db4SGreg Roach                        <?= view('icons/sex', ['sex' => 'F']) ?>
13597c22350SGreg Roach                    </small>
13697c22350SGreg Roach                <?php endif ?>
137dd6b2bfcSGreg Roach            </a>
138dd6b2bfcSGreg Roach
13940296c5fSGreg Roach            <form method="post" action="<?= e(route('calendar', ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline">
14040296c5fSGreg Roach                <?= csrf_field() ?>
14140296c5fSGreg Roach                <input type="hidden" name="cal" value="<?= e($cal) ?>">
14240296c5fSGreg Roach                <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>">
14340296c5fSGreg Roach                <input type="hidden" name="month" value="<?= e($cal_month) ?>">
14440296c5fSGreg Roach                <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>">
14540296c5fSGreg Roach                <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>">
14640296c5fSGreg Roach                <input type="hidden" name="filterof" value="<?= e($filtersx) ?>">
14740296c5fSGreg Roach
14840296c5fSGreg Roach                <select class="list_value" name="filterev" onchange="this.form.submit();">
149dd6b2bfcSGreg Roach                <option value="BIRT-MARR-DEAT" <?= $filterev === 'BIRT-MARR-DEAT' ? 'selected' : '' ?>>
150dd6b2bfcSGreg Roach                    <?= I18N::translate('Vital records') ?>
151dd6b2bfcSGreg Roach                </option>
152dd6b2bfcSGreg Roach                <option value="" <?= $filterev === '' ? 'selected' : '' ?>>
153dd6b2bfcSGreg Roach                    <?= I18N::translate('All') ?>
154dd6b2bfcSGreg Roach                </option>
155dd6b2bfcSGreg Roach                <option value="BIRT" <?= $filterev === 'BIRT' ? 'selected' : '' ?>>
156dd6b2bfcSGreg Roach                    <?= I18N::translate('Birth') ?>
157dd6b2bfcSGreg Roach                </option>
158dd6b2bfcSGreg Roach                <option value="BAPM-CHR-CHRA" <?= $filterev === 'BAPM-CHR-CHRA' ? 'selected' : '' ?>>
159dd6b2bfcSGreg Roach                    <?= I18N::translate('Baptism') ?>
160dd6b2bfcSGreg Roach                </option>
161dd6b2bfcSGreg Roach                <option value="MARR-_COML-_NMR" <?= $filterev === 'MARR-_COML-_NMR' ? 'selected' : '' ?>>
162dd6b2bfcSGreg Roach                    <?= I18N::translate('Marriage') ?>
163dd6b2bfcSGreg Roach                </option>
164dd6b2bfcSGreg Roach                <option value="DIV-_SEPR" <?= $filterev === 'DIV-_SEPR' ? 'selected' : '' ?>>
165dd6b2bfcSGreg Roach                    <?= I18N::translate('Divorce') ?>
166dd6b2bfcSGreg Roach                </option>
167dd6b2bfcSGreg Roach                <option value="DEAT" <?= $filterev === 'DEAT' ? 'selected' : '' ?>>
168dd6b2bfcSGreg Roach                    <?= I18N::translate('Death') ?>
169dd6b2bfcSGreg Roach                </option>
170dd6b2bfcSGreg Roach                <option value="BURI" <?= $filterev === 'BURI' ? 'selected' : '' ?>>
171dd6b2bfcSGreg Roach                    <?= I18N::translate('Burial') ?>
172dd6b2bfcSGreg Roach                </option>
173dd6b2bfcSGreg Roach                <option value="IMMI,EMIG" <?= $filterev === 'IMMI,EMIG' ? 'selected' : '' ?>>
174dd6b2bfcSGreg Roach                    <?= I18N::translate('Emigration') ?>
175dd6b2bfcSGreg Roach                </option>
176dd6b2bfcSGreg Roach                <option value="EVEN" <?= $filterev === 'EVEN' ? 'selected' : '' ?>>
177dd6b2bfcSGreg Roach                    <?= I18N::translate('Custom event') ?>
178dd6b2bfcSGreg Roach                </option>
179dd6b2bfcSGreg Roach            </select>
18040296c5fSGreg Roach            </form>
181dd6b2bfcSGreg Roach        </td>
182dd6b2bfcSGreg Roach    </tr>
183dd6b2bfcSGreg Roach</table>
184dd6b2bfcSGreg Roach
185e7f5c669SGreg Roach    <table class="w-100">
186dd6b2bfcSGreg Roach        <tr>
18797c22350SGreg Roach            <td class="topbottombar text-center">
188d72b284aSGreg 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">
189dd6b2bfcSGreg Roach                    <?= I18N::translate('View this day') ?>
190dd6b2bfcSGreg Roach                </a>
191dd6b2bfcSGreg Roach                |
192d72b284aSGreg 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">
193dd6b2bfcSGreg Roach                    <?= I18N::translate('View this month') ?>
194dd6b2bfcSGreg Roach                </a>
195dd6b2bfcSGreg Roach                |
196d72b284aSGreg 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">
197dd6b2bfcSGreg Roach                    <?= I18N::translate('View this year') ?>
198dd6b2bfcSGreg Roach                </a>
199dd6b2bfcSGreg Roach            </td>
20097c22350SGreg Roach            <td class="topbottombar text-center">
201dd6b2bfcSGreg Roach                <?php
202dd6b2bfcSGreg Roach                    $n = 0;
203dd6b2bfcSGreg Roach                foreach (Date::calendarNames() as $newcal => $cal_name) {
204dd6b2bfcSGreg Roach                    $tmp = $cal_date->convertToCalendar($newcal);
205dd6b2bfcSGreg Roach                    if ($tmp->inValidRange()) {
206dd6b2bfcSGreg Roach                        if ($n++) {
207dd6b2bfcSGreg Roach                            echo ' | ';
208dd6b2bfcSGreg Roach                        }
209d72b284aSGreg 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>';
210dd6b2bfcSGreg Roach                    }
211dd6b2bfcSGreg Roach                } ?>
212dd6b2bfcSGreg Roach            </td>
213dd6b2bfcSGreg Roach        </tr>
214dd6b2bfcSGreg Roach    </table>
215dd6b2bfcSGreg Roach
216d72b284aSGreg 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>
217dd6b2bfcSGreg Roach
218dd6b2bfcSGreg Roach<?= view('modals/ajax') ?>
219