]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6250 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Sep 2023 19:55:55 +0000 (21:55 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 6 Sep 2023 19:55:55 +0000 (21:55 +0200)
app/SubForms/Quiz/Answer.php

index b80a4201541e12717be9206bcb2fc3131c65bd92..a11d251b9745791a0a70ce6134280a9edcd38c59 100644 (file)
@@ -4,7 +4,10 @@
 namespace App\SubForms\Quiz;
 
 use Cubist\Backpack\Magic\Fields\Integer;
+use Cubist\Backpack\Magic\Fields\SelectFromArray;
+use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Backpack\Magic\SubForm;
+
 // __('!! e-Learning')
 class Answer extends SubForm
 {
@@ -14,12 +17,33 @@ class Answer extends SubForm
 
         $this->addField(['name' => 'answer',
             'type' => 'Text',
-            'label' => __('Texte de la réponse')
+            'label' => __('Titre de la réponse')
+        ]);
+
+        $this->addField(['name' => 'answer_text',
+            'type' => Textarea::class,
+            'label' => __('Texte de la réponse'),
+            'when' => ['type' => ['draganddrop']],
+        ],
+        );
+
+        $this->addField(['name' => 'drop_area',
+            'type' => SelectFromArray::class,
+            'label' => __('Zone'),
+            'when' => ['type' => ['draganddrop']],
+            'allows_null' => false,
+            'default' => '1',
+            'options' => [
+                '1' => __('Zone :zone (:side)', ['zone' => 1, 'side' => __('gauche')]),
+                '2' => __('Zone :zone (:side)', ['zone' => 2, 'side' => __('droite')])
+            ]
         ]);
 
         $this->addField(['name' => 'correct',
             'type' => 'Checkbox',
-            'label' => __('Réponse correcte')]);
+            'label' => __('Réponse correcte'),
+            'when' => ['type' => ['multiple']],
+        ]);
 
         $this->addField(['name' => 'score',
             'type' => Integer::class,