xref: /webtrees/app/Module/CloudsTheme.php (revision 3976b4703df669696105ed6b024b96d433c8fbdb)
1ade503dfSGreg Roach<?php
2*3976b470SGreg Roach
3ade503dfSGreg Roach/**
4ade503dfSGreg Roach * webtrees: online genealogy
5ade503dfSGreg Roach * Copyright (C) 2019 webtrees development team
6ade503dfSGreg Roach * This program is free software: you can redistribute it and/or modify
7ade503dfSGreg Roach * it under the terms of the GNU General Public License as published by
8ade503dfSGreg Roach * the Free Software Foundation, either version 3 of the License, or
9ade503dfSGreg Roach * (at your option) any later version.
10ade503dfSGreg Roach * This program is distributed in the hope that it will be useful,
11ade503dfSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12ade503dfSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13ade503dfSGreg Roach * GNU General Public License for more details.
14ade503dfSGreg Roach * You should have received a copy of the GNU General Public License
15ade503dfSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
16ade503dfSGreg Roach */
17ade503dfSGreg Roachdeclare(strict_types=1);
18ade503dfSGreg Roach
19ade503dfSGreg Roachnamespace Fisharebest\Webtrees\Module;
20ade503dfSGreg Roach
21ade503dfSGreg Roachuse Fisharebest\Webtrees\I18N;
22ade503dfSGreg Roachuse Fisharebest\Webtrees\Menu;
230c8c69d4SGreg Roachuse Fisharebest\Webtrees\Tree;
24ade503dfSGreg Roach
25ade503dfSGreg Roach/**
26ade503dfSGreg Roach * The clouds theme.
27ade503dfSGreg Roach */
28ade503dfSGreg Roachclass CloudsTheme extends AbstractModule implements ModuleThemeInterface
29ade503dfSGreg Roach{
30ade503dfSGreg Roach    use ModuleThemeTrait {
310c8c69d4SGreg Roach        genealogyMenu as baseGenealogyMenu;
32ade503dfSGreg Roach    }
33ade503dfSGreg Roach
34ade503dfSGreg Roach    /**
350cfd6963SGreg Roach     * How should this module be identified in the control panel, etc.?
36ade503dfSGreg Roach     *
37ade503dfSGreg Roach     * @return string
38ade503dfSGreg Roach     */
39ade503dfSGreg Roach    public function title(): string
40ade503dfSGreg Roach    {
41ade503dfSGreg Roach        /* I18N: Name of a theme. */
42ade503dfSGreg Roach        return I18N::translate('clouds');
43ade503dfSGreg Roach    }
44ade503dfSGreg Roach
45ade503dfSGreg Roach    /**
46ade503dfSGreg Roach     * Misecellaneous dimensions, fonts, styles, etc.
47ade503dfSGreg Roach     *
48ade503dfSGreg Roach     * @param string $parameter_name
49ade503dfSGreg Roach     *
50ade503dfSGreg Roach     * @return string|int|float
51ade503dfSGreg Roach     */
52ade503dfSGreg Roach    public function parameter($parameter_name)
53ade503dfSGreg Roach    {
54ade503dfSGreg Roach        $parameters = [
55ade503dfSGreg Roach            'chart-background-f'             => 'e9daf1',
56ade503dfSGreg Roach            'chart-background-m'             => 'b1cff0',
57ade503dfSGreg Roach            'chart-background-u'             => 'eeeeee',
58ade503dfSGreg Roach            'chart-box-x'                    => 260,
59ade503dfSGreg Roach            'chart-box-y'                    => 85,
60ade503dfSGreg Roach            'chart-font-color'               => '000000',
61ade503dfSGreg Roach            'chart-spacing-x'                => 4,
62ade503dfSGreg Roach            'chart-spacing-y'                => 10,
63ade503dfSGreg Roach            'compact-chart-box-x'            => 240,
64ade503dfSGreg Roach            'compact-chart-box-y'            => 50,
65ade503dfSGreg Roach            'distribution-chart-high-values' => '95b8e0',
66ade503dfSGreg Roach            'distribution-chart-low-values'  => 'c8e7ff',
67ade503dfSGreg Roach            'distribution-chart-no-values'   => 'ffffff',
68ade503dfSGreg Roach        ];
69ade503dfSGreg Roach
70ade503dfSGreg Roach        return $parameters[$parameter_name];
71ade503dfSGreg Roach    }
72ade503dfSGreg Roach
73ade503dfSGreg Roach    /**
74ade503dfSGreg Roach     * Generate a list of items for the main menu.
75ade503dfSGreg Roach     *
760c8c69d4SGreg Roach     * @param Tree|null $tree
770c8c69d4SGreg Roach     *
78ade503dfSGreg Roach     * @return Menu[]
79ade503dfSGreg Roach     */
800c8c69d4SGreg Roach    public function genealogyMenu(?Tree $tree): array
81ade503dfSGreg Roach    {
820c8c69d4SGreg Roach        $primary_menu = $this->baseGenealogyMenu($tree);
83ade503dfSGreg Roach
84ade503dfSGreg Roach        foreach ($primary_menu as $menu) {
85ade503dfSGreg Roach            $submenus = $menu->getSubmenus();
86ade503dfSGreg Roach
87ade503dfSGreg Roach            if (!empty($submenus)) {
88ade503dfSGreg Roach                // Insert a dummy menu / label into the submenu
89ade503dfSGreg Roach                array_unshift($submenus, new Menu($menu->getLabel(), '#', '', ['onclick' => 'return false;']));
90ade503dfSGreg Roach                $menu->setSubmenus($submenus);
91ade503dfSGreg Roach            }
92ade503dfSGreg Roach        }
93ade503dfSGreg Roach
94ade503dfSGreg Roach        return $primary_menu;
95ade503dfSGreg Roach    }
96ade503dfSGreg Roach
97ade503dfSGreg Roach    /**
98ade503dfSGreg Roach     * A list of CSS files to include for this page.
99ade503dfSGreg Roach     *
100ade503dfSGreg Roach     * @return string[]
101ade503dfSGreg Roach     */
102ade503dfSGreg Roach    public function stylesheets(): array
103ade503dfSGreg Roach    {
104ade503dfSGreg Roach        return [
105e837ff07SGreg Roach            asset('css/clouds.min.css'),
106ade503dfSGreg Roach        ];
107ade503dfSGreg Roach    }
108ade503dfSGreg Roach}
109