xref: /webtrees/app/Http/RequestHandlers/AddUnlinkedPage.php (revision 7c7d1e03066c50e172e4a6239e322c1e0cd62040)
1*7c7d1e03SGreg Roach<?php
2*7c7d1e03SGreg Roach
3*7c7d1e03SGreg Roach/**
4*7c7d1e03SGreg Roach * webtrees: online genealogy
5*7c7d1e03SGreg Roach * Copyright (C) 2020 webtrees development team
6*7c7d1e03SGreg Roach * This program is free software: you can redistribute it and/or modify
7*7c7d1e03SGreg Roach * it under the terms of the GNU General Public License as published by
8*7c7d1e03SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*7c7d1e03SGreg Roach * (at your option) any later version.
10*7c7d1e03SGreg Roach * This program is distributed in the hope that it will be useful,
11*7c7d1e03SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*7c7d1e03SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*7c7d1e03SGreg Roach * GNU General Public License for more details.
14*7c7d1e03SGreg Roach * You should have received a copy of the GNU General Public License
15*7c7d1e03SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*7c7d1e03SGreg Roach */
17*7c7d1e03SGreg Roach
18*7c7d1e03SGreg Roachdeclare(strict_types=1);
19*7c7d1e03SGreg Roach
20*7c7d1e03SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
21*7c7d1e03SGreg Roach
22*7c7d1e03SGreg Roachuse Fisharebest\Webtrees\Auth;
23*7c7d1e03SGreg Roachuse Fisharebest\Webtrees\Factory;
24*7c7d1e03SGreg Roachuse Fisharebest\Webtrees\Http\ViewResponseTrait;
25*7c7d1e03SGreg Roachuse Fisharebest\Webtrees\I18N;
26*7c7d1e03SGreg Roachuse Fisharebest\Webtrees\Tree;
27*7c7d1e03SGreg Roachuse Psr\Http\Message\ResponseInterface;
28*7c7d1e03SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
29*7c7d1e03SGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
30*7c7d1e03SGreg Roach
31*7c7d1e03SGreg Roachuse function assert;
32*7c7d1e03SGreg Roach
33*7c7d1e03SGreg Roach/**
34*7c7d1e03SGreg Roach * Create a new unlinked individual.
35*7c7d1e03SGreg Roach */
36*7c7d1e03SGreg Roachclass AddUnlinkedPage implements RequestHandlerInterface
37*7c7d1e03SGreg Roach{
38*7c7d1e03SGreg Roach    use ViewResponseTrait;
39*7c7d1e03SGreg Roach
40*7c7d1e03SGreg Roach    /**
41*7c7d1e03SGreg Roach     * @param ServerRequestInterface $request
42*7c7d1e03SGreg Roach     *
43*7c7d1e03SGreg Roach     * @return ResponseInterface
44*7c7d1e03SGreg Roach     */
45*7c7d1e03SGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
46*7c7d1e03SGreg Roach    {
47*7c7d1e03SGreg Roach        $tree = $request->getAttribute('tree');
48*7c7d1e03SGreg Roach        assert($tree instanceof Tree);
49*7c7d1e03SGreg Roach
50*7c7d1e03SGreg Roach        return $this->viewResponse('edit/new-individual', [
51*7c7d1e03SGreg Roach            'next_action' => AddUnlinkedAction::class,
52*7c7d1e03SGreg Roach            'tree'        => $tree,
53*7c7d1e03SGreg Roach            'title'       => I18N::translate('Create an individual'),
54*7c7d1e03SGreg Roach            'individual'  => null,
55*7c7d1e03SGreg Roach            'family'      => null,
56*7c7d1e03SGreg Roach            'name_fact'   => null,
57*7c7d1e03SGreg Roach            'famtag'      => '',
58*7c7d1e03SGreg Roach            'gender'      => 'U',
59*7c7d1e03SGreg Roach        ]);
60*7c7d1e03SGreg Roach    }
61*7c7d1e03SGreg Roach}
62