1<?php 2/** 3 * webtrees: online genealogy 4 * Copyright (C) 2019 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 */ 16declare(strict_types=1); 17 18namespace Fisharebest\Webtrees\Module; 19 20use Fisharebest\Webtrees\I18N; 21use Fisharebest\Webtrees\Menu; 22 23/** 24 * The clouds theme. 25 */ 26class CloudsTheme extends AbstractModule implements ModuleThemeInterface 27{ 28 use ModuleThemeTrait { 29 primaryMenu as basePrimaryMenu; 30 } 31 32 protected const PERSON_BOX_CLASSES = [ 33 'M' => 'person_box', 34 'F' => 'person_boxF', 35 'U' => 'person_boxNN', 36 ]; 37 38 39 /** 40 * How should this module be labelled on tabs, menus, etc.? 41 * 42 * @return string 43 */ 44 public function title(): string 45 { 46 /* I18N: Name of a theme. */ 47 return I18N::translate('clouds'); 48 } 49 50 /** 51 * Misecellaneous dimensions, fonts, styles, etc. 52 * 53 * @param string $parameter_name 54 * 55 * @return string|int|float 56 */ 57 public function parameter($parameter_name) 58 { 59 $parameters = [ 60 'chart-background-f' => 'e9daf1', 61 'chart-background-m' => 'b1cff0', 62 'chart-background-u' => 'eeeeee', 63 'chart-box-x' => 260, 64 'chart-box-y' => 85, 65 'chart-font-color' => '000000', 66 'chart-spacing-x' => 4, 67 'chart-spacing-y' => 10, 68 'compact-chart-box-x' => 240, 69 'compact-chart-box-y' => 50, 70 'distribution-chart-high-values' => '95b8e0', 71 'distribution-chart-low-values' => 'c8e7ff', 72 'distribution-chart-no-values' => 'ffffff', 73 'distribution-chart-x' => 440, 74 'distribution-chart-y' => 220, 75 'line-width' => 1.5, 76 'shadow-blur' => 0, 77 'shadow-color' => '', 78 'shadow-offset-x' => 0, 79 'shadow-offset-y' => 0, 80 'stats-small-chart-x' => 440, 81 'stats-small-chart-y' => 125, 82 'stats-large-chart-x' => 900, 83 ]; 84 85 return $parameters[$parameter_name]; 86 } 87 88 /** 89 * Generate a list of items for the main menu. 90 * 91 * @return Menu[] 92 */ 93 public function primaryMenu(): array 94 { 95 $primary_menu = $this->basePrimaryMenu(); 96 97 foreach ($primary_menu as $menu) { 98 $submenus = $menu->getSubmenus(); 99 100 if (!empty($submenus)) { 101 // Insert a dummy menu / label into the submenu 102 array_unshift($submenus, new Menu($menu->getLabel(), '#', '', ['onclick' => 'return false;'])); 103 $menu->setSubmenus($submenus); 104 } 105 } 106 107 return $primary_menu; 108 } 109 110 /** 111 * A list of CSS files to include for this page. 112 * 113 * @return string[] 114 */ 115 public function stylesheets(): array 116 { 117 return [ 118 asset('css/clouds.min.css'), 119 ]; 120 } 121} 122