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; 20*e490cd80SGreg Roachuse Fisharebest\Webtrees\Tree; 218c2e8227SGreg Roach 228c2e8227SGreg Roach/** 238c2e8227SGreg Roach * Class ThemeSelectModule 248c2e8227SGreg Roach */ 25e2a378d3SGreg Roachclass ThemeSelectModule extends AbstractModule implements ModuleBlockInterface { 268c2e8227SGreg Roach /** {@inheritdoc} */ 278c2e8227SGreg Roach public function getTitle() { 288c2e8227SGreg Roach return /* I18N: Name of a module */ I18N::translate('Theme change'); 298c2e8227SGreg Roach } 308c2e8227SGreg Roach 318c2e8227SGreg Roach /** {@inheritdoc} */ 328c2e8227SGreg Roach public function getDescription() { 338c2e8227SGreg Roach return /* I18N: Description of the “Theme change” module */ I18N::translate('An alternative way to select a new theme.'); 348c2e8227SGreg Roach } 358c2e8227SGreg Roach 3676692c8bSGreg Roach /** 3776692c8bSGreg Roach * Generate the HTML content of this block. 3876692c8bSGreg Roach * 39*e490cd80SGreg Roach * @param Tree $tree 4076692c8bSGreg Roach * @param int $block_id 4176692c8bSGreg Roach * @param bool $template 42727f238cSGreg Roach * @param string[] $cfg 4376692c8bSGreg Roach * 4476692c8bSGreg Roach * @return string 4576692c8bSGreg Roach */ 46*e490cd80SGreg Roach public function getBlock(Tree $tree, int $block_id, bool $template = true, array $cfg = []): string { 478c2e8227SGreg Roach $menu = Theme::theme()->menuThemes(); 488c2e8227SGreg Roach 498c2e8227SGreg Roach if ($menu) { 5015d603e7SGreg Roach $content = '<ul class="nav text-justify">' . $menu->bootstrap4() . '</ul>'; 518c2e8227SGreg Roach 528c2e8227SGreg Roach if ($template) { 53225e381fSGreg Roach return view('blocks/template', [ 549c6524dcSGreg Roach 'block' => str_replace('_', '-', $this->getName()), 559c6524dcSGreg Roach 'id' => $block_id, 569c6524dcSGreg Roach 'config_url' => '', 579c6524dcSGreg Roach 'title' => $this->getTitle(), 589c6524dcSGreg Roach 'content' => $content, 599c6524dcSGreg Roach ]); 608c2e8227SGreg Roach } else { 618c2e8227SGreg Roach return $content; 628c2e8227SGreg Roach } 638c2e8227SGreg Roach } else { 648c2e8227SGreg Roach return ''; 658c2e8227SGreg Roach } 668c2e8227SGreg Roach } 678c2e8227SGreg Roach 688c2e8227SGreg Roach /** {@inheritdoc} */ 69a9430be8SGreg Roach public function loadAjax(): bool { 708c2e8227SGreg Roach return false; 718c2e8227SGreg Roach } 728c2e8227SGreg Roach 738c2e8227SGreg Roach /** {@inheritdoc} */ 74a9430be8SGreg Roach public function isUserBlock(): bool { 758c2e8227SGreg Roach return true; 768c2e8227SGreg Roach } 778c2e8227SGreg Roach 788c2e8227SGreg Roach /** {@inheritdoc} */ 79a9430be8SGreg Roach public function isGedcomBlock(): bool { 808c2e8227SGreg Roach return true; 818c2e8227SGreg Roach } 828c2e8227SGreg Roach 8376692c8bSGreg Roach /** 8476692c8bSGreg Roach * An HTML form to edit block settings 8576692c8bSGreg Roach * 86*e490cd80SGreg Roach * @param Tree $tree 8776692c8bSGreg Roach * @param int $block_id 88a9430be8SGreg Roach * 89a9430be8SGreg Roach * @return void 9076692c8bSGreg Roach */ 91*e490cd80SGreg Roach public function configureBlock(Tree $tree, int $block_id) { 928c2e8227SGreg Roach } 938c2e8227SGreg Roach} 94