xref: /webtrees/app/Module/CloudsTheme.php (revision f759a528334c4601116e145c062dda5698fe95d0)
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     * How should this module be labelled on tabs, menus, etc.?
34     *
35     * @return string
36     */
37    public function title(): string
38    {
39        /* I18N: Name of a theme. */
40        return I18N::translate('clouds');
41    }
42
43    /**
44     * Misecellaneous dimensions, fonts, styles, etc.
45     *
46     * @param string $parameter_name
47     *
48     * @return string|int|float
49     */
50    public function parameter($parameter_name)
51    {
52        $parameters = [
53            'chart-background-f'             => 'e9daf1',
54            'chart-background-m'             => 'b1cff0',
55            'chart-background-u'             => 'eeeeee',
56            'chart-box-x'                    => 260,
57            'chart-box-y'                    => 85,
58            'chart-font-color'               => '000000',
59            'chart-spacing-x'                => 4,
60            'chart-spacing-y'                => 10,
61            'compact-chart-box-x'            => 240,
62            'compact-chart-box-y'            => 50,
63            'distribution-chart-high-values' => '95b8e0',
64            'distribution-chart-low-values'  => 'c8e7ff',
65            'distribution-chart-no-values'   => 'ffffff',
66        ];
67
68        return $parameters[$parameter_name];
69    }
70
71    /**
72     * Generate a list of items for the main menu.
73     *
74     * @return Menu[]
75     */
76    public function primaryMenu(): array
77    {
78        $primary_menu = $this->basePrimaryMenu();
79
80        foreach ($primary_menu as $menu) {
81            $submenus = $menu->getSubmenus();
82
83            if (!empty($submenus)) {
84                // Insert a dummy menu / label into the submenu
85                array_unshift($submenus, new Menu($menu->getLabel(), '#', '', ['onclick' => 'return false;']));
86                $menu->setSubmenus($submenus);
87            }
88        }
89
90        return $primary_menu;
91    }
92
93    /**
94     * A list of CSS files to include for this page.
95     *
96     * @return string[]
97     */
98    public function stylesheets(): array
99    {
100        return [
101            asset('css/clouds.min.css'),
102        ];
103    }
104}
105