15229eadeSGreg Roach<?php 25229eadeSGreg Roach 35229eadeSGreg Roach/** 45229eadeSGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 65229eadeSGreg Roach * This program is free software: you can redistribute it and/or modify 75229eadeSGreg Roach * it under the terms of the GNU General Public License as published by 85229eadeSGreg Roach * the Free Software Foundation, either version 3 of the License, or 95229eadeSGreg Roach * (at your option) any later version. 105229eadeSGreg Roach * This program is distributed in the hope that it will be useful, 115229eadeSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 125229eadeSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 135229eadeSGreg Roach * GNU General Public License for more details. 145229eadeSGreg 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/>. 165229eadeSGreg Roach */ 17fcfa147eSGreg Roach 185229eadeSGreg Roachdeclare(strict_types=1); 195229eadeSGreg Roach 205229eadeSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers; 215229eadeSGreg Roach 225229eadeSGreg Roachuse Fisharebest\Webtrees\Auth; 235229eadeSGreg Roachuse Fisharebest\Webtrees\Http\ViewResponseTrait; 245229eadeSGreg Roachuse Fisharebest\Webtrees\I18N; 256b9cb339SGreg Roachuse Fisharebest\Webtrees\Registry; 26b55cbc6bSGreg Roachuse Fisharebest\Webtrees\Validator; 275229eadeSGreg Roachuse Psr\Http\Message\ResponseInterface; 285229eadeSGreg Roachuse Psr\Http\Message\ServerRequestInterface; 295229eadeSGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 305229eadeSGreg Roach 315229eadeSGreg Roach/** 325229eadeSGreg Roach * Reorder the names of an individual. 335229eadeSGreg Roach */ 345229eadeSGreg Roachclass ReorderNamesPage implements RequestHandlerInterface 355229eadeSGreg Roach{ 365229eadeSGreg Roach use ViewResponseTrait; 375229eadeSGreg Roach 385229eadeSGreg Roach /** 395229eadeSGreg Roach * @param ServerRequestInterface $request 405229eadeSGreg Roach * 415229eadeSGreg Roach * @return ResponseInterface 425229eadeSGreg Roach */ 435229eadeSGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 445229eadeSGreg Roach { 45b55cbc6bSGreg Roach $tree = Validator::attributes($request)->tree(); 46b55cbc6bSGreg Roach $xref = Validator::attributes($request)->isXref()->string('xref'); 476b9cb339SGreg Roach $individual = Registry::individualFactory()->make($xref, $tree); 48ddeb3354SGreg Roach $individual = Auth::checkIndividualAccess($individual, true); 495229eadeSGreg Roach $title = $individual->fullName() . ' — ' . I18N::translate('Re-order names'); 505229eadeSGreg Roach 515229eadeSGreg Roach return $this->viewResponse('edit/reorder-names', [ 525229eadeSGreg Roach 'individual' => $individual, 535229eadeSGreg Roach 'title' => $title, 545229eadeSGreg Roach 'tree' => $tree, 555229eadeSGreg Roach ]); 565229eadeSGreg Roach } 575229eadeSGreg Roach} 58