diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2021-01-15 18:21:01 +0000 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2021-01-15 18:21:01 +0000 |
| commit | 4c3563c0d95e22997e247ca4944dff997416f927 (patch) | |
| tree | c0b0ecfdd45f89ba4ac2c9931c8303c7edc2690d /app/Http/RequestHandlers/UserAddPage.php | |
| parent | 26e1ac84be2e21522c28114803a36810b84aa8cc (diff) | |
| download | webtrees-4c3563c0d95e22997e247ca4944dff997416f927.tar.gz webtrees-4c3563c0d95e22997e247ca4944dff997416f927.tar.bz2 webtrees-4c3563c0d95e22997e247ca4944dff997416f927.zip | |
Refactor controller as request handlers
Diffstat (limited to 'app/Http/RequestHandlers/UserAddPage.php')
| -rw-r--r-- | app/Http/RequestHandlers/UserAddPage.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/app/Http/RequestHandlers/UserAddPage.php b/app/Http/RequestHandlers/UserAddPage.php new file mode 100644 index 0000000000..e5f0568e1a --- /dev/null +++ b/app/Http/RequestHandlers/UserAddPage.php @@ -0,0 +1,57 @@ +<?php + +/** + * webtrees: online genealogy + * Copyright (C) 2021 webtrees development team + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +declare(strict_types=1); + +namespace Fisharebest\Webtrees\Http\RequestHandlers; + +use Fisharebest\Webtrees\Http\ViewResponseTrait; +use Fisharebest\Webtrees\I18N; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Server\RequestHandlerInterface; + +/** + * Add a user. + */ +class UserAddPage implements RequestHandlerInterface +{ + use ViewResponseTrait; + + /** + * @param ServerRequestInterface $request + * + * @return ResponseInterface + */ + public function handle(ServerRequestInterface $request): ResponseInterface + { + $this->layout = 'layouts/administration'; + + $params = (array) $request->getQueryParams(); + $email = $params['email'] ?? ''; + $real_name = $params['real_name'] ?? ''; + $username = $params['username'] ?? ''; + $title = I18N::translate('Add a user'); + + return $this->viewResponse('admin/users-create', [ + 'email' => $email, + 'real_name' => $real_name, + 'title' => $title, + 'username' => $username, + ]); + } +} |
