]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6108 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Jul 2023 16:20:04 +0000 (18:20 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 20 Jul 2023 16:20:04 +0000 (18:20 +0200)
app/Models/QuizTheme.php

index 7b7ad0ce9c2e711fba7b2d12fce88bf8513cef01..c534a0753dbc70d955e445863e2baded36991e07 100644 (file)
@@ -2,7 +2,10 @@
 
 namespace App\Models;
 
+use App\Fields\FluidbookThemeImage;
 use App\Models\Base\ToolboxModel;
+use Cubist\Backpack\Magic\Fields\Color;
+use Cubist\Backpack\Magic\Fields\FormSection;
 
 class QuizTheme extends ToolboxModel
 {
@@ -17,4 +20,84 @@ class QuizTheme extends ToolboxModel
     protected static $_permissionBase = 'quiz';
 
     public $registerMediaConversionsUsingModelInstance = false;
+
+    public function setFields()
+    {
+        parent::setFields();
+
+        parent::setFields();
+
+        $this->addOwnerField();
+
+        $this->addField('name', 'Text', __('Nom'), ['column' => true]);
+        //$this->addField('preview', 'NoValue', __('Preview'), ['column_escape' => false, 'column' => true, 'column_type' => 'model_function', 'column_function_name' => 'getPreviewImage', 'column_limit' => -1]);
+
+        $this->setSettingsFields();
+    }
+
+    public function setSettingsFields()
+    {
+        $this->_colors();
+        $this->_logo();
+        $this->_background();
+        $this->_intro();
+        $this->_standardQuestions();
+        $this->_draganddropQuestions();
+        $this->_outro();
+    }
+
+    protected function _colors()
+    {
+        $this->addField([
+            'name' => 'section_colors',
+            'type' => FormSection::class,
+            'label' => __('Couleurs principales'),
+        ]);
+
+        $this->addField('mainColor', Color::class, __('Couleur d\'accent'), ['hint' => __('Couleur du bouton principal et des éléments d\'accents du thème')]);
+        $this->addField('neutralColor', Color::class, __('Couleur neutre principale'), ['hint' => __('Couleur des éléments d\'habillage du thème (privilégier une couleur foncée)')]);
+        $this->addField('okColor', Color::class, __('Couleur OK'), ['hint' => __('Couleur générale affectée aux bonnes réponses (habituellement vert)')]);
+        $this->addField('nokColor', Color::class, __('Couleur pas OK'), ['hint' => __('Couleur générale affectée aux mauvaises réponses (habituellement rouge)')]);
+
+    }
+
+    protected function _logo()
+    {
+        $this->addField('section_logo', FormSection::class, __('Logo'));
+
+        $this->addField([
+            'name' => 'logo',
+            'type' => FluidbookThemeImage::class,
+            'accept' => '.svg,.png,.jpg',
+            'label' => __('Logo'),
+            'hint' => __('Hauteur 40px'),
+        ]);
+
+        $this->addField('favicon', FluidbookThemeImage::class, __('Icône pour favicon et apps'), ['hint' => 'Carré de 512x512px']);
+    }
+
+    protected function _background()
+    {
+
+    }
+
+    protected function _intro()
+    {
+
+    }
+
+    protected function _standardQuestions()
+    {
+
+    }
+
+    protected function _draganddropQuestions()
+    {
+
+    }
+
+    protected function _outro()
+    {
+
+    }
 }