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