1b00cb080SGreg Roach<?php 2b00cb080SGreg Roach 3b00cb080SGreg Roach/** 4b00cb080SGreg Roach * webtrees: online genealogy 5*89f7189bSGreg Roach * Copyright (C) 2021 webtrees development team 6b00cb080SGreg Roach * This program is free software: you can redistribute it and/or modify 7b00cb080SGreg Roach * it under the terms of the GNU General Public License as published by 8b00cb080SGreg Roach * the Free Software Foundation, either version 3 of the License, or 9b00cb080SGreg Roach * (at your option) any later version. 10b00cb080SGreg Roach * This program is distributed in the hope that it will be useful, 11b00cb080SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 12b00cb080SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13b00cb080SGreg Roach * GNU General Public License for more details. 14b00cb080SGreg Roach * You should have received a copy of the GNU General Public License 15*89f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 16b00cb080SGreg Roach */ 17b00cb080SGreg Roach 18b00cb080SGreg Roachdeclare(strict_types=1); 19b00cb080SGreg Roach 20b00cb080SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers; 21b00cb080SGreg Roach 22b00cb080SGreg Roachuse Fisharebest\Webtrees\Tree; 23b00cb080SGreg Roachuse Psr\Http\Message\ResponseInterface; 24b00cb080SGreg Roachuse Psr\Http\Message\ServerRequestInterface; 25b00cb080SGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 26b00cb080SGreg Roach 27b00cb080SGreg Roachuse function assert; 28b00cb080SGreg Roachuse function redirect; 29b00cb080SGreg Roachuse function route; 30b00cb080SGreg Roach 31b00cb080SGreg Roach/** 32b00cb080SGreg Roach * Show anniversaries for events in a given day/month/year. 33b00cb080SGreg Roach */ 34b00cb080SGreg Roachclass CalendarAction implements RequestHandlerInterface 35b00cb080SGreg Roach{ 36b00cb080SGreg Roach /** 37b00cb080SGreg Roach * @param ServerRequestInterface $request 38b00cb080SGreg Roach * 39b00cb080SGreg Roach * @return ResponseInterface 40b00cb080SGreg Roach */ 41b00cb080SGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 42b00cb080SGreg Roach { 43b00cb080SGreg Roach $tree = $request->getAttribute('tree'); 44b00cb080SGreg Roach assert($tree instanceof Tree); 45b00cb080SGreg Roach 46b00cb080SGreg Roach $view = $request->getAttribute('view'); 47b00cb080SGreg Roach 48b00cb080SGreg Roach $params = (array) $request->getParsedBody(); 49b00cb080SGreg Roach 50b00cb080SGreg Roach $params['tree'] = $tree->name(); 51b00cb080SGreg Roach $params['view'] = $view; 52b00cb080SGreg Roach 53b00cb080SGreg Roach return redirect(route(CalendarPage::class, $params)); 54b00cb080SGreg Roach } 55b00cb080SGreg Roach} 56