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