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