xref: /webtrees/app/Http/RequestHandlers/UnconnectedAction.php (revision b46c87bda4b592cf9252f1db48552a820b1e3d97)
196716c47SGreg Roach<?php
296716c47SGreg Roach
396716c47SGreg Roach/**
496716c47SGreg Roach * webtrees: online genealogy
596716c47SGreg Roach * Copyright (C) 2019 webtrees development team
696716c47SGreg Roach * This program is free software: you can redistribute it and/or modify
796716c47SGreg Roach * it under the terms of the GNU General Public License as published by
896716c47SGreg Roach * the Free Software Foundation, either version 3 of the License, or
996716c47SGreg Roach * (at your option) any later version.
1096716c47SGreg Roach * This program is distributed in the hope that it will be useful,
1196716c47SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
1296716c47SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1396716c47SGreg Roach * GNU General Public License for more details.
1496716c47SGreg Roach * You should have received a copy of the GNU General Public License
1596716c47SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
1696716c47SGreg Roach */
1796716c47SGreg Roach
1896716c47SGreg Roachdeclare(strict_types=1);
1996716c47SGreg Roach
2096716c47SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
2196716c47SGreg Roach
2296716c47SGreg Roachuse Fisharebest\Webtrees\Tree;
2396716c47SGreg Roachuse Psr\Http\Message\ResponseInterface;
2496716c47SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
2596716c47SGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
2696716c47SGreg Roach
2796716c47SGreg Roachuse function assert;
2896716c47SGreg Roach
2996716c47SGreg Roach/**
3096716c47SGreg Roach * Find groups of unrelated individuals.
3196716c47SGreg Roach */
3296716c47SGreg Roachclass UnconnectedAction implements RequestHandlerInterface
3396716c47SGreg Roach{
3496716c47SGreg Roach    /** @var string */
3596716c47SGreg Roach    protected $layout = 'layouts/administration';
3696716c47SGreg Roach
3796716c47SGreg Roach    /**
3896716c47SGreg Roach     * @param ServerRequestInterface $request
3996716c47SGreg Roach     *
4096716c47SGreg Roach     * @return ResponseInterface
4196716c47SGreg Roach     */
4296716c47SGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
4396716c47SGreg Roach    {
4496716c47SGreg Roach        $tree = $request->getAttribute('tree');
4596716c47SGreg Roach        assert($tree instanceof Tree);
4696716c47SGreg Roach
47*b46c87bdSGreg Roach        $params = (array) $request->getParsedBody();
48*b46c87bdSGreg Roach
49*b46c87bdSGreg Roach        $associates = $params['associates'] ?? '';
5096716c47SGreg Roach
5196716c47SGreg Roach        return redirect(route(UnconnectedPage::class, ['tree' => $tree->name(), 'associates' => $associates]));
5296716c47SGreg Roach    }
5396716c47SGreg Roach}
54