xref: /webtrees/app/Http/RequestHandlers/ModulesListsAction.php (revision 914ea12f67bcff691919d6fc4703d15491971fab)
19f667ff2SGreg Roach<?php
29f667ff2SGreg Roach
39f667ff2SGreg Roach/**
49f667ff2SGreg Roach * webtrees: online genealogy
59f667ff2SGreg Roach * Copyright (C) 20 webtrees development team
69f667ff2SGreg Roach * This program is free software: you can redistribute it and/or modify
79f667ff2SGreg Roach * it under the terms of the GNU General Public License as published by
89f667ff2SGreg Roach * the Free Software Foundation, either version 3 of the License, or
99f667ff2SGreg Roach * (at your option) any later version.
109f667ff2SGreg Roach * This program is distributed in the hope that it will be useful,
119f667ff2SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
129f667ff2SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
139f667ff2SGreg Roach * GNU General Public License for more details.
149f667ff2SGreg 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/>.
169f667ff2SGreg Roach */
179f667ff2SGreg Roach
189f667ff2SGreg Roachdeclare(strict_types=1);
199f667ff2SGreg Roach
209f667ff2SGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers;
219f667ff2SGreg Roach
229f667ff2SGreg Roachuse Fisharebest\Webtrees\FlashMessages;
239f667ff2SGreg Roachuse Fisharebest\Webtrees\I18N;
249f667ff2SGreg Roachuse Fisharebest\Webtrees\Module\ModuleListInterface;
259f667ff2SGreg Roachuse Psr\Http\Message\ResponseInterface;
269f667ff2SGreg Roachuse Psr\Http\Message\ServerRequestInterface;
279f667ff2SGreg Roach
289f667ff2SGreg Roachuse function redirect;
299f667ff2SGreg Roachuse function route;
309f667ff2SGreg Roach
319f667ff2SGreg Roach/**
329f667ff2SGreg Roach * Update a list of modules.
339f667ff2SGreg Roach */
349f667ff2SGreg Roachclass ModulesListsAction extends AbstractModuleComponentAction
359f667ff2SGreg Roach{
369f667ff2SGreg Roach    /**
379f667ff2SGreg Roach     * @param ServerRequestInterface $request
389f667ff2SGreg Roach     *
399f667ff2SGreg Roach     * @return ResponseInterface
409f667ff2SGreg Roach     */
419f667ff2SGreg Roach    public function handle(ServerRequestInterface $request): ResponseInterface
429f667ff2SGreg Roach    {
439f667ff2SGreg Roach        $this->updateStatus(ModuleListInterface::class, $request);
449f667ff2SGreg Roach        $this->updateAccessLevel(ModuleListInterface::class, $request);
459f667ff2SGreg Roach
469f667ff2SGreg Roach        FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
479f667ff2SGreg Roach
48*914ea12fSGreg Roach        return redirect(route(ModulesListsPage::class));
499f667ff2SGreg Roach    }
509f667ff2SGreg Roach}
51