11afbbc50SGreg Roach<?php 21afbbc50SGreg Roach 31afbbc50SGreg Roach/** 41afbbc50SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 61afbbc50SGreg Roach * This program is free software: you can redistribute it and/or modify 71afbbc50SGreg Roach * it under the terms of the GNU General Public License as published by 81afbbc50SGreg Roach * the Free Software Foundation, either version 3 of the License, or 91afbbc50SGreg Roach * (at your option) any later version. 101afbbc50SGreg Roach * This program is distributed in the hope that it will be useful, 111afbbc50SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 121afbbc50SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 131afbbc50SGreg Roach * GNU General Public License for more details. 141afbbc50SGreg 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/>. 161afbbc50SGreg Roach */ 171afbbc50SGreg Roach 181afbbc50SGreg Roachdeclare(strict_types=1); 191afbbc50SGreg Roach 201afbbc50SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers; 211afbbc50SGreg Roach 221afbbc50SGreg Roachuse Fisharebest\Webtrees\Auth; 231afbbc50SGreg Roachuse Fisharebest\Webtrees\Http\ViewResponseTrait; 241afbbc50SGreg Roachuse Fisharebest\Webtrees\I18N; 256b9cb339SGreg Roachuse Fisharebest\Webtrees\Registry; 26b55cbc6bSGreg Roachuse Fisharebest\Webtrees\Validator; 271afbbc50SGreg Roachuse Psr\Http\Message\ResponseInterface; 281afbbc50SGreg Roachuse Psr\Http\Message\ServerRequestInterface; 291afbbc50SGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 301afbbc50SGreg Roach 311afbbc50SGreg Roach/** 321afbbc50SGreg Roach * Reorder the parents and/or spouses of an individual. 331afbbc50SGreg Roach */ 341afbbc50SGreg Roachclass ReorderFamiliesPage implements RequestHandlerInterface 351afbbc50SGreg Roach{ 361afbbc50SGreg Roach use ViewResponseTrait; 371afbbc50SGreg Roach 381afbbc50SGreg Roach /** 391afbbc50SGreg Roach * @param ServerRequestInterface $request 401afbbc50SGreg Roach * 411afbbc50SGreg Roach * @return ResponseInterface 421afbbc50SGreg Roach */ 431afbbc50SGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 441afbbc50SGreg 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); 481afbbc50SGreg Roach $individual = Auth::checkIndividualAccess($individual, true); 491afbbc50SGreg Roach $title = $individual->fullName() . ' — ' . I18N::translate('Re-order families'); 501afbbc50SGreg Roach 511afbbc50SGreg Roach return $this->viewResponse('edit/reorder-families', [ 521afbbc50SGreg Roach 'famc_facts' => $individual->facts(['FAMC']), 531afbbc50SGreg Roach 'fams_facts' => $individual->facts(['FAMS']), 541afbbc50SGreg Roach 'individual' => $individual, 551afbbc50SGreg Roach 'title' => $title, 561afbbc50SGreg Roach 'tree' => $tree, 571afbbc50SGreg Roach ]); 581afbbc50SGreg Roach } 591afbbc50SGreg Roach} 60