]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6336 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Oct 2023 10:22:04 +0000 (12:22 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Oct 2023 10:22:04 +0000 (12:22 +0200)
app/Elearning/QuizCompiler.php
app/Models/QuizTheme.php

index b7e5a6f623eb1444e10f0bc96b11f74f3c77a806..a539fc8a7b84d1920f8bb4a2fbe53e011d6d1816 100644 (file)
@@ -158,6 +158,9 @@ class QuizCompiler extends Base
 
         $this->_addBackgrounds('background');
         $this->_addBackgrounds('intro');
+        $this->_addBackgrounds('standard');
+        $this->_addBackgrounds('draganddropArea1');
+        $this->_addBackgrounds('draganddropArea2');
 
         $this->writeSass();
     }
@@ -166,17 +169,15 @@ class QuizCompiler extends Base
     {
         $themePrefix = $themePrefix ?? $dataKey;
         $sassPrefix = $sassPrefix ?? $dataKey;
-        $this->data->set($dataKey, 'Image');
-        $this->data->set($dataKey . 'ImageMobile', '');
+        $this->data->set($dataKey, '');
+        $this->data->set($dataKey . 'Mobile', '');
 
+        $dataKeyCustom = trim($dataKey, '12') . 'Custom';
+        $custom = $this->theme->$dataKeyCustom;
 
-        if ($this->theme->{$dataKey . 'Custom'}) {
+        if ($custom) {
             $this->_addBackgroundVariables($sassPrefix . '-desktop', $themePrefix, $dataKey);
-            if ($this->theme->{$dataKey . 'CustomMobile'}) {
-                $this->_addBackgroundVariables($sassPrefix . '-mobile', $themePrefix, $dataKey . 'Mobile', 'Mobile');
-            } else {
-                $this->_addBackgroundVariables($sassPrefix . '-mobile', $themePrefix, $dataKey . 'Mobile');
-            }
+            $this->_addBackgroundVariables($sassPrefix . '-mobile', $themePrefix, $dataKey . 'Mobile', 'Mobile');
         }
     }
 
@@ -184,9 +185,14 @@ class QuizCompiler extends Base
     {
 
         $i = $this->data['theme']->{$themePrefix . 'Image' . $themeSuffix};
-        $this->data->set($dataKey, $i);
-        if (stristr($i, '.json')) {
-            $this->animations[$i] = file_get_contents($this->theme->getPageData()->getImageFile($themePrefix . 'Image' . $themeSuffix));
+        if ($i) {
+            $file = $this->theme->getPageData()->getImageFile($themePrefix . 'Image' . $themeSuffix);
+            if ($file && file_exists($file)) {
+                $this->data->set($dataKey, $i);
+                if (stristr($i, '.json')) {
+                    $this->animations[$i] = file_get_contents($this->theme->getPageData()->getImageFile($themePrefix . 'Image' . $themeSuffix));
+                }
+            }
         }
     }
 
index bb1d48e6ff133008851a0aa5cad75b189ff6c536..02ce2db9cac1adf48593b482372fd65b2ff49dd9 100644 (file)
@@ -89,15 +89,8 @@ class QuizTheme extends ToolboxModel
         $this->addField('', FormSeparator::class);
         $this->addField('backgroundCustom', Checkbox::class, __('Définir un fond personnalisé ou animé'));
         $this->addField('backgroundImage', FluidbookThemeImage::class, __('Image ou animation'), ['hint' => __('Taille recommandée : :size', ['size' => '1200 x 680px']), 'when' => ['backgroundCustom' => 1]]);
-//        $this->addField('backgroundSize', ThemeBackgroundSize::class, __('Affichage du fond'), ['when' => ['backgroundCustom' => 1]]);
-//        $this->addField('backgroundHorizontalAlign', HorizontalAlign::class, __('Alignement horizontal'), ['when' => ['backgroundCustom' => 1]]);
-//        $this->addField('backgroundVerticalAlign', VerticalAlign::class, __('Alignement vertical'), ['when' => ['backgroundCustom' => 1]]);
         $this->addField('', FormSeparator::class, '', ['when' => ['backgroundCustom' => 1]]);
-        $this->addField('backgroundCustomMobile', Checkbox::class, __('Définir un fond spécifique sur mobile'), ['when' => ['backgroundCustom' => 1]]);
-        $this->addField('backgroundImageMobile', FluidbookThemeImage::class, __('Image ou animation'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 844px']), 'when' => ['backgroundCustom' => 1, 'backgroundCustomMobile' => 1]]);
-//        $this->addField('backgroundSizeMobile', ThemeBackgroundSize::class, __('Affichage du fond'), ['when' => ['backgroundCustom' => 1, 'backgroundCustomMobile' => 1]]);
-//        $this->addField('backgroundHorizontalAlignMobile', HorizontalAlign::class, __('Alignement horizontal'), ['when' => ['backgroundCustom' => 1, 'backgroundCustomMobile' => 1]]);
-//        $this->addField('backgroundVerticalAlignMobile', VerticalAlign::class, __('Alignement vertical'), ['when' => ['backgroundCustom' => 1, 'backgroundCustomMobile' => 1]]);
+        $this->addField('backgroundImageMobile', FluidbookThemeImage::class, __('Image ou animation'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 844px']), 'when' => ['backgroundCustom' => 1]]);
     }