openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 22be121ebcdcb464374aa8c616fd2f3ee30ffcc6
parent 1a8bd365aa28b39fdd13659527544d3b0ef19897
Author: Jan Dankert <devnull@localhost>
Date:   Wed,  5 Dec 2018 01:52:18 +0100

Fix: Theme-Color richtig berechnen. Das Addieren von Arrays ist nicht immer so eine gute Idee.

Diffstat:
modules/cms-ui/action/IndexAction.class.php | 28++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/modules/cms-ui/action/IndexAction.class.php b/modules/cms-ui/action/IndexAction.class.php @@ -41,6 +41,28 @@ class IndexAction extends Action public function manifestView() { + $user = Session::getUser(); + + // Theme für den angemeldeten Benuter ermitteln + if ( is_object($user) && isset(config('style')[$user->style]) ) + $style = $user->style; + else + $style = config('interface','style','default'); + + $styleConfig = config('style-default'); // default style config + $userStyleConfig = config('style', $style); // user style config + + if (is_array($userStyleConfig)) + $styleConfig = array_merge($styleConfig, $userStyleConfig ); // Merging user style into default style + else + ; // Unknown style name, we are ignoring this. + + // Theme base color for smartphones colorizing their status bar. + $themeColor = $this->getColorHexCode($styleConfig['title_background_color']); + + + + $json = new JSON(); $appName = config('application','name'); @@ -51,9 +73,7 @@ class IndexAction extends Action 'short_name' => 'CMS', 'display' => 'standalone', 'orientation' => 'landscape', - "background_color" => "#EEEEEE", - - + "background_color" => $themeColor, ); header("Content-Type: application/manifest+json"); @@ -148,7 +168,7 @@ class IndexAction extends Action $userStyleConfig = config('style', $style); // user style config if (is_array($userStyleConfig)) - $styleConfig += $userStyleConfig; // Merging user style into default style + $styleConfig = array_merge($styleConfig,$userStyleConfig); // Merging user style into default style else ; // Unknown style name, we are ignoring this.