1<?php 2 3use Fisharebest\Webtrees\Auth; 4use Fisharebest\Webtrees\Date; 5use Fisharebest\Webtrees\Date\AbstractCalendarDate; 6use Fisharebest\Webtrees\Http\RequestHandlers\CalendarAction; 7use Fisharebest\Webtrees\Http\RequestHandlers\CalendarEvents; 8use Fisharebest\Webtrees\Http\RequestHandlers\CalendarPage; 9use Fisharebest\Webtrees\I18N; 10use Fisharebest\Webtrees\Registry; 11use Fisharebest\Webtrees\Tree; 12 13/** 14 * @var string $cal 15 * @var AbstractCalendarDate $cal_date 16 * @var string $cal_month 17 * @var int $day 18 * @var int $days_in_month 19 * @var string $filterev 20 * @var string $filterof 21 * @var string $filtersx 22 * @var int $month 23 * @var array<string> $months 24 * @var string $title 25 * @var AbstractCalendarDate $today 26 * @var string $today_month 27 * @var Tree $tree 28 * @var string $view 29 * @var int $year 30 */ 31 32?> 33 34<h2 class="wt-page-title"> 35 <?= $title ?> 36</h2> 37 38<table class="table-sm wt-page-options w-100" role="presentation"> 39 <tr> 40 <th class="wt-page-options-label"> 41 <?= I18N::translate('Day') ?> 42 </th> 43 <td class="wt-page-options-value" colspan="3"> 44 <?php for ($d = 1; $d <= $days_in_month; $d++) : ?> 45 <a <?= $d === $cal_date->day() ? 'class="error"' : '' ?> href="<?= e(route(CalendarPage::class, ['cal' => $cal, 'day' => $d, 'month' => $cal_month, 'year' => $cal_date->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'day', 'tree' => $tree->name()])) ?>" rel="nofollow"> 46 <?= (new Date($cal_date->format("%@ {$d} %O %E")))->minimumDate()->format('%j') ?> 47 </a> 48 | 49 <?php endfor ?> 50 <a href="<?= e(route(CalendarPage::class, ['cal' => $cal, 'day' => $today->day(), 'month' => $today_month, 'year' => $today->year(), 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx, 'view' => 'day', 'tree' => $tree->name()])) ?>" rel="nofollow"> 51 <b><?php $tmp = new Date($today->format('%@ %A %O %E')); echo $tmp->display() ?></b> 52 </a> 53 </td> 54 </tr> 55 <tr> 56 <th class="wt-page-options-label"> 57 <?= I18N::translate('Month') ?> 58 </th> 59 <td class="wt-page-options-value" colspan="3"> 60 <?php foreach ($months as $m => $month_name) : ?> 61 <a href="<?= e(route(CalendarPage::class, ['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"> 62 <?php if ($m === $cal_month) : ?> 63 <span class="error"><?= e($month_name) ?></span> 64 <?php else : ?> 65 <?= e($month_name) ?> 66 <?php endif ?> 67 </a> | 68 <?php endforeach ?> 69 <a href="<?= e(route(CalendarPage::class, ['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"> 70 <b><?= $today->format('%F %Y') ?></b> 71 </a> 72 </td> 73 </tr> 74 <tr> 75 <th class="wt-page-options-label"> 76 <label for="year"><?= I18N::translate('Year') ?></label> 77 </th> 78 79 <td class="wt-page-options-value"> 80 <form method="post" action="<?= e(route(CalendarAction::class, ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline"> 81 <input type="hidden" name="cal" value="<?= e($cal) ?>"> 82 <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>"> 83 <input type="hidden" name="month" value="<?= e($cal_month) ?>"> 84 <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>"> 85 <input type="hidden" name="filterof" value="<?= e($filterof) ?>"> 86 <input type="hidden" name="filterev" value="<?= e($filterev) ?>"> 87 88 <a href="<?= e(route(CalendarPage::class, ['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"> 89 -1 90 </a> 91 92 <input type="text" id="year" name="year" value="<?= $year ?>" size="4"> 93 94 <a href="<?= e(route(CalendarPage::class, ['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"> 95 +1 96 </a> 97 | 98 <a href="<?= e(route(CalendarPage::class, ['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"> 99 <?= $today->format('%Y') ?> 100 </a> 101 102 <?= csrf_field() ?> 103 </form> 104 </td> 105 106 <th class="wt-page-options-label"> 107 <?= I18N::translate('Show') ?> 108 </th> 109 110 <td class="wt-page-options-value"> 111 <?php if (!$tree->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) : ?> 112 <form method="post" action="<?= e(route(CalendarAction::class, ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline"> 113 <input type="hidden" name="cal" value="<?= e($cal) ?>"> 114 <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>"> 115 <input type="hidden" name="month" value="<?= e($cal_month) ?>"> 116 <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>"> 117 <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>"> 118 <input type="hidden" name="filterev" value="<?= e($filterev) ?>"> 119 120 <select class="list_value" name="filterof" onchange="this.form.submit();" aria-label="<?= I18N::translate('Filter') ?>"> 121 <option value="all" <?= $filterof === 'all' ? 'selected' : '' ?>> 122 <?= I18N::translate('All individuals') ?> 123 </option> 124 <option value="living" <?= $filterof === 'living' ? 'selected' : '' ?>> 125 <?= I18N::translate('Living individuals') ?> 126 </option> 127 <option value="recent" <?= $filterof === 'recent' ? 'selected' : '' ?>> 128 <?= I18N::translate('Recent years (< 100 yrs)') ?> 129 </option> 130 </select> 131 132 <?= csrf_field() ?> 133 </form> 134 <?php endif ?> 135 136 <a title="<?= I18N::translate('All individuals') ?>" href="<?= e(route(CalendarPage::class, ['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"> 137 <?php if ($filtersx === '') : ?> 138 <?= view('icons/sex', ['sex' => 'M']) ?> 139 <?= view('icons/sex', ['sex' => 'F']) ?> 140 <?php else : ?> 141 <small> 142 <?= view('icons/sex', ['sex' => 'M']) ?> 143 <?= view('icons/sex', ['sex' => 'F']) ?> 144 </small> 145 <?php endif ?> 146 </a> 147 | 148 <a title="<?= I18N::translate('Males') ?>" href="<?= e(route(CalendarPage::class, ['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"> 149 <?php if ($filtersx === 'M') : ?> 150 <?= view('icons/sex', ['sex' => 'M']) ?> 151 <?php else : ?> 152 <small> 153 <?= view('icons/sex', ['sex' => 'M']) ?> 154 </small> 155 <?php endif ?> 156 </a> 157 | 158 <a title="<?= I18N::translate('Females') ?>" href="<?= e(route(CalendarPage::class, ['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"> 159 <?php if ($filtersx === 'F') : ?> 160 <?= view('icons/sex', ['sex' => 'F']) ?> 161 <?php else : ?> 162 <small> 163 <?= view('icons/sex', ['sex' => 'F']) ?> 164 </small> 165 <?php endif ?> 166 </a> 167 168 <form method="post" action="<?= e(route(CalendarAction::class, ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline"> 169 <input type="hidden" name="cal" value="<?= e($cal) ?>"> 170 <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>"> 171 <input type="hidden" name="month" value="<?= e($cal_month) ?>"> 172 <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>"> 173 <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>"> 174 <input type="hidden" name="filterof" value="<?= e($filterof) ?>"> 175 176 <select class="list_value" name="filterev" onchange="this.form.submit();" aria-label="<?= I18N::translate('Events') ?>"> 177 <option value="BIRT-MARR-DEAT" <?= $filterev === 'BIRT-MARR-DEAT' ? 'selected' : '' ?>> 178 <?= I18N::translate('Vital records') ?> 179 </option> 180 <option value="" <?= $filterev === '' ? 'selected' : '' ?>> 181 <?= I18N::translate('All') ?> 182 </option> 183 <option value="BIRT" <?= $filterev === 'BIRT' ? 'selected' : '' ?>> 184 <?= I18N::translate('Birth') ?> 185 </option> 186 <option value="BAPM-CHR-CHRA" <?= $filterev === 'BAPM-CHR-CHRA' ? 'selected' : '' ?>> 187 <?= I18N::translate('Baptism') ?> 188 </option> 189 <option value="MARR-_COML-_NMR" <?= $filterev === 'MARR-_COML-_NMR' ? 'selected' : '' ?>> 190 <?= I18N::translate('Marriage') ?> 191 </option> 192 <option value="DIV-_SEPR" <?= $filterev === 'DIV-_SEPR' ? 'selected' : '' ?>> 193 <?= I18N::translate('Divorce') ?> 194 </option> 195 <option value="DEAT" <?= $filterev === 'DEAT' ? 'selected' : '' ?>> 196 <?= I18N::translate('Death') ?> 197 </option> 198 <option value="BURI" <?= $filterev === 'BURI' ? 'selected' : '' ?>> 199 <?= I18N::translate('Burial') ?> 200 </option> 201 <option value="IMMI,EMIG" <?= $filterev === 'IMMI,EMIG' ? 'selected' : '' ?>> 202 <?= I18N::translate('Emigration') ?> 203 </option> 204 <option value="EVEN" <?= $filterev === 'EVEN' ? 'selected' : '' ?>> 205 <?= I18N::translate('Custom event') ?> 206 </option> 207 </select> 208 209 <?= csrf_field() ?> 210 </form> 211 </td> 212 </tr> 213</table> 214 215<table class="w-100"> 216 <tr> 217 <td class="wt-page-options-value text-center"> 218 <a class="<?= $view === 'day' ? 'error' : '' ?>" href="<?= e(route(CalendarPage::class, ['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"> 219 <?= I18N::translate('View this day') ?> 220 </a> 221 | 222 <a class="<?= $view === 'month' ? 'error' : '' ?>" href="<?= e(route(CalendarPage::class, ['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"> 223 <?= I18N::translate('View this month') ?> 224 </a> 225 | 226 <a class="<?= $view === 'year' ? 'error' : '' ?>" href="<?= e(route(CalendarPage::class, ['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"> 227 <?= I18N::translate('View this year') ?> 228 </a> 229 </td> 230 <td class="wt-page-options-value text-center"> 231 <?php 232 $n = 0; 233 foreach (Registry::calendarDateFactory()->supportedCalendars() as $newcal => $cal_name) { 234 $tmp = $cal_date->convertToCalendar($newcal); 235 if ($tmp->inValidRange()) { 236 if ($n++) { 237 echo ' | '; 238 } 239 echo '<a ' . (get_class($tmp) === get_class($cal_date) ? 'class="error"' : '') . ' href="' . e(route(CalendarPage::class, ['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>'; 240 } 241 } ?> 242 </td> 243 </tr> 244</table> 245 246<div class="wt-ajax-load wt-page-content" data-wt-ajax-url="<?= e(route(CalendarEvents::class, ['tree' => $tree->name(), 'cal' => $cal, 'day' => $cal_date->day(), 'month' => $cal_month, 'year' => $year, 'view' => $view, 'filterev' => $filterev, 'filterof' => $filterof, 'filtersx' => $filtersx])) ?>"></div> 247 248<?= view('modals/ajax') ?> 249