18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 4*8fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team 58c2e8227SGreg Roach * This program is free software: you can redistribute it and/or modify 68c2e8227SGreg Roach * it under the terms of the GNU General Public License as published by 78c2e8227SGreg Roach * the Free Software Foundation, either version 3 of the License, or 88c2e8227SGreg Roach * (at your option) any later version. 98c2e8227SGreg Roach * This program is distributed in the hope that it will be useful, 108c2e8227SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 118c2e8227SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 128c2e8227SGreg Roach * GNU General Public License for more details. 138c2e8227SGreg Roach * You should have received a copy of the GNU General Public License 148c2e8227SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>. 158c2e8227SGreg Roach */ 16e7f56f2aSGreg Roachdeclare(strict_types=1); 17e7f56f2aSGreg Roach 1876692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 1976692c8bSGreg Roach 200e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 210e62c4b8SGreg Roachuse Fisharebest\Webtrees\Theme; 22e490cd80SGreg Roachuse Fisharebest\Webtrees\Tree; 23a45f9889SGreg Roachuse Symfony\Component\HttpFoundation\Request; 248c2e8227SGreg Roach 258c2e8227SGreg Roach/** 268c2e8227SGreg Roach * Class ThemeSelectModule 278c2e8227SGreg Roach */ 28c1010edaSGreg Roachclass ThemeSelectModule extends AbstractModule implements ModuleBlockInterface 29c1010edaSGreg Roach{ 308c2e8227SGreg Roach /** {@inheritdoc} */ 318f53f488SRico Sonntag public function getTitle(): string 32c1010edaSGreg Roach { 33bbb76c12SGreg Roach /* I18N: Name of a module */ 34bbb76c12SGreg Roach return I18N::translate('Theme change'); 358c2e8227SGreg Roach } 368c2e8227SGreg Roach 378c2e8227SGreg Roach /** {@inheritdoc} */ 388f53f488SRico Sonntag public function getDescription(): string 39c1010edaSGreg Roach { 40bbb76c12SGreg Roach /* I18N: Description of the “Theme change” module */ 41bbb76c12SGreg Roach return I18N::translate('An alternative way to select a new theme.'); 428c2e8227SGreg Roach } 438c2e8227SGreg Roach 4476692c8bSGreg Roach /** 4576692c8bSGreg Roach * Generate the HTML content of this block. 4676692c8bSGreg Roach * 47e490cd80SGreg Roach * @param Tree $tree 4876692c8bSGreg Roach * @param int $block_id 495f2ae573SGreg Roach * @param string $ctype 50727f238cSGreg Roach * @param string[] $cfg 5176692c8bSGreg Roach * 5276692c8bSGreg Roach * @return string 5376692c8bSGreg Roach */ 545f2ae573SGreg Roach public function getBlock(Tree $tree, int $block_id, string $ctype = '', array $cfg = []): string 55c1010edaSGreg Roach { 568c2e8227SGreg Roach $menu = Theme::theme()->menuThemes(); 578c2e8227SGreg Roach 588c2e8227SGreg Roach if ($menu) { 5915d603e7SGreg Roach $content = '<ul class="nav text-justify">' . $menu->bootstrap4() . '</ul>'; 608c2e8227SGreg Roach 616a8879feSGreg Roach if ($ctype !== '') { 62147e99aaSGreg Roach return view('modules/block-template', [ 639c6524dcSGreg Roach 'block' => str_replace('_', '-', $this->getName()), 649c6524dcSGreg Roach 'id' => $block_id, 659c6524dcSGreg Roach 'config_url' => '', 669c6524dcSGreg Roach 'title' => $this->getTitle(), 679c6524dcSGreg Roach 'content' => $content, 689c6524dcSGreg Roach ]); 69b2ce94c6SRico Sonntag } 70b2ce94c6SRico Sonntag 718c2e8227SGreg Roach return $content; 728c2e8227SGreg Roach } 73b2ce94c6SRico Sonntag 748c2e8227SGreg Roach return ''; 758c2e8227SGreg Roach } 768c2e8227SGreg Roach 778c2e8227SGreg Roach /** {@inheritdoc} */ 78c1010edaSGreg Roach public function loadAjax(): bool 79c1010edaSGreg Roach { 808c2e8227SGreg Roach return false; 818c2e8227SGreg Roach } 828c2e8227SGreg Roach 838c2e8227SGreg Roach /** {@inheritdoc} */ 84c1010edaSGreg Roach public function isUserBlock(): bool 85c1010edaSGreg Roach { 868c2e8227SGreg Roach return true; 878c2e8227SGreg Roach } 888c2e8227SGreg Roach 898c2e8227SGreg Roach /** {@inheritdoc} */ 90c1010edaSGreg Roach public function isGedcomBlock(): bool 91c1010edaSGreg Roach { 928c2e8227SGreg Roach return true; 938c2e8227SGreg Roach } 948c2e8227SGreg Roach 9576692c8bSGreg Roach /** 96a45f9889SGreg Roach * Update the configuration for a block. 97a45f9889SGreg Roach * 98a45f9889SGreg Roach * @param Request $request 99a45f9889SGreg Roach * @param int $block_id 100a45f9889SGreg Roach * 101a45f9889SGreg Roach * @return void 102a45f9889SGreg Roach */ 103a45f9889SGreg Roach public function saveBlockConfiguration(Request $request, int $block_id) 104a45f9889SGreg Roach { 105a45f9889SGreg Roach } 106a45f9889SGreg Roach 107a45f9889SGreg Roach /** 10876692c8bSGreg Roach * An HTML form to edit block settings 10976692c8bSGreg Roach * 110e490cd80SGreg Roach * @param Tree $tree 11176692c8bSGreg Roach * @param int $block_id 112a9430be8SGreg Roach * 113a9430be8SGreg Roach * @return void 11476692c8bSGreg Roach */ 115a45f9889SGreg Roach public function editBlockConfiguration(Tree $tree, int $block_id) 116c1010edaSGreg Roach { 1178c2e8227SGreg Roach } 1188c2e8227SGreg Roach} 119