xref: /webtrees/app/Http/RequestHandlers/SiteRegistrationPage.php (revision c7aa856b917ed7f821ff91e715981bae3c43d016)
1*c7aa856bSGreg Roach<?php
2*c7aa856bSGreg Roach
3*c7aa856bSGreg Roach/**
4*c7aa856bSGreg Roach * webtrees: online genealogy
5*c7aa856bSGreg Roach * Copyright (C) 2019 webtrees development team
6*c7aa856bSGreg Roach * This program is free software: you can redistribute it and/or modify
7*c7aa856bSGreg Roach * it under the terms of the GNU General Public License as published by
8*c7aa856bSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9*c7aa856bSGreg Roach * (at your option) any later version.
10*c7aa856bSGreg Roach * This program is distributed in the hope that it will be useful,
11*c7aa856bSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12*c7aa856bSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13*c7aa856bSGreg Roach * GNU General Public License for more details.
14*c7aa856bSGreg Roach * You should have received a copy of the GNU General Public License
15*c7aa856bSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16*c7aa856bSGreg Roach */
17*c7aa856bSGreg Roach
18*c7aa856bSGreg Roachdeclare(strict_types=1);
19*c7aa856bSGreg Roach
20*c7aa856bSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
21*c7aa856bSGreg Roach
22*c7aa856bSGreg Roachuse Fisharebest\Webtrees\Http\ViewResponseTrait;
23*c7aa856bSGreg Roachuse Fisharebest\Webtrees\I18N;
24*c7aa856bSGreg Roachuse Psr\Http\Message\ResponseInterface;
25*c7aa856bSGreg Roachuse Psr\Http\Message\ServerRequestInterface;
26*c7aa856bSGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
27*c7aa856bSGreg Roach
28*c7aa856bSGreg Roach/**
29*c7aa856bSGreg Roach * Edit the site preferences.
30*c7aa856bSGreg Roach */
31*c7aa856bSGreg Roachclass SiteRegistrationPage implements RequestHandlerInterface
32*c7aa856bSGreg Roach{
33*c7aa856bSGreg Roach    use ViewResponseTrait;
34*c7aa856bSGreg Roach
35*c7aa856bSGreg Roach    /**
36*c7aa856bSGreg Roach     * @param ServerRequestInterface $request
37*c7aa856bSGreg Roach     *
38*c7aa856bSGreg Roach     * @return ResponseInterface
39*c7aa856bSGreg Roach     */
40*c7aa856bSGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
41*c7aa856bSGreg Roach    {
42*c7aa856bSGreg Roach        $this->layout = 'layouts/administration';
43*c7aa856bSGreg Roach
44*c7aa856bSGreg Roach        $title = I18N::translate('Sign-in and registration');
45*c7aa856bSGreg Roach
46*c7aa856bSGreg Roach        $registration_text_options = [
47*c7aa856bSGreg Roach            0 => I18N::translate('No predefined text'),
48*c7aa856bSGreg Roach            1 => I18N::translate('Predefined text that states all users can request a user account'),
49*c7aa856bSGreg Roach            2 => I18N::translate('Predefined text that states admin will decide on each request for a user account'),
50*c7aa856bSGreg Roach            3 => I18N::translate('Predefined text that states only family members can request a user account'),
51*c7aa856bSGreg Roach            4 => I18N::translate('Choose user defined welcome text typed below'),
52*c7aa856bSGreg Roach        ];
53*c7aa856bSGreg Roach
54*c7aa856bSGreg Roach        return $this->viewResponse('admin/site-registration', [
55*c7aa856bSGreg Roach            'language_tag'              => I18N::languageTag(),
56*c7aa856bSGreg Roach            'registration_text_options' => $registration_text_options,
57*c7aa856bSGreg Roach            'title'                     => $title,
58*c7aa856bSGreg Roach        ]);
59*c7aa856bSGreg Roach    }
60*c7aa856bSGreg Roach}
61