19f667ff2SGreg Roach<?php 29f667ff2SGreg Roach 39f667ff2SGreg Roach/** 49f667ff2SGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 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\Http\ViewResponseTrait; 239f667ff2SGreg Roachuse Fisharebest\Webtrees\I18N; 249f667ff2SGreg Roachuse Fisharebest\Webtrees\Services\ModuleService; 259f667ff2SGreg Roachuse Psr\Http\Message\ResponseInterface; 269f667ff2SGreg Roachuse Psr\Http\Message\ServerRequestInterface; 279f667ff2SGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 289f667ff2SGreg Roach 299f667ff2SGreg Roach/** 309f667ff2SGreg Roach * Show a list of modules. 319f667ff2SGreg Roach */ 329f667ff2SGreg Roachclass ModulesAllPage implements RequestHandlerInterface 339f667ff2SGreg Roach{ 349f667ff2SGreg Roach use ViewResponseTrait; 359f667ff2SGreg Roach 36c4943cffSGreg Roach private ModuleService $module_service; 379f667ff2SGreg Roach 389f667ff2SGreg Roach /** 399f667ff2SGreg Roach * @param ModuleService $module_service 409f667ff2SGreg Roach */ 419f667ff2SGreg Roach public function __construct(ModuleService $module_service) 429f667ff2SGreg Roach { 439f667ff2SGreg Roach $this->module_service = $module_service; 449f667ff2SGreg Roach } 459f667ff2SGreg Roach 469f667ff2SGreg Roach /** 479f667ff2SGreg Roach * Delete the database settings for a deleted module. 489f667ff2SGreg Roach * 499f667ff2SGreg Roach * @param ServerRequestInterface $request 509f667ff2SGreg Roach * 519f667ff2SGreg Roach * @return ResponseInterface 529f667ff2SGreg Roach */ 539f667ff2SGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 549f667ff2SGreg Roach { 559f667ff2SGreg Roach $this->layout = 'layouts/administration'; 569f667ff2SGreg Roach 579f667ff2SGreg Roach return $this->viewResponse('admin/modules', [ 589f667ff2SGreg Roach 'title' => I18N::translate('All modules'), 599f667ff2SGreg Roach 'modules' => $this->module_service->all(true), 609f667ff2SGreg Roach 'deleted_modules' => $this->module_service->deletedModules(), 619f667ff2SGreg Roach ]); 629f667ff2SGreg Roach } 639f667ff2SGreg Roach} 64