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