xref: /webtrees/app/Module/CloudsTheme.php (revision ade503dfba8365d48c21ef618291c1a94004c6e1)
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    /**
33     * Where are our CSS, JS and other assets?
34     */
35    protected const THEME_DIR  = 'clouds';
36    public const    ASSET_DIR  = 'themes/clouds/css-2.0.0/';
37    protected const STYLESHEET = 'themes/clouds/css-2.0.0/style.css';
38
39    protected const PERSON_BOX_CLASSES = [
40        'M' => 'person_box',
41        'F' => 'person_boxF',
42        'U' => 'person_boxNN',
43    ];
44
45
46    /**
47     * How should this module be labelled on tabs, menus, etc.?
48     *
49     * @return string
50     */
51    public function title(): string
52    {
53        /* I18N: Name of a theme. */
54        return I18N::translate('clouds');
55    }
56
57    /**
58     * Misecellaneous dimensions, fonts, styles, etc.
59     *
60     * @param string $parameter_name
61     *
62     * @return string|int|float
63     */
64    public function parameter($parameter_name)
65    {
66        $parameters = [
67            'chart-background-f'             => 'e9daf1',
68            'chart-background-m'             => 'b1cff0',
69            'chart-background-u'             => 'eeeeee',
70            'chart-box-x'                    => 260,
71            'chart-box-y'                    => 85,
72            'chart-font-color'               => '000000',
73            'chart-spacing-x'                => 4,
74            'chart-spacing-y'                => 10,
75            'compact-chart-box-x'            => 240,
76            'compact-chart-box-y'            => 50,
77            'distribution-chart-high-values' => '95b8e0',
78            'distribution-chart-low-values'  => 'c8e7ff',
79            'distribution-chart-no-values'   => 'ffffff',
80            'distribution-chart-x'           => 440,
81            'distribution-chart-y'           => 220,
82            'line-width'                     => 1.5,
83            'shadow-blur'                    => 0,
84            'shadow-color'                   => '',
85            'shadow-offset-x'                => 0,
86            'shadow-offset-y'                => 0,
87            'stats-small-chart-x'            => 440,
88            'stats-small-chart-y'            => 125,
89            'stats-large-chart-x'            => 900,
90            'image-dline'                    => static::ASSET_DIR . 'images/dline.png',
91            'image-dline2'                   => static::ASSET_DIR . 'images/dline2.png',
92            'image-hline'                    => static::ASSET_DIR . 'images/hline.png',
93            'image-spacer'                   => static::ASSET_DIR . 'images/spacer.png',
94            'image-vline'                    => static::ASSET_DIR . 'images/vline.png',
95            'image-minus'                    => static::ASSET_DIR . 'images/minus.png',
96            'image-plus'                     => static::ASSET_DIR . 'images/plus.png',
97        ];
98
99        return $parameters[$parameter_name];
100    }
101
102    /**
103     * Generate a list of items for the main menu.
104     *
105     * @return Menu[]
106     */
107    public function primaryMenu(): array
108    {
109        $primary_menu = $this->basePrimaryMenu();
110
111        foreach ($primary_menu as $menu) {
112            $submenus = $menu->getSubmenus();
113
114            if (!empty($submenus)) {
115                // Insert a dummy menu / label into the submenu
116                array_unshift($submenus, new Menu($menu->getLabel(), '#', '', ['onclick' => 'return false;']));
117                $menu->setSubmenus($submenus);
118            }
119        }
120
121        return $primary_menu;
122    }
123
124    /**
125     * A list of CSS files to include for this page.
126     *
127     * @return string[]
128     */
129    public function stylesheets(): array
130    {
131        return [
132            'themes/_common/css-2.0.0/style.css',
133            'themes/clouds/css-2.0.0/style.css',
134        ];
135    }
136}
137