18c2e8227SGreg Roach<?php 28c2e8227SGreg Roach/** 38c2e8227SGreg Roach * webtrees: online genealogy 41062a142SGreg Roach * Copyright (C) 2018 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 */ 1676692c8bSGreg Roachnamespace Fisharebest\Webtrees\Module; 1776692c8bSGreg Roach 180e62c4b8SGreg Roachuse Fisharebest\Webtrees\I18N; 190e62c4b8SGreg Roachuse Fisharebest\Webtrees\Theme; 20e490cd80SGreg Roachuse Fisharebest\Webtrees\Tree; 21a45f9889SGreg Roachuse Symfony\Component\HttpFoundation\Request; 228c2e8227SGreg Roach 238c2e8227SGreg Roach/** 248c2e8227SGreg Roach * Class ThemeSelectModule 258c2e8227SGreg Roach */ 26c1010edaSGreg Roachclass ThemeSelectModule extends AbstractModule implements ModuleBlockInterface 27c1010edaSGreg Roach{ 288c2e8227SGreg Roach /** {@inheritdoc} */ 29*8f53f488SRico Sonntag public function getTitle(): string 30c1010edaSGreg Roach { 31bbb76c12SGreg Roach /* I18N: Name of a module */ 32bbb76c12SGreg Roach return I18N::translate('Theme change'); 338c2e8227SGreg Roach } 348c2e8227SGreg Roach 358c2e8227SGreg Roach /** {@inheritdoc} */ 36*8f53f488SRico Sonntag public function getDescription(): string 37c1010edaSGreg Roach { 38bbb76c12SGreg Roach /* I18N: Description of the “Theme change” module */ 39bbb76c12SGreg Roach return I18N::translate('An alternative way to select a new theme.'); 408c2e8227SGreg Roach } 418c2e8227SGreg Roach 4276692c8bSGreg Roach /** 4376692c8bSGreg Roach * Generate the HTML content of this block. 4476692c8bSGreg Roach * 45e490cd80SGreg Roach * @param Tree $tree 4676692c8bSGreg Roach * @param int $block_id 4776692c8bSGreg Roach * @param bool $template 48727f238cSGreg Roach * @param string[] $cfg 4976692c8bSGreg Roach * 5076692c8bSGreg Roach * @return string 5176692c8bSGreg Roach */ 52c1010edaSGreg Roach public function getBlock(Tree $tree, int $block_id, bool $template = true, array $cfg = []): string 53c1010edaSGreg Roach { 548c2e8227SGreg Roach $menu = Theme::theme()->menuThemes(); 558c2e8227SGreg Roach 568c2e8227SGreg Roach if ($menu) { 5715d603e7SGreg Roach $content = '<ul class="nav text-justify">' . $menu->bootstrap4() . '</ul>'; 588c2e8227SGreg Roach 598c2e8227SGreg Roach if ($template) { 60147e99aaSGreg Roach return view('modules/block-template', [ 619c6524dcSGreg Roach 'block' => str_replace('_', '-', $this->getName()), 629c6524dcSGreg Roach 'id' => $block_id, 639c6524dcSGreg Roach 'config_url' => '', 649c6524dcSGreg Roach 'title' => $this->getTitle(), 659c6524dcSGreg Roach 'content' => $content, 669c6524dcSGreg Roach ]); 678c2e8227SGreg Roach } else { 688c2e8227SGreg Roach return $content; 698c2e8227SGreg Roach } 708c2e8227SGreg Roach } else { 718c2e8227SGreg Roach return ''; 728c2e8227SGreg Roach } 738c2e8227SGreg Roach } 748c2e8227SGreg Roach 758c2e8227SGreg Roach /** {@inheritdoc} */ 76c1010edaSGreg Roach public function loadAjax(): bool 77c1010edaSGreg Roach { 788c2e8227SGreg Roach return false; 798c2e8227SGreg Roach } 808c2e8227SGreg Roach 818c2e8227SGreg Roach /** {@inheritdoc} */ 82c1010edaSGreg Roach public function isUserBlock(): bool 83c1010edaSGreg Roach { 848c2e8227SGreg Roach return true; 858c2e8227SGreg Roach } 868c2e8227SGreg Roach 878c2e8227SGreg Roach /** {@inheritdoc} */ 88c1010edaSGreg Roach public function isGedcomBlock(): bool 89c1010edaSGreg Roach { 908c2e8227SGreg Roach return true; 918c2e8227SGreg Roach } 928c2e8227SGreg Roach 9376692c8bSGreg Roach /** 94a45f9889SGreg Roach * Update the configuration for a block. 95a45f9889SGreg Roach * 96a45f9889SGreg Roach * @param Request $request 97a45f9889SGreg Roach * @param int $block_id 98a45f9889SGreg Roach * 99a45f9889SGreg Roach * @return void 100a45f9889SGreg Roach */ 101a45f9889SGreg Roach public function saveBlockConfiguration(Request $request, int $block_id) 102a45f9889SGreg Roach { 103a45f9889SGreg Roach } 104a45f9889SGreg Roach 105a45f9889SGreg Roach /** 10676692c8bSGreg Roach * An HTML form to edit block settings 10776692c8bSGreg Roach * 108e490cd80SGreg Roach * @param Tree $tree 10976692c8bSGreg Roach * @param int $block_id 110a9430be8SGreg Roach * 111a9430be8SGreg Roach * @return void 11276692c8bSGreg Roach */ 113a45f9889SGreg Roach public function editBlockConfiguration(Tree $tree, int $block_id) 114c1010edaSGreg Roach { 1158c2e8227SGreg Roach } 1168c2e8227SGreg Roach} 117