1a69f5655SGreg Roach<?php 2d70512abSGreg Roach 3a69f5655SGreg Roachuse Fisharebest\Webtrees\Auth; 4a69f5655SGreg Roachuse Fisharebest\Webtrees\Date; 5b00cb080SGreg Roachuse Fisharebest\Webtrees\Date\AbstractCalendarDate; 6b00cb080SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\CalendarAction; 7b00cb080SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\CalendarEvents; 8b00cb080SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\CalendarPage; 9a69f5655SGreg Roachuse Fisharebest\Webtrees\I18N; 10f882f05dSGreg Roachuse Fisharebest\Webtrees\Registry; 117c2c99faSGreg Roachuse Fisharebest\Webtrees\Tree; 12d70512abSGreg Roach 13b00cb080SGreg Roach/** 14b00cb080SGreg Roach * @var string $cal 15b00cb080SGreg Roach * @var AbstractCalendarDate $cal_date 16b00cb080SGreg Roach * @var string $cal_month 17b00cb080SGreg Roach * @var int $day 18b00cb080SGreg Roach * @var int $days_in_month 19b00cb080SGreg Roach * @var string $filterev 20b00cb080SGreg Roach * @var string $filterof 21b00cb080SGreg Roach * @var string $filtersx 22b00cb080SGreg Roach * @var int $month 23b00cb080SGreg Roach * @var array<string> $months 24b00cb080SGreg Roach * @var string $title 25b00cb080SGreg Roach * @var AbstractCalendarDate $today 26b00cb080SGreg Roach * @var string $today_month 277c2c99faSGreg Roach * @var Tree $tree 28b00cb080SGreg Roach * @var string $view 29b00cb080SGreg Roach * @var int $year 30b00cb080SGreg Roach */ 31b00cb080SGreg Roach 32a69f5655SGreg Roach?> 33dd6b2bfcSGreg Roach 34dd6b2bfcSGreg Roach<h2 class="wt-page-title"> 35dd6b2bfcSGreg Roach <?= $title ?> 36dd6b2bfcSGreg Roach</h2> 37dd6b2bfcSGreg Roach 38dd6b2bfcSGreg Roach<table class="table-sm wt-page-options w-100" role="presentation"> 39dd6b2bfcSGreg Roach <tr> 40dd6b2bfcSGreg Roach <th class="wt-page-options-label"> 41dd6b2bfcSGreg Roach <?= I18N::translate('Day') ?> 42dd6b2bfcSGreg Roach </th> 43dd6b2bfcSGreg Roach <td class="wt-page-options-value" colspan="3"> 44dd6b2bfcSGreg Roach <?php for ($d = 1; $d <= $days_in_month; $d++) : ?> 45b00cb080SGreg Roach <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"> 46dd6b2bfcSGreg Roach <?= (new Date($cal_date->format("%@ {$d} %O %E")))->minimumDate()->format('%j') ?> 47dd6b2bfcSGreg Roach </a> 48dd6b2bfcSGreg Roach | 49dd6b2bfcSGreg Roach <?php endfor ?> 50b00cb080SGreg Roach <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"> 51dd6b2bfcSGreg Roach <b><?php $tmp = new Date($today->format('%@ %A %O %E')); echo $tmp->display() ?></b> 52dd6b2bfcSGreg Roach </a> 53dd6b2bfcSGreg Roach </td> 54dd6b2bfcSGreg Roach </tr> 55dd6b2bfcSGreg Roach <tr> 56dd6b2bfcSGreg Roach <th class="wt-page-options-label"> 57dd6b2bfcSGreg Roach <?= I18N::translate('Month') ?> 58dd6b2bfcSGreg Roach </th> 59dd6b2bfcSGreg Roach <td class="wt-page-options-value" colspan="3"> 60dd6b2bfcSGreg Roach <?php foreach ($months as $m => $month_name) : ?> 61b00cb080SGreg Roach <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"> 62dd6b2bfcSGreg Roach <?php if ($m === $cal_month) : ?> 63dd6b2bfcSGreg Roach <span class="error"><?= e($month_name) ?></span> 64dd6b2bfcSGreg Roach <?php else : ?> 65dd6b2bfcSGreg Roach <?= e($month_name) ?> 66dd6b2bfcSGreg Roach <?php endif ?> 67dd6b2bfcSGreg Roach </a> | 68dd6b2bfcSGreg Roach <?php endforeach ?> 69b00cb080SGreg Roach <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"> 70dd6b2bfcSGreg Roach <b><?= $today->format('%F %Y') ?></b> 71dd6b2bfcSGreg Roach </a> 72dd6b2bfcSGreg Roach </td> 73dd6b2bfcSGreg Roach </tr> 74dd6b2bfcSGreg Roach <tr> 75dd6b2bfcSGreg Roach <th class="wt-page-options-label"> 76dd6b2bfcSGreg Roach <label for="year"><?= I18N::translate('Year') ?></label> 77dd6b2bfcSGreg Roach </th> 7840296c5fSGreg Roach 79dd6b2bfcSGreg Roach <td class="wt-page-options-value"> 80b00cb080SGreg Roach <form method="post" action="<?= e(route(CalendarAction::class, ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline"> 8140296c5fSGreg Roach <input type="hidden" name="cal" value="<?= e($cal) ?>"> 8240296c5fSGreg Roach <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>"> 8340296c5fSGreg Roach <input type="hidden" name="month" value="<?= e($cal_month) ?>"> 8440296c5fSGreg Roach <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>"> 855a6ecf0cSGreg Roach <input type="hidden" name="filterof" value="<?= e($filterof) ?>"> 865a6ecf0cSGreg Roach <input type="hidden" name="filterev" value="<?= e($filterev) ?>"> 8740296c5fSGreg Roach 88b00cb080SGreg Roach <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"> 89dd6b2bfcSGreg Roach -1 90dd6b2bfcSGreg Roach </a> 9140296c5fSGreg Roach 92dd6b2bfcSGreg Roach <input type="text" id="year" name="year" value="<?= $year ?>" size="4"> 9340296c5fSGreg Roach 94b00cb080SGreg Roach <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"> 95dd6b2bfcSGreg Roach +1 96dd6b2bfcSGreg Roach </a> 97dd6b2bfcSGreg Roach | 98b00cb080SGreg Roach <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"> 99dd6b2bfcSGreg Roach <?= $today->format('%Y') ?> 100dd6b2bfcSGreg Roach </a> 101*81443e3cSGreg Roach 102*81443e3cSGreg Roach <?= csrf_field() ?> 10340296c5fSGreg Roach </form> 104dd6b2bfcSGreg Roach </td> 105dd6b2bfcSGreg Roach 106dd6b2bfcSGreg Roach <th class="wt-page-options-label"> 107dd6b2bfcSGreg Roach <?= I18N::translate('Show') ?> 108dd6b2bfcSGreg Roach </th> 109dd6b2bfcSGreg Roach 110dd6b2bfcSGreg Roach <td class="wt-page-options-value"> 111dd6b2bfcSGreg Roach <?php if (!$tree->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) : ?> 112b00cb080SGreg Roach <form method="post" action="<?= e(route(CalendarAction::class, ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline"> 11340296c5fSGreg Roach <input type="hidden" name="cal" value="<?= e($cal) ?>"> 11440296c5fSGreg Roach <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>"> 11540296c5fSGreg Roach <input type="hidden" name="month" value="<?= e($cal_month) ?>"> 11640296c5fSGreg Roach <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>"> 11740296c5fSGreg Roach <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>"> 1185a6ecf0cSGreg Roach <input type="hidden" name="filterev" value="<?= e($filterev) ?>"> 11940296c5fSGreg Roach 120b00cb080SGreg Roach <select class="list_value" name="filterof" onchange="this.form.submit();" aria-label="<?= I18N::translate('Filter') ?>"> 121dd6b2bfcSGreg Roach <option value="all" <?= $filterof === 'all' ? 'selected' : '' ?>> 122dd6b2bfcSGreg Roach <?= I18N::translate('All individuals') ?> 123dd6b2bfcSGreg Roach </option> 124dd6b2bfcSGreg Roach <option value="living" <?= $filterof === 'living' ? 'selected' : '' ?>> 125dd6b2bfcSGreg Roach <?= I18N::translate('Living individuals') ?> 126dd6b2bfcSGreg Roach </option> 127dd6b2bfcSGreg Roach <option value="recent" <?= $filterof === 'recent' ? 'selected' : '' ?>> 128dd6b2bfcSGreg Roach <?= I18N::translate('Recent years (< 100 yrs)') ?> 129dd6b2bfcSGreg Roach </option> 130dd6b2bfcSGreg Roach </select> 131*81443e3cSGreg Roach 132*81443e3cSGreg Roach <?= csrf_field() ?> 13340296c5fSGreg Roach </form> 134dd6b2bfcSGreg Roach <?php endif ?> 135dd6b2bfcSGreg Roach 136b00cb080SGreg Roach <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"> 13797c22350SGreg Roach <?php if ($filtersx === '') : ?> 13808362db4SGreg Roach <?= view('icons/sex', ['sex' => 'M']) ?> 13908362db4SGreg Roach <?= view('icons/sex', ['sex' => 'F']) ?> 14097c22350SGreg Roach <?php else : ?> 14197c22350SGreg Roach <small> 14208362db4SGreg Roach <?= view('icons/sex', ['sex' => 'M']) ?> 14308362db4SGreg Roach <?= view('icons/sex', ['sex' => 'F']) ?> 14497c22350SGreg Roach </small> 14597c22350SGreg Roach <?php endif ?> 146dd6b2bfcSGreg Roach </a> 147dd6b2bfcSGreg Roach | 148b00cb080SGreg Roach <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"> 14997c22350SGreg Roach <?php if ($filtersx === 'M') : ?> 15008362db4SGreg Roach <?= view('icons/sex', ['sex' => 'M']) ?> 15197c22350SGreg Roach <?php else : ?> 15297c22350SGreg Roach <small> 15308362db4SGreg Roach <?= view('icons/sex', ['sex' => 'M']) ?> 15497c22350SGreg Roach </small> 15597c22350SGreg Roach <?php endif ?> 156dd6b2bfcSGreg Roach </a> 157dd6b2bfcSGreg Roach | 158b00cb080SGreg Roach <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"> 15997c22350SGreg Roach <?php if ($filtersx === 'F') : ?> 16008362db4SGreg Roach <?= view('icons/sex', ['sex' => 'F']) ?> 16197c22350SGreg Roach <?php else : ?> 16297c22350SGreg Roach <small> 16308362db4SGreg Roach <?= view('icons/sex', ['sex' => 'F']) ?> 16497c22350SGreg Roach </small> 16597c22350SGreg Roach <?php endif ?> 166dd6b2bfcSGreg Roach </a> 167dd6b2bfcSGreg Roach 168b00cb080SGreg Roach <form method="post" action="<?= e(route(CalendarAction::class, ['tree' => $tree->name(), 'view' => $view])) ?>" class="d-inline"> 16940296c5fSGreg Roach <input type="hidden" name="cal" value="<?= e($cal) ?>"> 17040296c5fSGreg Roach <input type="hidden" name="day" value="<?= e($cal_date->day()) ?>"> 17140296c5fSGreg Roach <input type="hidden" name="month" value="<?= e($cal_month) ?>"> 17240296c5fSGreg Roach <input type="hidden" name="year" value="<?= e($cal_date->year()) ?>"> 17340296c5fSGreg Roach <input type="hidden" name="filtersx" value="<?= e($filtersx) ?>"> 1745a6ecf0cSGreg Roach <input type="hidden" name="filterof" value="<?= e($filterof) ?>"> 17540296c5fSGreg Roach 176b00cb080SGreg Roach <select class="list_value" name="filterev" onchange="this.form.submit();" aria-label="<?= I18N::translate('Events') ?>"> 177dd6b2bfcSGreg Roach <option value="BIRT-MARR-DEAT" <?= $filterev === 'BIRT-MARR-DEAT' ? 'selected' : '' ?>> 178dd6b2bfcSGreg Roach <?= I18N::translate('Vital records') ?> 179dd6b2bfcSGreg Roach </option> 180dd6b2bfcSGreg Roach <option value="" <?= $filterev === '' ? 'selected' : '' ?>> 181dd6b2bfcSGreg Roach <?= I18N::translate('All') ?> 182dd6b2bfcSGreg Roach </option> 183dd6b2bfcSGreg Roach <option value="BIRT" <?= $filterev === 'BIRT' ? 'selected' : '' ?>> 184dd6b2bfcSGreg Roach <?= I18N::translate('Birth') ?> 185dd6b2bfcSGreg Roach </option> 186dd6b2bfcSGreg Roach <option value="BAPM-CHR-CHRA" <?= $filterev === 'BAPM-CHR-CHRA' ? 'selected' : '' ?>> 187dd6b2bfcSGreg Roach <?= I18N::translate('Baptism') ?> 188dd6b2bfcSGreg Roach </option> 189dd6b2bfcSGreg Roach <option value="MARR-_COML-_NMR" <?= $filterev === 'MARR-_COML-_NMR' ? 'selected' : '' ?>> 190dd6b2bfcSGreg Roach <?= I18N::translate('Marriage') ?> 191dd6b2bfcSGreg Roach </option> 192dd6b2bfcSGreg Roach <option value="DIV-_SEPR" <?= $filterev === 'DIV-_SEPR' ? 'selected' : '' ?>> 193dd6b2bfcSGreg Roach <?= I18N::translate('Divorce') ?> 194dd6b2bfcSGreg Roach </option> 195dd6b2bfcSGreg Roach <option value="DEAT" <?= $filterev === 'DEAT' ? 'selected' : '' ?>> 196dd6b2bfcSGreg Roach <?= I18N::translate('Death') ?> 197dd6b2bfcSGreg Roach </option> 198dd6b2bfcSGreg Roach <option value="BURI" <?= $filterev === 'BURI' ? 'selected' : '' ?>> 199dd6b2bfcSGreg Roach <?= I18N::translate('Burial') ?> 200dd6b2bfcSGreg Roach </option> 201dd6b2bfcSGreg Roach <option value="IMMI,EMIG" <?= $filterev === 'IMMI,EMIG' ? 'selected' : '' ?>> 202dd6b2bfcSGreg Roach <?= I18N::translate('Emigration') ?> 203dd6b2bfcSGreg Roach </option> 204dd6b2bfcSGreg Roach <option value="EVEN" <?= $filterev === 'EVEN' ? 'selected' : '' ?>> 205dd6b2bfcSGreg Roach <?= I18N::translate('Custom event') ?> 206dd6b2bfcSGreg Roach </option> 207dd6b2bfcSGreg Roach </select> 208*81443e3cSGreg Roach 209*81443e3cSGreg Roach <?= csrf_field() ?> 21040296c5fSGreg Roach </form> 211dd6b2bfcSGreg Roach </td> 212dd6b2bfcSGreg Roach </tr> 213dd6b2bfcSGreg Roach</table> 214dd6b2bfcSGreg Roach 215e7f5c669SGreg Roach<table class="w-100"> 216dd6b2bfcSGreg Roach <tr> 217ae92a87bSGreg Roach <td class="wt-page-options-value text-center"> 218b00cb080SGreg Roach <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"> 219dd6b2bfcSGreg Roach <?= I18N::translate('View this day') ?> 220dd6b2bfcSGreg Roach </a> 221dd6b2bfcSGreg Roach | 222b00cb080SGreg Roach <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"> 223dd6b2bfcSGreg Roach <?= I18N::translate('View this month') ?> 224dd6b2bfcSGreg Roach </a> 225dd6b2bfcSGreg Roach | 226b00cb080SGreg Roach <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"> 227dd6b2bfcSGreg Roach <?= I18N::translate('View this year') ?> 228dd6b2bfcSGreg Roach </a> 229dd6b2bfcSGreg Roach </td> 230ae92a87bSGreg Roach <td class="wt-page-options-value text-center"> 231dd6b2bfcSGreg Roach <?php 232dd6b2bfcSGreg Roach $n = 0; 233f882f05dSGreg Roach foreach (Registry::calendarDateFactory()->supportedCalendars() as $newcal => $cal_name) { 234dd6b2bfcSGreg Roach $tmp = $cal_date->convertToCalendar($newcal); 235dd6b2bfcSGreg Roach if ($tmp->inValidRange()) { 236dd6b2bfcSGreg Roach if ($n++) { 237dd6b2bfcSGreg Roach echo ' | '; 238dd6b2bfcSGreg Roach } 239b00cb080SGreg Roach 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>'; 240dd6b2bfcSGreg Roach } 241dd6b2bfcSGreg Roach } ?> 242dd6b2bfcSGreg Roach </td> 243dd6b2bfcSGreg Roach </tr> 244dd6b2bfcSGreg Roach</table> 245dd6b2bfcSGreg Roach 246d4786c66SGreg Roach<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> 247dd6b2bfcSGreg Roach 248dd6b2bfcSGreg Roach<?= view('modals/ajax') ?> 249