From: Vincent Vanwaelscappel Date: Wed, 27 Sep 2023 16:14:01 +0000 (+0200) Subject: wip #6300 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7914a77c946017abf338df144184f2b7a6ffbd34;p=fluidbook-toolbox.git wip #6300 @0.5 --- diff --git a/app/Elearning/QuizCompiler.php b/app/Elearning/QuizCompiler.php index afa4f758b..8348f27ca 100644 --- a/app/Elearning/QuizCompiler.php +++ b/app/Elearning/QuizCompiler.php @@ -19,10 +19,7 @@ use Cubist\Util\Files\Files; use Cubist\Util\Files\VirtualDirectory; use Cubist\Util\Graphics\Color; use Cubist\Util\Text; -use Illuminate\Translation\Translator; -use Psy\Output\Theme; use RyanChandler\Blade\Blade; -use function PHPUnit\Framework\matches; class QuizCompiler extends Base { @@ -147,6 +144,13 @@ class QuizCompiler extends Base // Fonts size:Line Height $this->sassVariables['fonts-size'] = "(14: 20px, 16: 22px, 20: 28px, 24: 35px)"; + // fill areas + $this->sassVariables['intro-fill-area'] = $this->theme->introColor ?: 'transparent'; + $this->sassVariables['outro-fill-area'] = $this->theme->outroColor ?: 'transparent'; + $this->sassVariables['standard-fill-area'] = $this->theme->standardColor ?: 'transparent'; + $this->sassVariables['drangandrop-area1-fill-area'] = $this->theme->draganddropArea1Color ?: 'transparent'; + $this->sassVariables['drangandrop-area2-fill-area'] = $this->theme->draganddropArea2Color ?: 'transparent'; + // Main background $this->sassVariables['background-color'] = Color::colorToCSS($this->theme->backgroundColor); $this->sassVariables['background-custom'] = $this->theme->backgroundCustom ? 'true' : 'false'; @@ -252,6 +256,10 @@ class QuizCompiler extends Base protected function _escapeSassValue($value) { + $value = trim($value); + if (str_starts_with($value, 'rgb')) { + return $value; + } if (stristr($value, '.')) { return '"' . $value . '"'; } diff --git a/app/Models/QuizTheme.php b/app/Models/QuizTheme.php index 175065cd4..312248bdb 100644 --- a/app/Models/QuizTheme.php +++ b/app/Models/QuizTheme.php @@ -182,6 +182,7 @@ class QuizTheme extends ToolboxModel 'nokColor' => (string)$quiz->nokColor, 'logo' => hash_file('sha256', $logo), 'banner' => hash_file('sha256', $banner), + 'overlay' => (string)$quiz->overlay, ]; $hash = hash('sha256', print_r($data, true)); $theme = QuizTheme::withoutGlobalScopes()->where('hash', $hash)->first(); @@ -189,13 +190,16 @@ class QuizTheme extends ToolboxModel return $theme->id; } + $theme = new QuizTheme(); $theme->hash = $hash; $theme->name = $quiz->client . ' - ' . $quiz->title; $theme->mainColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->mainColor); - $theme->neutralColor = \Cubist\Util\Graphics\Color::colorToCSS('#333333'); $theme->okColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->okColor); $theme->nokColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->nokColor); + $theme->introColor = 'transparent'; + $theme->outroColor = $theme->standardColor = $theme->draganddropArea1Color = $theme->draganddropArea2Color = \Cubist\Util\Graphics\Color::colorToCSS($quiz->overlay); + $theme->neutralColor = \Cubist\Util\Graphics\Color::colorToCSS($quiz->overlay); $theme->backgroundColor = '#ffffff'; $theme->owner = 5; @@ -215,7 +219,6 @@ class QuizTheme extends ToolboxModel $tmp = Files::tempnam() . '.jpg'; $blur = Files::tempnam() . '.jpg'; - $resizer = new Resizer(); $resizer->loadImage($banner); $resizer->resize(1200, 680, true, true); @@ -223,6 +226,8 @@ class QuizTheme extends ToolboxModel Imagemagick::blur($tmp, $blur); $theme->addMediaToField('backgroundImage', $blur); + + $blur = Files::tempnam() . '.jpg'; $resizer = new Resizer(); $resizer->loadImage($banner); $resizer->resize(390, 844, true, true); @@ -235,8 +240,6 @@ class QuizTheme extends ToolboxModel $theme->backgroundHorizontalAlignMobile = HorizontalAlign::CENTER; $theme->backgroundVerticalAlignMobile = VerticalAlign::MIDDLE; - $theme->introCustom = '0'; - $theme->save(); return $theme->id; }