xref: /webtrees/app/Http/RequestHandlers/FixLevel0MediaPage.php (revision d11be7027e34e3121be11cc025421873364403f9)
14b3ef6caSGreg Roach<?php
24b3ef6caSGreg Roach
34b3ef6caSGreg Roach/**
44b3ef6caSGreg Roach * webtrees: online genealogy
5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team
64b3ef6caSGreg Roach * This program is free software: you can redistribute it and/or modify
74b3ef6caSGreg Roach * it under the terms of the GNU General Public License as published by
84b3ef6caSGreg Roach * the Free Software Foundation, either version 3 of the License, or
94b3ef6caSGreg Roach * (at your option) any later version.
104b3ef6caSGreg Roach * This program is distributed in the hope that it will be useful,
114b3ef6caSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
124b3ef6caSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
134b3ef6caSGreg Roach * GNU General Public License for more details.
144b3ef6caSGreg Roach * You should have received a copy of the GNU General Public License
154b3ef6caSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
164b3ef6caSGreg Roach */
174b3ef6caSGreg Roach
184b3ef6caSGreg Roachdeclare(strict_types=1);
194b3ef6caSGreg Roach
204b3ef6caSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
214b3ef6caSGreg Roach
224b3ef6caSGreg Roachuse Fisharebest\Webtrees\Http\ViewResponseTrait;
234b3ef6caSGreg Roachuse Fisharebest\Webtrees\I18N;
244b3ef6caSGreg Roachuse Psr\Http\Message\ResponseInterface;
254b3ef6caSGreg Roachuse Psr\Http\Message\ServerRequestInterface;
264b3ef6caSGreg Roachuse Psr\Http\Server\RequestHandlerInterface;
274b3ef6caSGreg Roach
284b3ef6caSGreg Roach/**
294b3ef6caSGreg Roach * Move media links from records to facts.
304b3ef6caSGreg Roach */
314b3ef6caSGreg Roachclass FixLevel0MediaPage implements RequestHandlerInterface
324b3ef6caSGreg Roach{
334b3ef6caSGreg Roach    use ViewResponseTrait;
344b3ef6caSGreg Roach
354b3ef6caSGreg Roach    /**
364b3ef6caSGreg Roach     * If media objects are wronly linked to top-level records, reattach them
374b3ef6caSGreg Roach     * to facts/events.
384b3ef6caSGreg Roach     *
394b3ef6caSGreg Roach     * @param ServerRequestInterface $request
404b3ef6caSGreg Roach     *
414b3ef6caSGreg Roach     * @return ResponseInterface
424b3ef6caSGreg Roach     */
434b3ef6caSGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
444b3ef6caSGreg Roach    {
454b3ef6caSGreg Roach        $this->layout = 'layouts/administration';
464b3ef6caSGreg Roach
474b3ef6caSGreg Roach        return $this->viewResponse('admin/fix-level-0-media', [
484b3ef6caSGreg Roach            'title' => I18N::translate('Link media objects to facts and events'),
494b3ef6caSGreg Roach        ]);
504b3ef6caSGreg Roach    }
514b3ef6caSGreg Roach}
52