1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2017 webtrees development team 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 */ 16namespace Fisharebest\Webtrees\Module; 17 18use Fisharebest\Webtrees\I18N; 19use Fisharebest\Webtrees\Theme; 20use Fisharebest\Webtrees\View; 21 22/** 23 * Class ThemeSelectModule 24 */ 25class ThemeSelectModule extends AbstractModule implements ModuleBlockInterface { 26 /** {@inheritdoc} */ 27 public function getTitle() { 28 return /* I18N: Name of a module */ I18N::translate('Theme change'); 29 } 30 31 /** {@inheritdoc} */ 32 public function getDescription() { 33 return /* I18N: Description of the “Theme change” module */ I18N::translate('An alternative way to select a new theme.'); 34 } 35 36 /** 37 * Generate the HTML content of this block. 38 * 39 * @param int $block_id 40 * @param bool $template 41 * @param string[] $cfg 42 * 43 * @return string 44 */ 45 public function getBlock($block_id, $template = true, $cfg = []) { 46 $id = $this->getName() . $block_id; 47 $class = $this->getName() . '_block'; 48 $title = $this->getTitle(); 49 $menu = Theme::theme()->menuThemes(); 50 51 if ($menu) { 52 $content = '<ul class="nav text-justify">' . $menu->bootstrap4() . '</ul>'; 53 54 if ($template) { 55 return View::make('blocks/template', [ 56 'block' => str_replace('_', '-', $this->getName()), 57 'id' => $block_id, 58 'config_url' => '', 59 'title' => $this->getTitle(), 60 'content' => $content, 61 ]); 62 } else { 63 return $content; 64 } 65 } else { 66 return ''; 67 } 68 } 69 70 /** {@inheritdoc} */ 71 public function loadAjax() { 72 return false; 73 } 74 75 /** {@inheritdoc} */ 76 public function isUserBlock() { 77 return true; 78 } 79 80 /** {@inheritdoc} */ 81 public function isGedcomBlock() { 82 return true; 83 } 84 85 /** 86 * An HTML form to edit block settings 87 * 88 * @param int $block_id 89 */ 90 public function configureBlock($block_id) { 91 } 92} 93