1<?php 2namespace Fisharebest\Webtrees\Module; 3 4/** 5 * webtrees: online genealogy 6 * Copyright (C) 2015 webtrees development team 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18use Fisharebest\Webtrees\I18N; 19use Fisharebest\Webtrees\Theme; 20use Fisharebest\Webtrees\Theme\AbstractTheme; 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 /** {@inheritdoc} */ 37 public function getBlock($block_id, $template = true, $cfg = null) { 38 $id = $this->getName() . $block_id; 39 $class = $this->getName() . '_block'; 40 $title = $this->getTitle(); 41 $menu = Theme::theme()->menuThemes(); 42 43 if ($menu) { 44 $content = '<div class="center theme_form">' . $menu . '</div><br>'; 45 46 if ($template) { 47 return Theme::theme()->formatBlock($id, $title, $class, $content); 48 } else { 49 return $content; 50 } 51 } else { 52 return ''; 53 } 54 } 55 56 /** {@inheritdoc} */ 57 public function loadAjax() { 58 return false; 59 } 60 61 /** {@inheritdoc} */ 62 public function isUserBlock() { 63 return true; 64 } 65 66 /** {@inheritdoc} */ 67 public function isGedcomBlock() { 68 return true; 69 } 70 71 /** {@inheritdoc} */ 72 public function configureBlock($block_id) { 73 } 74} 75